Merge branch 'develop' into chore.migrate-redux-server-to-ts
This commit is contained in:
commit
06ba2d172b
|
@ -9,4 +9,5 @@ export interface INotification {
|
||||||
from: string;
|
from: string;
|
||||||
image: string;
|
image: string;
|
||||||
soundname: string;
|
soundname: string;
|
||||||
|
getData: () => INotification;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,10 @@ interface IEjson {
|
||||||
messageId: string;
|
messageId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const onNotification = (notification: INotification): void => {
|
export const onNotification = (push: INotification): void => {
|
||||||
if (notification) {
|
if (push) {
|
||||||
try {
|
try {
|
||||||
|
const notification = push?.getData();
|
||||||
const { rid, name, sender, type, host, messageType, messageId }: IEjson = EJSON.parse(notification.ejson);
|
const { rid, name, sender, type, host, messageType, messageId }: IEjson = EJSON.parse(notification.ejson);
|
||||||
|
|
||||||
const types: Record<string, string> = {
|
const types: Record<string, string> = {
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PushNotification {
|
||||||
// TODO REDUX MIGRATION TO TS
|
// TODO REDUX MIGRATION TO TS
|
||||||
const { background } = reduxStore.getState().app;
|
const { background } = reduxStore.getState().app;
|
||||||
if (background) {
|
if (background) {
|
||||||
this.onNotification(notification?.getData());
|
this.onNotification(notification);
|
||||||
}
|
}
|
||||||
completion();
|
completion();
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ class PushNotification {
|
||||||
});
|
});
|
||||||
|
|
||||||
NotificationsAndroid.setNotificationOpenedListener((notification: Notification) => {
|
NotificationsAndroid.setNotificationOpenedListener((notification: Notification) => {
|
||||||
this.onNotification(notification?.getData());
|
this.onNotification(notification);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,6 @@ export const getBadgeColor = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
export const makeThreadName = (messageRecord: { id?: string; msg?: string; attachments?: IAttachment[] }): string | undefined =>
|
export const makeThreadName = (messageRecord: { id?: string; msg?: string; attachments?: IAttachment[] }): string | undefined =>
|
||||||
messageRecord.msg || messageRecord.attachments![0].title;
|
messageRecord.msg || messageRecord?.attachments?.[0]?.title;
|
||||||
|
|
||||||
export const isTeamRoom = ({ teamId, joined }: { teamId: string; joined: boolean }): boolean => !!teamId && joined;
|
export const isTeamRoom = ({ teamId, joined }: { teamId: string; joined: boolean }): boolean => !!teamId && joined;
|
||||||
|
|
|
@ -284,7 +284,7 @@ class ThreadMessagesView extends React.Component<IThreadMessagesViewProps, IThre
|
||||||
if (update && update.length) {
|
if (update && update.length) {
|
||||||
update = update.map(m => buildMessage(m));
|
update = update.map(m => buildMessage(m));
|
||||||
// filter threads
|
// filter threads
|
||||||
threadsToCreate = update.filter(i1 => allThreadsRecords.find((i2: { id: string }) => i1._id === i2.id));
|
threadsToCreate = update.filter(i1 => !allThreadsRecords.find((i2: { id: string }) => i1._id === i2.id));
|
||||||
threadsToUpdate = allThreadsRecords.filter((i1: { id: string }) => update.find(i2 => i1.id === i2._id));
|
threadsToUpdate = allThreadsRecords.filter((i1: { id: string }) => update.find(i2 => i1.id === i2._id));
|
||||||
threadsToCreate = threadsToCreate.map(thread =>
|
threadsToCreate = threadsToCreate.map(thread =>
|
||||||
threadsCollection.prepareCreate(
|
threadsCollection.prepareCreate(
|
||||||
|
|
Loading…
Reference in New Issue