Proper VPN simulator with notifications, etc.
This commit is contained in:
28
main/Push Notifications/PushNotificationAppOnly.swift
Normal file
28
main/Push Notifications/PushNotificationAppOnly.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
import UserNotifications
|
||||
|
||||
extension PushNotification {
|
||||
static func scheduleRecordingReminder(force: Bool) {
|
||||
if force {
|
||||
scheduleRecordingReminder()
|
||||
} else {
|
||||
hasPending(.YouShallRecordMoreReminder) {
|
||||
if !$0 { scheduleRecordingReminder() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static func scheduleRecordingReminder() {
|
||||
guard #available(iOS 10, *) else { return }
|
||||
|
||||
let now = Timestamp.now()
|
||||
var next = RecordingsDB.lastTimestamp() ?? (now - 1)
|
||||
while next < now {
|
||||
next += .days(14)
|
||||
}
|
||||
schedule(.YouShallRecordMoreReminder,
|
||||
content: .make("Start new recording",
|
||||
body: "It's been a while since your last recording …",
|
||||
sound: .from(string: Prefs.RecordingReminder.Sound)),
|
||||
trigger: .make(Date(next)))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user