Compare commits
3 Commits
develop
...
chore.ts-d
Author | SHA1 | Date |
---|---|---|
Reinaldo Neto | 58ab3b0327 | |
Reinaldo Neto | 36e2aa759a | |
Reinaldo Neto | 027104a90f |
|
@ -1,4 +0,0 @@
|
|||
export interface IRocketChatRecord {
|
||||
id: string;
|
||||
updatedAt: Date;
|
||||
}
|
|
@ -1,27 +1,20 @@
|
|||
import { IRocketChatRecord } from './IRocketChatRecord';
|
||||
import Model from '@nozbe/watermelondb/Model';
|
||||
|
||||
export enum RoomType {
|
||||
GROUP = 'p',
|
||||
DIRECT = 'd',
|
||||
CHANNEL = 'c',
|
||||
OMNICHANNEL = 'l',
|
||||
THREAD = 'thread'
|
||||
import { IServedBy } from './IServedBy';
|
||||
|
||||
export interface IRoom {
|
||||
id: string;
|
||||
customFields: string[];
|
||||
broadcast: boolean;
|
||||
encrypted: boolean;
|
||||
e2eKeyId?: string;
|
||||
ro: boolean;
|
||||
v: string[];
|
||||
servedBy: IServedBy;
|
||||
departmentId: string;
|
||||
livechatData?: any;
|
||||
tags?: string[];
|
||||
avatarETag?: string;
|
||||
}
|
||||
|
||||
export interface IRoom extends IRocketChatRecord {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
name: string;
|
||||
fname: string;
|
||||
prid?: string;
|
||||
tmid?: string;
|
||||
topic?: string;
|
||||
teamMain?: boolean;
|
||||
teamId?: string;
|
||||
encrypted?: boolean;
|
||||
visitor?: boolean;
|
||||
autoTranslateLanguage?: boolean;
|
||||
autoTranslate?: boolean;
|
||||
observe?: Function;
|
||||
usedCannedResponse: string;
|
||||
}
|
||||
export type TRoomModel = IRoom & Model;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
export interface IServedBy {
|
||||
_id: string;
|
||||
username: string;
|
||||
ts: Date;
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
export enum SubscriptionType {
|
||||
GROUP = 'p',
|
||||
DIRECT = 'd',
|
||||
CHANNEL = 'c',
|
||||
OMNICHANNEL = 'l',
|
||||
THREAD = 'thread'
|
||||
}
|
||||
|
||||
export interface IUserMessage {
|
||||
_id: string;
|
||||
username: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
// export interface ILastMessage {"_id":string,"rid":string,"tshow":boolean,"tmid":string,"msg":string,"ts":Date,"u":IUserMessage,"_updatedAt":Date,"urls":string[],"mentions":[],"channels":[],"md":[{"type":"PARAGRAPH","value":[{"type":"PLAIN_TEXT","value":"olaaa"}]}],"attachments":[],"reactions":[],"unread":false,"status":0}
|
||||
|
||||
export interface ISubscription {
|
||||
_id: string; // _id belongs watermelonDB
|
||||
id: string; // id from server
|
||||
f: boolean;
|
||||
t: SubscriptionType;
|
||||
ts: Date;
|
||||
ls: Date;
|
||||
name: string;
|
||||
fname?: string;
|
||||
rid: string; // the same as id
|
||||
open: boolean;
|
||||
alert: boolean;
|
||||
roles: string[];
|
||||
unread: number;
|
||||
userMentions: number;
|
||||
groupMentions: number;
|
||||
tunread: string[];
|
||||
tunreadUser: string[];
|
||||
tunreadGroup: string[];
|
||||
roomUpdatedAt: Date;
|
||||
ro: boolean;
|
||||
lastOpen: Date;
|
||||
description?: string;
|
||||
announcement?: string;
|
||||
bannerClosed?: boolean;
|
||||
topic?: string;
|
||||
blocked: boolean;
|
||||
blocker: boolean;
|
||||
reactWhenReadOnly: boolean;
|
||||
archived: boolean;
|
||||
joinCodeRequired: boolean;
|
||||
notifications: any;
|
||||
muted: string[];
|
||||
ignored: string[];
|
||||
broadcast?: boolean;
|
||||
prid: string;
|
||||
draftMessage: string;
|
||||
lastThreadSync: Date;
|
||||
jitsiTimeout: number;
|
||||
autoTranslate?: boolean;
|
||||
autoTranslateLanguage?: boolean;
|
||||
// lastMessage:
|
||||
// messages
|
||||
// threads
|
||||
// threadMessages
|
||||
// hideUnreadStatus
|
||||
// sysMes
|
||||
// uids
|
||||
// usernames
|
||||
// visitor
|
||||
// departmentId
|
||||
// servedBy
|
||||
// livechatData
|
||||
// tags
|
||||
// E2EKey
|
||||
// encrypted
|
||||
// e2eKeyId
|
||||
// avatarETag
|
||||
// teamId
|
||||
// teamMain
|
||||
}
|
||||
// updatedAt: Date;
|
||||
// rid: string;
|
||||
// t: SubscriptionType;
|
||||
// name: string;
|
||||
// fname: string;
|
||||
// prid?: string;
|
||||
// tmid?: string;
|
||||
// topic?: string;
|
||||
// teamMain?: boolean;
|
||||
// teamId?: string;
|
||||
// encrypted?: boolean;
|
||||
// visitor?: boolean;
|
||||
// autoTranslateLanguage?: boolean;
|
||||
// autoTranslate?: boolean;
|
||||
// observe?: Function;
|
||||
// usedCannedResponse: string;
|
|
@ -1,6 +1,6 @@
|
|||
import { NavigatorScreenParams } from '@react-navigation/core';
|
||||
|
||||
import { IRoom } from './definitions/IRoom';
|
||||
import { ISubscription } from './definitions/ISubscription';
|
||||
import { IServer } from './definitions/IServer';
|
||||
import { IAttachment } from './definitions/IAttachment';
|
||||
import { MasterDetailInsideStackParamList } from './stacks/MasterDetailStack/types';
|
||||
|
@ -28,7 +28,7 @@ export type ShareInsideStackParamList = {
|
|||
isShareExtension: boolean;
|
||||
serverInfo: IServer;
|
||||
text: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
thread: any; // TODO: Change
|
||||
};
|
||||
SelectServerView: undefined;
|
||||
|
|
|
@ -3,18 +3,18 @@ import { NavigatorScreenParams } from '@react-navigation/core';
|
|||
|
||||
import { IAttachment } from '../../definitions/IAttachment';
|
||||
import { IMessage } from '../../definitions/IMessage';
|
||||
import { IRoom, RoomType } from '../../definitions/IRoom';
|
||||
import { ISubscription, SubscriptionType } from '../../definitions/ISubscription';
|
||||
|
||||
export type MasterDetailChatsStackParamList = {
|
||||
RoomView: {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
tmid?: string;
|
||||
message?: string;
|
||||
name?: string;
|
||||
fname?: string;
|
||||
prid?: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
jumpToMessageId?: string;
|
||||
jumpToThreadId?: string;
|
||||
roomUserId?: string;
|
||||
|
@ -27,17 +27,17 @@ export type MasterDetailDrawerParamList = {
|
|||
|
||||
export type ModalStackParamList = {
|
||||
RoomActionsView: {
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
member: any;
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
joined: boolean;
|
||||
};
|
||||
RoomInfoView: {
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
member: any;
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
};
|
||||
SelectListView: {
|
||||
data: any;
|
||||
|
@ -54,11 +54,11 @@ export type ModalStackParamList = {
|
|||
};
|
||||
RoomMembersView: {
|
||||
rid: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
};
|
||||
SearchMessagesView: {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
encrypted?: boolean;
|
||||
showCloseModal?: boolean;
|
||||
};
|
||||
|
@ -84,18 +84,18 @@ export type ModalStackParamList = {
|
|||
};
|
||||
MessagesView: {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
name: string;
|
||||
};
|
||||
AutoTranslateView: {
|
||||
rid: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
};
|
||||
DirectoryView: undefined;
|
||||
QueueListView: undefined;
|
||||
NotificationPrefView: {
|
||||
rid: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
};
|
||||
ForwardLivechatView: {
|
||||
rid: string;
|
||||
|
@ -110,10 +110,10 @@ export type ModalStackParamList = {
|
|||
scopeName: string;
|
||||
tags: string[];
|
||||
};
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
};
|
||||
LivechatEditView: {
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
roomUser: any; // TODO: Change
|
||||
};
|
||||
PickerView: {
|
||||
|
@ -126,7 +126,7 @@ export type ModalStackParamList = {
|
|||
};
|
||||
ThreadMessagesView: {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
};
|
||||
TeamChannelsView: {
|
||||
teamId: string;
|
||||
|
@ -160,7 +160,7 @@ export type ModalStackParamList = {
|
|||
teamId?: string;
|
||||
};
|
||||
CreateDiscussionView: {
|
||||
channel: IRoom;
|
||||
channel: ISubscription;
|
||||
message: IMessage;
|
||||
showCloseModal: boolean;
|
||||
};
|
||||
|
@ -194,7 +194,7 @@ export type MasterDetailInsideStackParamList = {
|
|||
isShareView?: boolean;
|
||||
serverInfo: {};
|
||||
text: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
thread: any; // TODO: Change
|
||||
};
|
||||
};
|
||||
|
|
|
@ -6,28 +6,28 @@ import { IOptionsField } from '../views/NotificationPreferencesView/options';
|
|||
import { IServer } from '../definitions/IServer';
|
||||
import { IAttachment } from '../definitions/IAttachment';
|
||||
import { IMessage } from '../definitions/IMessage';
|
||||
import { IRoom, RoomType } from '../definitions/IRoom';
|
||||
import { ISubscription, SubscriptionType } from '../definitions/ISubscription';
|
||||
|
||||
export type ChatsStackParamList = {
|
||||
RoomsListView: undefined;
|
||||
RoomView: {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
tmid?: string;
|
||||
message?: string;
|
||||
name?: string;
|
||||
fname?: string;
|
||||
prid?: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
jumpToMessageId?: string;
|
||||
jumpToThreadId?: string;
|
||||
roomUserId?: string;
|
||||
};
|
||||
RoomActionsView: {
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
member: any;
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
joined: boolean;
|
||||
};
|
||||
SelectListView: {
|
||||
|
@ -41,21 +41,21 @@ export type ChatsStackParamList = {
|
|||
isRadio?: boolean;
|
||||
};
|
||||
RoomInfoView: {
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
member: any;
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
};
|
||||
RoomInfoEditView: {
|
||||
rid: string;
|
||||
};
|
||||
RoomMembersView: {
|
||||
rid: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
};
|
||||
SearchMessagesView: {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
encrypted?: boolean;
|
||||
showCloseModal?: boolean;
|
||||
};
|
||||
|
@ -74,12 +74,12 @@ export type ChatsStackParamList = {
|
|||
};
|
||||
MessagesView: {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
name: string;
|
||||
};
|
||||
AutoTranslateView: {
|
||||
rid: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
};
|
||||
DirectoryView: undefined;
|
||||
NotificationPrefView: {
|
||||
|
@ -90,7 +90,7 @@ export type ChatsStackParamList = {
|
|||
rid: string;
|
||||
};
|
||||
LivechatEditView: {
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
roomUser: any; // TODO: Change
|
||||
};
|
||||
PickerView: {
|
||||
|
@ -103,7 +103,7 @@ export type ChatsStackParamList = {
|
|||
};
|
||||
ThreadMessagesView: {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
};
|
||||
TeamChannelsView: {
|
||||
teamId: string;
|
||||
|
@ -138,7 +138,7 @@ export type ChatsStackParamList = {
|
|||
scopeName: string;
|
||||
tags: string[];
|
||||
};
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -198,7 +198,7 @@ export type NewMessageStackParamList = {
|
|||
teamId?: string;
|
||||
};
|
||||
CreateDiscussionView: {
|
||||
channel: IRoom;
|
||||
channel: ISubscription;
|
||||
message: IMessage;
|
||||
showCloseModal: boolean;
|
||||
};
|
||||
|
@ -230,7 +230,7 @@ export type InsideStackParamList = {
|
|||
isShareExtension: boolean;
|
||||
serverInfo: IServer;
|
||||
text: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
thread: any; // TODO: Change
|
||||
};
|
||||
ModalBlockView: {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors';
|
|||
import { withTheme } from '../../theme';
|
||||
import SafeAreaView from '../../containers/SafeAreaView';
|
||||
import { events, logEvent } from '../../utils/log';
|
||||
import { IRoom } from '../../definitions/IRoom';
|
||||
import { ISubscription } from '../../definitions/ISubscription';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
list: {
|
||||
|
@ -42,7 +42,7 @@ class AutoTranslateView extends React.Component<IAutoTranslateViewProps, any> {
|
|||
|
||||
if (room && room.observe) {
|
||||
this.roomObservable = room.observe();
|
||||
this.subscription = this.roomObservable.subscribe((changes: IRoom) => {
|
||||
this.subscription = this.roomObservable.subscribe((changes: ISubscription) => {
|
||||
if (this.mounted) {
|
||||
const { selectedLanguage, enableAutoTranslate } = this.state;
|
||||
if (selectedLanguage !== changes.autoTranslateLanguage) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import SafeAreaView from '../../containers/SafeAreaView';
|
|||
import getThreadName from '../../lib/methods/getThreadName';
|
||||
import styles from './styles';
|
||||
import { ChatsStackParamList } from '../../stacks/types';
|
||||
import { IRoom, RoomType } from '../../definitions/IRoom';
|
||||
import { ISubscription, SubscriptionType } from '../../definitions/ISubscription';
|
||||
|
||||
interface IMessagesViewProps {
|
||||
user: {
|
||||
|
@ -40,10 +40,10 @@ interface IMessagesViewProps {
|
|||
}
|
||||
|
||||
interface IRoomInfoParam {
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
member: any;
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
joined: boolean;
|
||||
}
|
||||
|
||||
|
@ -72,13 +72,13 @@ interface IMessageItem {
|
|||
|
||||
interface IParams {
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
tmid?: string;
|
||||
message?: string;
|
||||
name?: string;
|
||||
fname?: string;
|
||||
prid?: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
jumpToMessageId?: string;
|
||||
jumpToThreadId?: string;
|
||||
roomUserId?: string;
|
||||
|
@ -86,7 +86,7 @@ interface IParams {
|
|||
|
||||
class MessagesView extends React.Component<IMessagesViewProps, any> {
|
||||
private rid: string;
|
||||
private t: RoomType;
|
||||
private t: SubscriptionType;
|
||||
private content: any;
|
||||
private room: any;
|
||||
|
||||
|
@ -158,7 +158,7 @@ class MessagesView extends React.Component<IMessagesViewProps, any> {
|
|||
...params,
|
||||
tmid: item.tmid,
|
||||
name: await getThreadName(this.rid, item.tmid, item._id),
|
||||
t: RoomType.THREAD
|
||||
t: SubscriptionType.THREAD
|
||||
};
|
||||
navigation.push('RoomView', params);
|
||||
} else {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { Q } from '@nozbe/watermelondb';
|
|||
import { connect } from 'react-redux';
|
||||
import { dequal } from 'dequal';
|
||||
|
||||
import { IRoom, RoomType } from '../../definitions/IRoom';
|
||||
import { ISubscription, SubscriptionType } from '../../definitions/ISubscription';
|
||||
import { IAttachment } from '../../definitions/IAttachment';
|
||||
import RCTextInput from '../../containers/TextInput';
|
||||
import ActivityIndicator from '../../containers/ActivityIndicator';
|
||||
|
@ -42,10 +42,10 @@ interface ISearchMessagesViewState {
|
|||
}
|
||||
|
||||
interface IRoomInfoParam {
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
member: any;
|
||||
rid: string;
|
||||
t: RoomType;
|
||||
t: SubscriptionType;
|
||||
joined: boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import Preview from './Preview';
|
|||
import Header from './Header';
|
||||
import styles from './styles';
|
||||
import { IAttachment } from './interfaces';
|
||||
import { IRoom } from '../../definitions/IRoom';
|
||||
import { ISubscription } from '../../definitions/ISubscription';
|
||||
|
||||
interface IShareViewState {
|
||||
selected: IAttachment;
|
||||
|
@ -36,7 +36,7 @@ interface IShareViewState {
|
|||
readOnly: boolean;
|
||||
attachments: IAttachment[];
|
||||
text: string;
|
||||
room: IRoom;
|
||||
room: ISubscription;
|
||||
thread: any; // change
|
||||
maxFileSize: number;
|
||||
mediaAllowList: number;
|
||||
|
|
Loading…
Reference in New Issue