Ver código fonte

Restore Rermote Settings

Jonas Björkert 1 ano atrás
pai
commit
82b381b8c7

+ 1 - 7
LoopFollow/Alarm/Alarm.swift

@@ -197,16 +197,10 @@ struct Alarm: Identifiable, Codable, Equatable {
         let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
         UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
 
-        let action = UNNotificationAction(identifier: "snooze", title: "Snooze", options: [])
+        let action = UNNotificationAction(identifier: "snooze", title: snoozeDuration == 0 ? "Acknowledge" : "Snooze", options: [])
         let category = UNNotificationCategory(identifier: "category", actions: [action], intentIdentifiers: [], options: [])
         UNUserNotificationCenter.current().setNotificationCategories([category])
 
-        /* TODO: när vi gör bg alarm sätt timestamp/datum för denna readings tid så vi inte larmar på samma igen, se isBGBased
-             if snooozedBGReadingTime != nil {
-                 UserDefaultsRepository.snoozedBGReadingTime.value = snooozedBGReadingTime
-             }
-         */
-
         if playSound {
             AlarmSound.setSoundFile(str: soundFile.rawValue)
             AlarmSound.play(repeating: shouldRepeat)

+ 3 - 11
LoopFollow/Remote/Settings/RemoteSettingsView.swift

@@ -7,7 +7,6 @@ import SwiftUI
 
 struct RemoteSettingsView: View {
     @ObservedObject var viewModel: RemoteSettingsViewModel
-    @Environment(\.presentationMode) var presentationMode
 
     @State private var showAlert: Bool = false
     @State private var alertType: AlertType? = nil
@@ -58,7 +57,7 @@ struct RemoteSettingsView: View {
                     Section(header: Text("Trio Remote Control Settings")) {
                         HStack {
                             Text("Shared Secret")
-                            TextField("Enter Shared Secret", text: $viewModel.sharedSecret)
+                            SecureField("Enter Shared Secret", text: $viewModel.sharedSecret)
                                 .autocapitalization(.none)
                                 .disableAutocorrection(true)
                                 .multilineTextAlignment(.trailing)
@@ -66,7 +65,7 @@ struct RemoteSettingsView: View {
 
                         HStack {
                             Text("APNS Key ID")
-                            TextField("Enter APNS Key ID", text: $viewModel.keyId)
+                            SecureField("Enter APNS Key ID", text: $viewModel.keyId)
                                 .autocapitalization(.none)
                                 .disableAutocorrection(true)
                                 .multilineTextAlignment(.trailing)
@@ -185,14 +184,6 @@ struct RemoteSettingsView: View {
                     }
                 }
             }
-            .navigationBarTitle("Remote Settings", displayMode: .inline)
-            .toolbar {
-                ToolbarItem(placement: .navigationBarTrailing) {
-                    Button("Done") {
-                        presentationMode.wrappedValue.dismiss()
-                    }
-                }
-            }
             .alert(isPresented: $showAlert) {
                 switch alertType {
                 case .validation:
@@ -207,6 +198,7 @@ struct RemoteSettingsView: View {
             }
         }
         .preferredColorScheme(Storage.shared.forceDarkMode.value ? .dark : nil)
+        .navigationBarTitle("Remote Settings", displayMode: .inline)
     }
 
     // MARK: - Custom Row for Remote Type Selection

+ 6 - 0
LoopFollow/Settings/SettingsMenuView.swift

@@ -51,6 +51,12 @@ struct SettingsMenuView: View {
                         {
                             path.append(Sheet.infoDisplay)
                         }
+
+                        NavigationRow(title: "Remote Settings",
+                                      icon: "antenna.radiowaves.left.and.right")
+                        {
+                            path.append(Sheet.remote)
+                        }
                     }
                 }