notifications: initial setup
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -182,6 +182,7 @@ struct ContentView: View {
|
||||
}
|
||||
.onAppear() {
|
||||
self.connect()
|
||||
setup_notifications()
|
||||
}
|
||||
.sheet(item: $active_sheet) { item in
|
||||
switch item {
|
||||
@@ -479,3 +480,20 @@ func update_filters_with_since(last_of_kind: [Int: NostrEvent], filters: [NostrF
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
func setup_notifications() {
|
||||
|
||||
UIApplication.shared.registerForRemoteNotifications()
|
||||
let center = UNUserNotificationCenter.current()
|
||||
|
||||
center.getNotificationSettings { settings in
|
||||
guard settings.authorizationStatus == .authorized else {
|
||||
center.requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
damus/damus.entitlements
Normal file
8
damus/damus.entitlements
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user