Added notification when receiving a friend request and when a friend request was accepted.

pull/41/head
Mikunj 6 years ago
parent 5a428af873
commit dfae580ffa

@ -487,6 +487,20 @@
}
await this.updatePendingFriendRequests();
this.getNotificationIcon().then(iconUrl => {
window.log.info('Add notification for friend request updated', {
conversationId: this.idForLogging(),
});
Whisper.Notifications.add({
conversationId: this.id,
iconUrl,
isExpiringMessage: false,
message: `Accepted your friend request`,
messageSentAt: Date.now(),
title: this.getTitle(),
});
});
},
async onFriendRequestTimedOut() {
this.updateTextInputState();
@ -755,14 +769,14 @@
const id = await window.Signal.Data.saveMessage(message, {
Message: Whisper.Message,
});
const whisperMessage = new Whisper.Message({
...message,
id,
});
this.trigger(
'newmessage',
new Whisper.Message({
...message,
id,
})
);
this.trigger('newmessage', whisperMessage);
this.notify(whisperMessage);
},
async addVerifiedChange(verifiedChangeId, verified, providedOptions) {
const options = providedOptions || {};
@ -2027,7 +2041,7 @@
},
notify(message) {
if (!message.isIncoming()) {
if (!(message.isIncoming() || message.isFriendRequest())) {
return Promise.resolve();
}
const conversationId = this.id;

@ -192,6 +192,7 @@
getNotificationText() {
const description = this.getDescription();
if (description) {
if (this.isFriendRequest()) return `Friend Request: ${description}`;
return description;
}
if (this.get('attachments').length > 0) {

Loading…
Cancel
Save