Chore: Migrate REST API - removePushToken to Typescript (#3903)
This commit is contained in:
parent
823d4c658c
commit
8efba39370
|
@ -227,14 +227,6 @@ const RocketChat = {
|
||||||
return resolve();
|
return resolve();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
removePushToken() {
|
|
||||||
const token = getDeviceToken();
|
|
||||||
if (token) {
|
|
||||||
// RC 0.60.0
|
|
||||||
return this.sdk.del('push.token', { token });
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
|
||||||
loadMissedMessages,
|
loadMissedMessages,
|
||||||
loadMessagesForRoom,
|
loadMessagesForRoom,
|
||||||
loadSurroundingMessages,
|
loadSurroundingMessages,
|
||||||
|
|
|
@ -8,12 +8,13 @@ import {
|
||||||
IUser,
|
IUser,
|
||||||
TRocketChat
|
TRocketChat
|
||||||
} from '../../../definitions';
|
} from '../../../definitions';
|
||||||
import { TParams } from '../../../definitions/ILivechatEditView';
|
|
||||||
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces';
|
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces';
|
||||||
import { ISpotlight } from '../../../definitions/ISpotlight';
|
import { ISpotlight } from '../../../definitions/ISpotlight';
|
||||||
import { TEAM_TYPE } from '../../../definitions/ITeam';
|
import { TEAM_TYPE } from '../../../definitions/ITeam';
|
||||||
import { store as reduxStore, store } from '../../auxStore';
|
|
||||||
import { Encryption } from '../../encryption';
|
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 { compareServerVersion } from '../../utils';
|
||||||
import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
|
import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
|
||||||
import sdk from './sdk';
|
import sdk from './sdk';
|
||||||
|
@ -766,7 +767,7 @@ export const useInviteToken = (token: string): any =>
|
||||||
sdk.post('useInviteToken', { token });
|
sdk.post('useInviteToken', { token });
|
||||||
|
|
||||||
export const readThreads = (tmid: string): Promise<void> => {
|
export const readThreads = (tmid: string): Promise<void> => {
|
||||||
const serverVersion = store.getState().server.version;
|
const serverVersion = reduxStore.getState().server.version;
|
||||||
if (compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '3.4.0')) {
|
if (compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '3.4.0')) {
|
||||||
// RC 3.4.0
|
// RC 3.4.0
|
||||||
return sdk.methodCallWrapper('readThreads', tmid);
|
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 });
|
return sdk.post('chat.update', { roomId: rid, msgId: message.id, text: msg });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const removePushToken = (): Promise<boolean | void> => {
|
||||||
|
const token = getDeviceToken();
|
||||||
|
if (token) {
|
||||||
|
// RC 0.60.0
|
||||||
|
return sdk.current.del('push.token', { token });
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
};
|
||||||
|
|
||||||
export const sendEmailCode = () => {
|
export const sendEmailCode = () => {
|
||||||
const { username } = reduxStore.getState().login.user as IUser;
|
const { username } = reduxStore.getState().login.user as IUser;
|
||||||
// RC 3.1.0
|
// RC 3.1.0
|
||||||
|
|
Loading…
Reference in New Issue