Fix merge issue and check iOS availibility for notification priority

This commit is contained in:
Callum Yarnold 2022-05-25 18:19:03 +01:00
parent b0e0c8fc83
commit 0fde846aa1
No known key found for this signature in database
GPG key ID: 1B309601199B0473
2 changed files with 18 additions and 22 deletions

View file

@ -150,15 +150,9 @@ struct NotificationListView: View {
.padding(40)
}
})
<<<<<<< HEAD
=======
.refreshable {
subscriptionManager.poll(subscription)
}
.onAppear {
cancelSubscriptionNotifications()
}
>>>>>>> 6d40c441f96e3a6c7331e3883bdf5df999ce8d66
}
private var editButton: some View {

View file

@ -48,22 +48,24 @@ class NotificationService: UNNotificationServiceExtension {
bestAttemptContent.threadIdentifier = topic
// Map priorities to interruption level (light up screen, ...) and relevance (order)
switch priority {
case "1":
bestAttemptContent.interruptionLevel = .passive
bestAttemptContent.relevanceScore = 0
case "2":
bestAttemptContent.interruptionLevel = .passive
bestAttemptContent.relevanceScore = 0.25
case "4":
bestAttemptContent.interruptionLevel = .timeSensitive
bestAttemptContent.relevanceScore = 0.75
case "5":
bestAttemptContent.interruptionLevel = .critical
bestAttemptContent.relevanceScore = 1
default:
bestAttemptContent.interruptionLevel = .active
bestAttemptContent.relevanceScore = 0.5
if #available(iOS 15.0, *) {
switch priority {
case "1":
bestAttemptContent.interruptionLevel = .passive
bestAttemptContent.relevanceScore = 0
case "2":
bestAttemptContent.interruptionLevel = .passive
bestAttemptContent.relevanceScore = 0.25
case "4":
bestAttemptContent.interruptionLevel = .timeSensitive
bestAttemptContent.relevanceScore = 0.75
case "5":
bestAttemptContent.interruptionLevel = .critical
bestAttemptContent.relevanceScore = 1
default:
bestAttemptContent.interruptionLevel = .active
bestAttemptContent.relevanceScore = 0.5
}
}
// Save notification to store, and display it