chore: add rest api return (#3865)
This commit is contained in:
parent
abd9722133
commit
b962925121
|
@ -4,7 +4,7 @@ import { IMessage } from './IMessage';
|
|||
import { IRocketChatRecord } from './IRocketChatRecord';
|
||||
import { IServedBy } from './IServedBy';
|
||||
import { IVisitor, SubscriptionType } from './ISubscription';
|
||||
import { IUser } from './IUser';
|
||||
import { IUser, TNotifications } from './IUser';
|
||||
|
||||
interface IRequestTranscript {
|
||||
email: string;
|
||||
|
@ -202,3 +202,13 @@ export interface IServerRoom extends IRocketChatRecord {
|
|||
livechatData?: any;
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
export interface IRoomNotifications {
|
||||
disableNotifications?: boolean;
|
||||
muteGroupMentions?: boolean;
|
||||
hideUnreadStatus?: boolean;
|
||||
audioNotificationsValue?: string;
|
||||
desktopNotifications?: TNotifications;
|
||||
mobilePushNotifications?: TNotifications;
|
||||
emailNotifications?: TNotifications;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ export interface IUserSettings {
|
|||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
type TNotifications = 'default' | 'all' | 'mentions' | 'nothing';
|
||||
export type TNotifications = 'default' | 'all' | 'mentions' | 'nothing';
|
||||
|
||||
export interface INotificationPreferences {
|
||||
id: string;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { IMessage } from '../../IMessage';
|
||||
import type { IServerRoom } from '../../IRoom';
|
||||
import type { IRoomNotifications, IServerRoom } from '../../IRoom';
|
||||
import type { IUser } from '../../IUser';
|
||||
|
||||
export type RoomsEndpoints = {
|
||||
|
@ -41,4 +41,7 @@ export type RoomsEndpoints = {
|
|||
'rooms.favorite': {
|
||||
POST: (params: { roomId: string; favorite: boolean }) => {};
|
||||
};
|
||||
'rooms.saveNotification': {
|
||||
POST: (params: { roomId: string; notifications: IRoomNotifications }) => {};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import sdk from './sdk';
|
||||
import { TEAM_TYPE } from '../../../definitions/ITeam';
|
||||
import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
|
||||
import { SubscriptionType, INotificationPreferences } from '../../../definitions';
|
||||
import { SubscriptionType, INotificationPreferences, IRoomNotifications } from '../../../definitions';
|
||||
import { ISpotlight } from '../../../definitions/ISpotlight';
|
||||
|
||||
export const createChannel = ({
|
||||
|
@ -555,10 +555,8 @@ export const saveUserPreferences = (data: Partial<INotificationPreferences>) =>
|
|||
// RC 0.62.0
|
||||
sdk.post('users.setPreferences', { data });
|
||||
|
||||
export const saveNotificationSettings = (roomId: string, notifications: any): any =>
|
||||
export const saveNotificationSettings = (roomId: string, notifications: IRoomNotifications) =>
|
||||
// RC 0.63.0
|
||||
// TODO: missing definitions from server
|
||||
// @ts-ignore
|
||||
sdk.post('rooms.saveNotification', { roomId, notifications });
|
||||
|
||||
export const getSingleMessage = (msgId: string) =>
|
||||
|
|
|
@ -18,6 +18,7 @@ import log, { events, logEvent } from '../../utils/log';
|
|||
import sharedStyles from '../Styles';
|
||||
import { OPTIONS } from './options';
|
||||
import { ChatsStackParamList } from '../../stacks/types';
|
||||
import { IRoomNotifications } from '../../definitions';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
pickerText: {
|
||||
|
@ -73,7 +74,7 @@ class NotificationPreferencesView extends React.Component<INotificationPreferenc
|
|||
}
|
||||
}
|
||||
|
||||
saveNotificationSettings = async (key: string, value: string | boolean, params: any) => {
|
||||
saveNotificationSettings = async (key: string, value: string | boolean, params: IRoomNotifications) => {
|
||||
// @ts-ignore
|
||||
logEvent(events[`NP_${key.toUpperCase()}`]);
|
||||
const { room } = this.state;
|
||||
|
|
Loading…
Reference in New Issue