Play sound and vibrate; group by topic (omg Android, why can't you do that so easily!!!)

This commit is contained in:
Philipp Heckel 2022-05-23 20:39:22 -04:00
parent 9060af51ef
commit cace472391
3 changed files with 8 additions and 5 deletions

View file

@ -30,8 +30,8 @@
filePath = "ntfyNSE/NotificationService.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "34"
endingLineNumber = "34"
startingLineNumber = "38"
endingLineNumber = "38"
landmarkName = "didReceive(_:withContentHandler:)"
landmarkType = "7">
</BreakpointContent>
@ -78,8 +78,8 @@
filePath = "ntfyNSE/NotificationService.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "33"
endingLineNumber = "33"
startingLineNumber = "37"
endingLineNumber = "37"
landmarkName = "didReceive(_:withContentHandler:)"
landmarkType = "7">
</BreakpointContent>

View file

@ -5,7 +5,6 @@ import Firebase
// TODO: Verify whether model version needs to be specified
// TODO: Disallow adding same topic twice!!
// TODO: When clicked, the notification does not open the topic, but instead just shows the last view
// TODO: The notification does not make a sound or vibrate on the Apple Watch
// TODO: When opening a topic, the notifications in the Apple notification center should be dismissed automatically
// TODO: Errors are not shown to the user, but instead just logged

View file

@ -30,6 +30,10 @@ class NotificationService: UNNotificationServiceExtension {
}
}
// Play a sound, and group by topic
bestAttemptContent.sound = .default
bestAttemptContent.threadIdentifier = userInfo["topic"] as? String ?? ""
// Save notification to store, and display it
Store.shared.save(notificationFromUserInfo: userInfo)
contentHandler(bestAttemptContent)