diff --git a/PAWS/Supporting Files/Info.plist b/PAWS/Supporting Files/Info.plist
index 635116c1..24f5161d 100644
--- a/PAWS/Supporting Files/Info.plist
+++ b/PAWS/Supporting Files/Info.plist
@@ -17,9 +17,5 @@
UISceneConfigurations
- UIBackgroundModes
-
- remote-notification
-
diff --git a/PAWS/Supporting Files/PAWS.entitlements b/PAWS/Supporting Files/PAWS.entitlements
index b8c93505..dab226cc 100644
--- a/PAWS/Supporting Files/PAWS.entitlements
+++ b/PAWS/Supporting Files/PAWS.entitlements
@@ -2,8 +2,6 @@
- aps-environment
- development
com.apple.developer.healthkit
com.apple.developer.healthkit.access
diff --git a/PAWSModules/Sources/PAWSOnboardingFlow/NotificationSetup.swift b/PAWSModules/Sources/PAWSOnboardingFlow/NotificationSetup.swift
index f3975476..9d159402 100644
--- a/PAWSModules/Sources/PAWSOnboardingFlow/NotificationSetup.swift
+++ b/PAWSModules/Sources/PAWSOnboardingFlow/NotificationSetup.swift
@@ -55,42 +55,38 @@ struct NotificationSetup: View {
func notificationTrigger() {
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
-
- if let error = error {
- // Handle the error here.
- }
-
- // Enable or disable features based on the authorization.
- }
-
- let content = UNMutableNotificationContent()
- content.title = "Friendly reminder to record your ECG!"
- content.body = "Thank you for participating in the PAWS study!"
-
- // Configure the recurring date.
-
- let dateComponents = Calendar.current.dateComponents([.hour, .minute], from: selectedTime)
-
- for index in 0...6 {
- let scheduleDate = Date.now.addingTimeInterval(86400 * Double(index))
- guard let notificationDate = Calendar.current.nextDate(after: scheduleDate, matching: dateComponents, matchingPolicy: .nextTime) else {
- return
- }
-
- let trigger = UNTimeIntervalNotificationTrigger(timeInterval: notificationDate.timeIntervalSince(.now), repeats: false)
-
-
- // Create the request
- let uuidString = UUID().uuidString
- let request = UNNotificationRequest(identifier: uuidString,
- content: content, trigger: trigger)
-
- // Schedule the request with the system.
- let notificationCenter = UNUserNotificationCenter.current()
- notificationCenter.add(request) { (error) in
- if error != nil {
- // Handle any errors.
- }
+ if let error {
+ print("Error scheduling notification: \(error)")
+ } else {
+ let content = UNMutableNotificationContent()
+ content.title = "Friendly reminder to record your ECG!"
+ content.body = "Thank you for participating in the PAWS study!"
+
+ // Configure the recurring date.
+
+ let dateComponents = Calendar.current.dateComponents([.hour, .minute], from: selectedTime)
+
+ for index in 0...6 {
+ let scheduleDate = Date.now.addingTimeInterval(86400 * Double(index))
+ guard let notificationDate = Calendar.current.nextDate(after: scheduleDate, matching: dateComponents, matchingPolicy: .nextTime) else {
+ continue
+ }
+
+ let trigger = UNTimeIntervalNotificationTrigger(timeInterval: notificationDate.timeIntervalSince(.now), repeats: false)
+
+
+ // Create the request
+ let uuidString = UUID().uuidString
+ let request = UNNotificationRequest(identifier: uuidString, content: content, trigger: trigger)
+
+ // Schedule the request with the system.
+ let notificationCenter = UNUserNotificationCenter.current()
+ notificationCenter.add(request) { (error) in
+ if error != nil {
+ // Handle any errors.
+ }
+ }
+ }
}
}
}