diff --git a/app/lib/rocketchat/rocketchat.js b/app/lib/rocketchat/rocketchat.js index d4fecd1e3..788e93a0c 100644 --- a/app/lib/rocketchat/rocketchat.js +++ b/app/lib/rocketchat/rocketchat.js @@ -227,14 +227,6 @@ const RocketChat = { return resolve(); }); }, - removePushToken() { - const token = getDeviceToken(); - if (token) { - // RC 0.60.0 - return this.sdk.del('push.token', { token }); - } - return Promise.resolve(); - }, loadMissedMessages, loadMessagesForRoom, loadSurroundingMessages, diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index d01318989..703515698 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -8,12 +8,13 @@ import { IUser, TRocketChat } from '../../../definitions'; -import { TParams } from '../../../definitions/ILivechatEditView'; import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces'; import { ISpotlight } from '../../../definitions/ISpotlight'; import { TEAM_TYPE } from '../../../definitions/ITeam'; -import { store as reduxStore, store } from '../../auxStore'; import { Encryption } from '../../encryption'; +import { TParams } from '../../../definitions/ILivechatEditView'; +import { store as reduxStore } from '../../auxStore'; +import { getDeviceToken } from '../../../notifications/push'; import { compareServerVersion } from '../../utils'; import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType'; import sdk from './sdk'; @@ -766,7 +767,7 @@ export const useInviteToken = (token: string): any => sdk.post('useInviteToken', { token }); export const readThreads = (tmid: string): Promise => { - const serverVersion = store.getState().server.version; + const serverVersion = reduxStore.getState().server.version; if (compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '3.4.0')) { // RC 3.4.0 return sdk.methodCallWrapper('readThreads', tmid); @@ -812,6 +813,15 @@ export const editMessage = async (message: IMessage) => { return sdk.post('chat.update', { roomId: rid, msgId: message.id, text: msg }); }; +export const removePushToken = (): Promise => { + const token = getDeviceToken(); + if (token) { + // RC 0.60.0 + return sdk.current.del('push.token', { token }); + } + return Promise.resolve(); +}; + export const sendEmailCode = () => { const { username } = reduxStore.getState().login.user as IUser; // RC 3.1.0