Compare commits

...

3 Commits

Author SHA1 Message Date
Gerzon Z 9a9edc7f94 Merge branch 'develop' into fix.e2efetchkeys-startup 2022-03-10 10:19:34 -04:00
Gerzon Z 70d79d402d fix: `login` when changing server 2022-03-09 11:16:57 -04:00
Gerzon Z 373da53dc3 remove: `this.sdk` from `e2eFetchMyKeys` 2022-03-08 18:28:22 -04:00
2 changed files with 14 additions and 4 deletions

View File

@ -11,7 +11,6 @@ import { getBundleId, isIOS } from '../../utils/deviceInfo';
import log from '../../utils/log';
import SSLPinning from '../../utils/sslPinning';
import database from '../database';
import { sanitizeLikeString } from '../database/utils';
import { Encryption } from '../encryption';
import triggerBlockAction, { triggerCancel, triggerSubmitView } from '../methods/actions';
import callJitsi, { callJitsiWithoutServer } from '../methods/callJitsi';
@ -186,8 +185,13 @@ const RocketChat = {
async e2eFetchMyKeys() {
// RC 0.70.0
const sdk = this.shareSDK || this.sdk;
const result = await sdk.get('e2e.fetchMyKeys');
const currentSdk = this.shareSDK || this.sdk;
let result;
if (currentSdk) {
result = await currentSdk.get('e2e.fetchMyKeys');
} else if (sdk.current) {
result = await sdk.current.get('e2e.fetchMyKeys');
}
// snake_case -> camelCase
if (result.success) {
return {

View File

@ -260,7 +260,13 @@ function stopListener(listener: any): boolean {
async function login(credentials: ICredentials, isFromWebView = false): Promise<ILoggedUser | undefined> {
// RC 0.64.0
if (sdk.current) {
await sdk.current.login(credentials);
} else {
const { server } = store.getState().server;
sdk.initialize(server);
await sdk.current.login(credentials);
}
const result = sdk.current.currentLogin?.result;
if (result) {
const user: ILoggedUser = {