Merge branch 'develop' into chore/ts-RoomView
This commit is contained in:
commit
228e073f58
|
@ -144,7 +144,7 @@ android {
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode VERSIONCODE as Integer
|
versionCode VERSIONCODE as Integer
|
||||||
versionName "4.22.0"
|
versionName "4.23.0"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
if (!isFoss) {
|
if (!isFoss) {
|
||||||
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
|
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { inquiryQueueAdd, inquiryQueueRemove, inquiryQueueUpdate, inquiryRequest
|
||||||
const removeListener = listener => listener.stop();
|
const removeListener = listener => listener.stop();
|
||||||
|
|
||||||
let connectedListener;
|
let connectedListener;
|
||||||
let disconnectedListener;
|
|
||||||
let queueListener;
|
let queueListener;
|
||||||
|
|
||||||
const streamTopic = 'stream-livechat-inquiry-queue-observer';
|
const streamTopic = 'stream-livechat-inquiry-queue-observer';
|
||||||
|
@ -48,10 +47,6 @@ export default function subscribeInquiry() {
|
||||||
connectedListener.then(removeListener);
|
connectedListener.then(removeListener);
|
||||||
connectedListener = false;
|
connectedListener = false;
|
||||||
}
|
}
|
||||||
if (disconnectedListener) {
|
|
||||||
disconnectedListener.then(removeListener);
|
|
||||||
disconnectedListener = false;
|
|
||||||
}
|
|
||||||
if (queueListener) {
|
if (queueListener) {
|
||||||
queueListener.then(removeListener);
|
queueListener.then(removeListener);
|
||||||
queueListener = false;
|
queueListener = false;
|
||||||
|
@ -59,7 +54,6 @@ export default function subscribeInquiry() {
|
||||||
};
|
};
|
||||||
|
|
||||||
connectedListener = RocketChat.onStreamData('connected', handleConnection);
|
connectedListener = RocketChat.onStreamData('connected', handleConnection);
|
||||||
disconnectedListener = RocketChat.onStreamData('close', handleConnection);
|
|
||||||
queueListener = RocketChat.onStreamData(streamTopic, handleQueueMessageReceived);
|
queueListener = RocketChat.onStreamData(streamTopic, handleQueueMessageReceived);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import messagesStatus from '../../../constants/messagesStatus';
|
||||||
import log from '../../../utils/log';
|
import log from '../../../utils/log';
|
||||||
import random from '../../../utils/random';
|
import random from '../../../utils/random';
|
||||||
import store from '../../createStore';
|
import store from '../../createStore';
|
||||||
import { roomsRequest } from '../../../actions/rooms';
|
|
||||||
import { handlePayloadUserInteraction } from '../actions';
|
import { handlePayloadUserInteraction } from '../actions';
|
||||||
import buildMessage from '../helpers/buildMessage';
|
import buildMessage from '../helpers/buildMessage';
|
||||||
import RocketChat from '../../rocketchat';
|
import RocketChat from '../../rocketchat';
|
||||||
|
@ -21,8 +20,6 @@ import { E2E_MESSAGE_TYPE } from '../../encryption/constants';
|
||||||
|
|
||||||
const removeListener = listener => listener.stop();
|
const removeListener = listener => listener.stop();
|
||||||
|
|
||||||
let connectedListener;
|
|
||||||
let disconnectedListener;
|
|
||||||
let streamListener;
|
let streamListener;
|
||||||
let subServer;
|
let subServer;
|
||||||
let queue = {};
|
let queue = {};
|
||||||
|
@ -255,10 +252,6 @@ const debouncedUpdate = subscription => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function subscribeRooms() {
|
export default function subscribeRooms() {
|
||||||
const handleConnection = () => {
|
|
||||||
store.dispatch(roomsRequest());
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleStreamMessageReceived = protectedFunction(async ddpMessage => {
|
const handleStreamMessageReceived = protectedFunction(async ddpMessage => {
|
||||||
const db = database.active;
|
const db = database.active;
|
||||||
|
|
||||||
|
@ -388,14 +381,6 @@ export default function subscribeRooms() {
|
||||||
});
|
});
|
||||||
|
|
||||||
const stop = () => {
|
const stop = () => {
|
||||||
if (connectedListener) {
|
|
||||||
connectedListener.then(removeListener);
|
|
||||||
connectedListener = false;
|
|
||||||
}
|
|
||||||
if (disconnectedListener) {
|
|
||||||
disconnectedListener.then(removeListener);
|
|
||||||
disconnectedListener = false;
|
|
||||||
}
|
|
||||||
if (streamListener) {
|
if (streamListener) {
|
||||||
streamListener.then(removeListener);
|
streamListener.then(removeListener);
|
||||||
streamListener = false;
|
streamListener = false;
|
||||||
|
@ -407,8 +392,6 @@ export default function subscribeRooms() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
connectedListener = this.sdk.onStreamData('connected', handleConnection);
|
|
||||||
// disconnectedListener = this.sdk.onStreamData('close', handleConnection);
|
|
||||||
streamListener = this.sdk.onStreamData('stream-notify-user', handleStreamMessageReceived);
|
streamListener = this.sdk.onStreamData('stream-notify-user', handleStreamMessageReceived);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -239,37 +239,34 @@ const RocketChat = {
|
||||||
this.code = null;
|
this.code = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sdk = new RocketchatClient({ host: server, protocol: 'ddp', useSsl: useSsl(server) });
|
// The app can't reconnect if reopen interval is 5s while in development
|
||||||
|
this.sdk = new RocketchatClient({ host: server, protocol: 'ddp', useSsl: useSsl(server), reopen: __DEV__ ? 20000 : 5000 });
|
||||||
this.getSettings();
|
this.getSettings();
|
||||||
|
|
||||||
const sdkConnect = () =>
|
|
||||||
this.sdk
|
this.sdk
|
||||||
.connect()
|
.connect()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const { server: currentServer } = reduxStore.getState().server;
|
console.log('connected');
|
||||||
if (user && user.token && server === currentServer) {
|
|
||||||
reduxStore.dispatch(loginRequest({ resume: user.token }, logoutOnError));
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log('connect error', err);
|
console.log('connect error', err);
|
||||||
|
|
||||||
// when `connect` raises an error, we try again in 10 seconds
|
|
||||||
this.connectTimeout = setTimeout(() => {
|
|
||||||
if (this.sdk?.client?.host === server) {
|
|
||||||
sdkConnect();
|
|
||||||
}
|
|
||||||
}, 10000);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sdkConnect();
|
|
||||||
|
|
||||||
this.connectingListener = this.sdk.onStreamData('connecting', () => {
|
this.connectingListener = this.sdk.onStreamData('connecting', () => {
|
||||||
reduxStore.dispatch(connectRequest());
|
reduxStore.dispatch(connectRequest());
|
||||||
});
|
});
|
||||||
|
|
||||||
this.connectedListener = this.sdk.onStreamData('connected', () => {
|
this.connectedListener = this.sdk.onStreamData('connected', () => {
|
||||||
|
const { connected } = reduxStore.getState().meteor;
|
||||||
|
if (connected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
reduxStore.dispatch(connectSuccess());
|
reduxStore.dispatch(connectSuccess());
|
||||||
|
const { server: currentServer } = reduxStore.getState().server;
|
||||||
|
const { user } = reduxStore.getState().login;
|
||||||
|
if (user?.token && server === currentServer) {
|
||||||
|
reduxStore.dispatch(loginRequest({ resume: user.token }, logoutOnError));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.closeListener = this.sdk.onStreamData('close', () => {
|
this.closeListener = this.sdk.onStreamData('close', () => {
|
||||||
|
|
|
@ -7,6 +7,21 @@ import I18n from '../i18n';
|
||||||
import { extractHostname } from './server';
|
import { extractHostname } from './server';
|
||||||
|
|
||||||
const { SSLPinning } = NativeModules;
|
const { SSLPinning } = NativeModules;
|
||||||
|
const { documentDirectory } = FileSystem;
|
||||||
|
|
||||||
|
const extractFileScheme = path => path.replace('file://', ''); // file:// isn't allowed by obj-C
|
||||||
|
|
||||||
|
const getPath = name => `${documentDirectory}/${name}`;
|
||||||
|
|
||||||
|
const persistCertificate = async (name, password) => {
|
||||||
|
const certificatePath = getPath(name);
|
||||||
|
const certificate = {
|
||||||
|
path: extractFileScheme(certificatePath),
|
||||||
|
password
|
||||||
|
};
|
||||||
|
await UserPreferences.setMapAsync(name, certificate);
|
||||||
|
return certificate;
|
||||||
|
};
|
||||||
|
|
||||||
const RCSSLPinning = Platform.select({
|
const RCSSLPinning = Platform.select({
|
||||||
ios: {
|
ios: {
|
||||||
|
@ -25,17 +40,9 @@ const RCSSLPinning = Platform.select({
|
||||||
text: 'OK',
|
text: 'OK',
|
||||||
onPress: async password => {
|
onPress: async password => {
|
||||||
try {
|
try {
|
||||||
const certificatePath = `${FileSystem.documentDirectory}/${name}`;
|
const certificatePath = getPath(name);
|
||||||
|
|
||||||
await FileSystem.copyAsync({ from: uri, to: certificatePath });
|
await FileSystem.copyAsync({ from: uri, to: certificatePath });
|
||||||
|
await persistCertificate(name, password);
|
||||||
const certificate = {
|
|
||||||
path: certificatePath.replace('file://', ''), // file:// isn't allowed by obj-C
|
|
||||||
password
|
|
||||||
};
|
|
||||||
|
|
||||||
await UserPreferences.setMapAsync(name, certificate);
|
|
||||||
|
|
||||||
resolve(name);
|
resolve(name);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
|
@ -49,16 +56,19 @@ const RCSSLPinning = Platform.select({
|
||||||
reject(e);
|
reject(e);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
setCertificate: async (alias, server) => {
|
setCertificate: async (name, server) => {
|
||||||
if (alias) {
|
if (name) {
|
||||||
const certificate = await UserPreferences.getMapAsync(alias);
|
let certificate = await UserPreferences.getMapAsync(name);
|
||||||
|
if (!certificate.path.match(extractFileScheme(documentDirectory))) {
|
||||||
|
certificate = await persistCertificate(name, certificate.password);
|
||||||
|
}
|
||||||
await UserPreferences.setMapAsync(extractHostname(server), certificate);
|
await UserPreferences.setMapAsync(extractHostname(server), certificate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
android: {
|
android: {
|
||||||
pickCertificate: () => SSLPinning?.pickCertificate(),
|
pickCertificate: () => SSLPinning?.pickCertificate(),
|
||||||
setCertificate: alias => SSLPinning?.setCertificate(alias)
|
setCertificate: name => SSLPinning?.setCertificate(name)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1682,7 +1682,7 @@
|
||||||
INFOPLIST_FILE = NotificationService/Info.plist;
|
INFOPLIST_FILE = NotificationService/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||||
MARKETING_VERSION = 4.22.0;
|
MARKETING_VERSION = 4.23.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = chat.rocket.reactnative.NotificationService;
|
PRODUCT_BUNDLE_IDENTIFIER = chat.rocket.reactnative.NotificationService;
|
||||||
|
@ -1719,7 +1719,7 @@
|
||||||
INFOPLIST_FILE = NotificationService/Info.plist;
|
INFOPLIST_FILE = NotificationService/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||||
MARKETING_VERSION = 4.22.0;
|
MARKETING_VERSION = 4.23.0;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = chat.rocket.reactnative.NotificationService;
|
PRODUCT_BUNDLE_IDENTIFIER = chat.rocket.reactnative.NotificationService;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>4.22.0</string>
|
<string>4.23.0</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>XPC!</string>
|
<string>XPC!</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>4.22.0</string>
|
<string>4.23.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>KeychainGroup</key>
|
<key>KeychainGroup</key>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "rocket-chat-reactnative",
|
"name": "rocket-chat-reactnative",
|
||||||
"version": "4.22.0",
|
"version": "4.23.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-native start",
|
"start": "react-native start",
|
||||||
|
|
|
@ -3760,7 +3760,7 @@
|
||||||
|
|
||||||
"@rocket.chat/sdk@RocketChat/Rocket.Chat.js.SDK#mobile":
|
"@rocket.chat/sdk@RocketChat/Rocket.Chat.js.SDK#mobile":
|
||||||
version "1.1.0-mobile"
|
version "1.1.0-mobile"
|
||||||
resolved "https://codeload.github.com/RocketChat/Rocket.Chat.js.SDK/tar.gz/0ee2ded22b08b34ce7ab62b26e42a713dca0d1ac"
|
resolved "https://codeload.github.com/RocketChat/Rocket.Chat.js.SDK/tar.gz/c64e69ea22514ae3bbe24e36ca77868fdae76157"
|
||||||
dependencies:
|
dependencies:
|
||||||
js-sha256 "^0.9.0"
|
js-sha256 "^0.9.0"
|
||||||
lru-cache "^4.1.1"
|
lru-cache "^4.1.1"
|
||||||
|
|
Loading…
Reference in New Issue