update: ILoginResultFromServer

remove: `shareSDK` from IRocketChat
update: `getWebsocketInfo`
add: connect method to SDK
This commit is contained in:
Gerzon Z 2022-03-02 12:42:40 -04:00
parent ab8ff58fba
commit 3aa227e699
4 changed files with 12 additions and 22 deletions

View File

@ -23,28 +23,16 @@ export interface ILoggedUser {
enableMessageParserEarlyAdoption?: boolean;
}
export interface ILoggedUserResultFromServer
extends Omit<ILoggedUser, 'enableMessageParserEarlyAdoption' | 'showMessageInMainThread'> {
settings: IUserSettings;
}
export interface ILoginResultFromServer {
status: string;
authToken: string;
userId: string;
me: {
id: string;
token: string;
username: string;
name: string;
language?: string;
status: UserStatus;
statusText?: string;
customFields?: {
[key: string]: any;
};
statusLivechat?: string;
emails?: IUserEmail[];
roles?: string[];
avatarETag?: string;
isFromWebView?: boolean;
settings: IUserSettings;
};
me: ILoggedUserResultFromServer;
}
export type TLoggedUserModel = ILoggedUser & Model;

View File

@ -4,7 +4,6 @@ type TRocketChat = typeof rocketchat;
export interface IRocketChat extends TRocketChat {
sdk: any;
shareSDK: any;
activeUsersSubTimeout: any;
roomsSub: any;
}

View File

@ -1,7 +1,6 @@
import RNFetchBlob from 'rn-fetch-blob';
import { Rocketchat as RocketchatClient, settings as RocketChatSettings } from '@rocket.chat/sdk';
import { settings as RocketChatSettings } from '@rocket.chat/sdk';
import { useSsl } from '../../../utils/url';
import { selectServerFailure } from '../../../actions/server';
import { twoFactor } from '../../../utils/twoFactor';
import { compareServerVersion } from '../../utils';
@ -183,7 +182,7 @@ async function getServerInfo(server: string) {
}
async function getWebsocketInfo({ server }: { server: string }) {
const sdk = new RocketchatClient({ host: server, protocol: 'ddp', useSsl: useSsl(server) });
sdk.initialize(server);
try {
await sdk.connect();

View File

@ -174,6 +174,10 @@ class Sdk {
abort() {
return this.sdk.abort();
}
connect() {
return this.sdk.connect();
}
}
const sdk = new Sdk();