Universal Disappearing Messages

This commit is contained in:
Fedor Indutny 2021-06-01 13:45:43 -07:00 committed by GitHub
parent c63871d71b
commit 19f8042cd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 1224 additions and 191 deletions

View file

@ -129,6 +129,10 @@ type MessageBubbleProps =
type: 'profileChange';
data: ProfileChangeNotificationPropsType;
}
| {
type: 'universalTimerNotification';
data: null;
}
| {
type: 'chatSessionRefreshed';
data: null;
@ -333,6 +337,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
!this.isKeyChange() &&
!this.isMessageHistoryUnsynced() &&
!this.isProfileChange() &&
!this.isUniversalTimerNotification() &&
!this.isUnsupportedMessage() &&
!this.isVerifiedChange()
);
@ -406,6 +411,12 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
data: this.getPropsForProfileChange(),
};
}
if (this.isUniversalTimerNotification()) {
return {
type: 'universalTimerNotification',
data: null,
};
}
if (this.isChatSessionRefreshed()) {
return {
type: 'chatSessionRefreshed',
@ -600,6 +611,10 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
return this.get('type') === 'profile-change';
}
isUniversalTimerNotification(): boolean {
return this.get('type') === 'universal-timer-notification';
}
// Props for each message type
getPropsForUnsupportedMessage(): PropsForUnsupportedMessage {
const requiredVersion = this.get('requiredProtocolVersion');
@ -1941,6 +1956,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
const isKeyChange = this.isKeyChange();
const isMessageHistoryUnsynced = this.isMessageHistoryUnsynced();
const isProfileChange = this.isProfileChange();
const isUniversalTimerNotification = this.isUniversalTimerNotification();
// Note: not all of these message types go through message.handleDataMessage
@ -1967,7 +1983,8 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
// Locally-generated notifications
isKeyChange ||
isMessageHistoryUnsynced ||
isProfileChange;
isProfileChange ||
isUniversalTimerNotification;
return !hasSomethingToDisplay;
}