Handle new notifications differently within desktop client

merge-requests/30/head
Bob Mottram 2021-03-16 13:30:09 +00:00
parent 2716fefd0b
commit ecd6af3ce3
1 changed files with 7 additions and 3 deletions

View File

@ -782,6 +782,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
currDMIndex = 0 currDMIndex = 0
currRepliesIndex = 0 currRepliesIndex = 0
currSentIndex = 0 currSentIndex = 0
newRepliesExist = False
while (1): while (1):
session = createSession(proxyType) session = createSession(proxyType)
notifyJson = None notifyJson = None
@ -811,8 +812,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
'New direct message ' + 'New direct message ' +
actor + '/dm') actor + '/dm')
prevDM = speakerJson['notify']['dm'] prevDM = speakerJson['notify']['dm']
elif speakerJson['notify']['reply'] != prevReply: elif newRepliesExist != prevReply:
if speakerJson['notify']['reply'] is True: if newRepliesExist:
if notificationSounds: if notificationSounds:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
replySoundFilename, replySoundFilename,
@ -820,7 +821,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
_desktopNotification(notificationType, title, _desktopNotification(notificationType, title,
'New reply ' + 'New reply ' +
actor + '/tlreplies') actor + '/tlreplies')
prevReply = speakerJson['notify']['reply'] prevReply = newRepliesExist
elif speakerJson['notify']['calendar'] != prevCalendar: elif speakerJson['notify']['calendar'] != prevCalendar:
if speakerJson['notify']['calendar'] is True: if speakerJson['notify']['calendar'] is True:
if notificationSounds: if notificationSounds:
@ -907,6 +908,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
if encryptedMessage or speakerJson.get('direct'): if encryptedMessage or speakerJson.get('direct'):
_storeMessage(speakerJson, 'dm') _storeMessage(speakerJson, 'dm')
elif speakerJson.get('replyToYou'): elif speakerJson.get('replyToYou'):
newRepliesExist = True
_storeMessage(speakerJson, 'replies') _storeMessage(speakerJson, 'replies')
else: else:
if storeInboxPosts: if storeInboxPosts:
@ -949,6 +951,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
screenreader, systemLanguage, espeak, screenreader, systemLanguage, espeak,
currRepliesIndex, 10) currRepliesIndex, 10)
currTimeline = 'replies' currTimeline = 'replies'
# Turn off the replies indicator
newRepliesExist = False
elif keyPress.startswith('show sen'): elif keyPress.startswith('show sen'):
currSentIndex = 0 currSentIndex = 0
_showLocalBox(notifyJson, 'sent', _showLocalBox(notifyJson, 'sent',