Skip to content

Commit

Permalink
Only print notifications for new messages in boards you subscrive to
Browse files Browse the repository at this point in the history
  • Loading branch information
f-r00t committed Sep 5, 2022
1 parent e960ecb commit 898ecce
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/HuginUtilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,18 @@ export async function cacheSync(silent=true, latest_board_message_timestamp=0, f

saveBoardsMessage(message, address, signature, board, timestamp, nickname, reply, hash, sent, silent);

if (nickname == 'null') {
if (!nickname) {
nickname = 'Anonymous';
}

if (latest_board_message_timestamp != 0 && !fromMyself) {



const subscriptionList = Globals.boardsSubscriptions.filter(sub => {
return sub.board == board;
})

if (latest_board_message_timestamp != 0 && !fromMyself && subscriptionList.length > 0 ) {
PushNotification.localNotification({
title: nickname + ' in ' + board,//'Incoming transaction received!',
//message: `You were sent ${prettyPrintAmount(transaction.totalAmount(), Config)}`,
Expand Down Expand Up @@ -719,7 +726,14 @@ async function getBoardsMessage(json) {
}

saveBoardsMessage(message, from, signature, board, timestamp, nickname, reply, hash, sent, silent);
if (from != Globals.wallet.getPrimaryAddress()) {


const subscriptionList = Globals.boardsSubscriptions.filter(sub => {
return sub.board == board;
})


if (from != Globals.wallet.getPrimaryAddress() && subscriptionList.length > 0) {
PushNotification.localNotification({
title: nickname + ' in ' + board,//'Incoming transaction received!',
//message: `You were sent ${prettyPrintAmount(transaction.totalAmount(), Config)}`,
Expand Down

0 comments on commit 898ecce

Please sign in to comment.