diff --git a/app/definitions/IMention.ts b/app/definitions/IMention.ts new file mode 100644 index 000000000..81305e7e2 --- /dev/null +++ b/app/definitions/IMention.ts @@ -0,0 +1,6 @@ +export interface IMention { + _id: string; + name: string; + username: string; + type: string; +} diff --git a/app/definitions/IReaction.ts b/app/definitions/IReaction.ts new file mode 100644 index 000000000..a28f5d06e --- /dev/null +++ b/app/definitions/IReaction.ts @@ -0,0 +1,5 @@ +export interface IReaction { + _id: string; + emoji: string; + usernames: string[]; +} diff --git a/app/definitions/IThread.ts b/app/definitions/IThread.ts new file mode 100644 index 000000000..9ff19de07 --- /dev/null +++ b/app/definitions/IThread.ts @@ -0,0 +1,45 @@ +import Model from '@nozbe/watermelondb/Model'; + +import { IAttachment } from './IAttachment'; +import { IMention } from './IMention'; +import { IReaction } from './IReaction'; +import { RoomType } from './IRoom'; +import { IUrl } from './IUrl'; + +export interface IThread { + id: string; + msg: string; + t: RoomType; + rid: string; + _updated_at: Date; + ts: Date; + u: { _id: string; username: string; name: string }; + alias: any; + parse_urls: any; + groupable: boolean; + avatar: string; + emoji: any; + attachments: IAttachment[]; + urls: IUrl[]; + status: number; + pinned: null; + starred: null; + edited_by: { username: string }; + reactions: IReaction[]; + role: null; + drid: null; + dcount: null; + dlm: null; + tmid: string; + tcount: 2; + tlm: Date; + replies: string[]; + mentions: IMention[]; + channels: []; + unread: boolean; + auto_translate: boolean; + translations: any; + e2e: any; +} + +export type TThreadModel = IThread & Model; diff --git a/app/definitions/IUrl.ts b/app/definitions/IUrl.ts new file mode 100644 index 000000000..9b72fda26 --- /dev/null +++ b/app/definitions/IUrl.ts @@ -0,0 +1,6 @@ +export interface IUrl { + title: string; + description: string; + image: string; + url: string; +} diff --git a/app/views/RoomView/List/index.tsx b/app/views/RoomView/List/index.tsx index 698b8d539..687289dfe 100644 --- a/app/views/RoomView/List/index.tsx +++ b/app/views/RoomView/List/index.tsx @@ -21,6 +21,7 @@ import List from './List'; import NavBottomFAB from './NavBottomFAB'; import { ChatsStackParamList } from '../../../stacks/types'; import { IRoomItem } from '../index'; +import { IThread } from '../../../definitions/IThread'; const QUERY_SIZE = 50; @@ -61,7 +62,7 @@ class ListContainer extends React.Component { private unsubscribeFocus: any; private viewabilityConfig: { itemVisiblePercentThreshold: number }; private highlightedMessageTimeout: any; - private thread: any; + private thread?: IThread; private messagesObservable?: Observable; private messagesSubscription?: Subscription; private viewableItems: any;