Parcourir la source

Squash some deprecated warnings

polscm32 aka Marvout il y a 1 an
Parent
commit
c71c2e150c

+ 2 - 2
FreeAPS/Sources/APS/APSManager.swift

@@ -207,7 +207,7 @@ final class BaseAPSManager: APSManager, Injectable {
             backGroundTaskID = await UIApplication.shared.beginBackgroundTask(withName: "Loop starting") {
                 guard let backgroundTask = self.backGroundTaskID else { return }
                 Task {
-                    await UIApplication.shared.endBackgroundTask(backgroundTask)
+                    UIApplication.shared.endBackgroundTask(backgroundTask)
                 }
                 self.backGroundTaskID = .invalid
             }
@@ -391,7 +391,7 @@ final class BaseAPSManager: APSManager, Injectable {
             let now = Date()
 
             // Start fetching asynchronously
-            let (currentTemp, profiles, autosense, dailyAutotune) = try await (
+            let (currentTemp, _, _, _) = try await (
                 fetchCurrentTempBasal(date: now),
                 makeProfiles(),
                 autosense(),

+ 1 - 19
FreeAPS/Sources/Application/FreeAPSApp.swift

@@ -62,12 +62,9 @@ import Swinject
     init() {
         debug(
             .default,
-            "Trio Started: v\(Bundle.main.releaseVersionNumber ?? "")(\(Bundle.main.buildVersionNumber ?? "")) [buildDate: \(BuildDetails.default.buildDate())] [buildExpires: \(BuildDetails.default.calculateExpirationDate())]"
+            "Trio Started: v\(Bundle.main.releaseVersionNumber ?? "")(\(Bundle.main.buildVersionNumber ?? "")) [buildDate: \(String(describing: BuildDetails.default.buildDate()))] [buildExpires: \(String(describing: BuildDetails.default.calculateExpirationDate()))]"
         )
 
-        // Configure global appearance for UITabBar
-//        configureTabBarAppearance()
-
         // Load services
         loadServices()
 
@@ -75,21 +72,6 @@ import Swinject
         cleanupOldData()
     }
 
-    // Function to configure global tab bar appearance
-    private func configureTabBarAppearance() {
-        let appearance = UITabBarAppearance()
-        appearance.configureWithDefaultBackground()
-
-        // Blur the background
-        appearance.backgroundEffect = UIBlurEffect(style: .systemChromeMaterial)
-
-        // Keep background semi-transparent
-        appearance.backgroundColor = UIColor.clear
-
-        UITabBar.appearance().standardAppearance = appearance
-        UITabBar.appearance().scrollEdgeAppearance = appearance
-    }
-
     var body: some Scene {
         WindowGroup {
             Main.RootView(resolver: resolver)

+ 1 - 1
FreeAPS/Sources/Helpers/ProgressBar.swift

@@ -17,7 +17,7 @@ struct ProgressBar: View {
                         height: geometry.size.height
                     )
                     .foregroundColor(.accentColor)
-                    .animation(.linear)
+                    .animation(.linear, value: value)
             }
         }
         .frame(height: 20)

+ 1 - 4
FreeAPS/Sources/Modules/Adjustments/View/TempTargets/EditTempTargetForm.swift

@@ -37,10 +37,7 @@ struct EditTempTargetForm: View {
         _isPreset = State(initialValue: tempTargetToEdit.isPreset)
         _isEnabled = State(initialValue: tempTargetToEdit.enabled)
 
-        var tempTargetHalfBasal: Decimal = state.settingHalfBasalTarget
-        if tempTargetToEdit.halfBasalTarget != nil {
-            tempTargetHalfBasal = tempTargetToEdit.halfBasalTarget as! Decimal
-        }
+        let tempTargetHalfBasal: Decimal = (tempTargetToEdit.halfBasalTarget?.decimalValue) ?? state.settingHalfBasalTarget
 
         let H = tempTargetHalfBasal
         let T = tempTargetToEdit.target?.decimalValue ?? 100

+ 2 - 2
FreeAPS/Sources/Modules/CGM/View/CGMRootView.swift

@@ -231,10 +231,10 @@ extension CGM {
                         )
                     }
                 }
-                .onChange(of: setupCGM) { setupCGM in
+                .onChange(of: setupCGM) { _, setupCGM in
                     state.setupCGM = setupCGM
                 }
-                .onChange(of: state.setupCGM) { setupCGM in
+                .onChange(of: state.setupCGM) { _, setupCGM in
                     self.setupCGM = setupCGM
                 }
                 .screenNavigation(self)

+ 0 - 1
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -848,7 +848,6 @@ extension Home {
                     highlightButtons()
                 }
                 appState.configureTabBarAppearance()
-//                AppState.configureTabBarAppearance()
             }
             .navigationTitle("Home")
             .navigationBarHidden(true)

+ 1 - 1
FreeAPS/Sources/Modules/Stat/View/StatRootView.swift

@@ -124,7 +124,7 @@ extension Stat {
                     ForEach(Stat.StateModel.Duration.allCases) { duration in
                         Text(NSLocalizedString(duration.rawValue, comment: "")).tag(Optional(duration))
                     }
-                }.onChange(of: state.selectedDuration) { newValue in
+                }.onChange(of: state.selectedDuration) { _, newValue in
                     state.setupGlucoseArray(for: newValue)
                 }
                 .pickerStyle(.segmented).background(.cyan.opacity(0.2))

+ 1 - 1
FreeAPS/Sources/Services/Network/Nightscout/NightscoutAPI.swift

@@ -426,7 +426,7 @@ extension NightscoutAPI {
 
         request.httpMethod = "POST"
 
-        let (data, response) = try await URLSession.shared.data(for: request)
+        let (_, response) = try await URLSession.shared.data(for: request)
 
         guard let httpResponse = response as? HTTPURLResponse, (200 ... 299).contains(httpResponse.statusCode) else {
             throw URLError(.badServerResponse)

+ 19 - 7
FreeAPS/Sources/Shortcuts/AppShortcuts.swift

@@ -1,49 +1,61 @@
 import AppIntents
 import Foundation
 
-@available(iOS 16.0, *) struct AppShortcuts: AppShortcutsProvider {
+struct AppShortcuts: AppShortcutsProvider {
     @AppShortcutsBuilder static var appShortcuts: [AppShortcut] {
         AppShortcut(
             intent: BolusIntent(),
             phrases: [
                 "\(.applicationName) bolus",
                 "Enacts a \(.applicationName) Bolus"
-            ]
+            ],
+            shortTitle: "Bolus",
+            systemImageName: "drop.fill"
         )
         AppShortcut(
             intent: ApplyTempPresetIntent(),
             phrases: [
                 "Activate \(.applicationName) temporary target ?",
                 "\(.applicationName) apply a temporary target"
-            ]
+            ],
+            shortTitle: "Temporary Target",
+            systemImageName: "target"
         )
         AppShortcut(
             intent: ListStateIntent(),
             phrases: [
                 "List \(.applicationName) state",
                 "\(.applicationName) state"
-            ]
+            ],
+            shortTitle: "List State",
+            systemImageName: "list.bullet"
         )
         AppShortcut(
             intent: AddCarbPresetIntent(),
             phrases: [
                 "Add carbs in \(.applicationName)",
                 "\(.applicationName) allows to add carbs"
-            ]
+            ],
+            shortTitle: "Add Carbs",
+            systemImageName: "fork.knife"
         )
         AppShortcut(
             intent: ApplyOverridePresetIntent(),
             phrases: [
                 "Activate \(.applicationName) override",
                 "Activates an available \(.applicationName) override"
-            ]
+            ],
+            shortTitle: "Activate Override",
+            systemImageName: "clock.arrow.2.circlepath"
         )
         AppShortcut(
             intent: CancelOverrideIntent(),
             phrases: [
                 "Cancel \(.applicationName) override",
                 "Cancels an active \(.applicationName) override"
-            ]
+            ],
+            shortTitle: "Cancel Override",
+            systemImageName: "xmark.circle.fill"
         )
     }
 }

+ 1 - 4
FreeAPS/Sources/Shortcuts/Carbs/AddCarbPresetIntent.swift

@@ -10,10 +10,7 @@ import Swinject
     // Description of the action in the Shortcuts app
     static var description = IntentDescription("Allow to add carbs in Trio.")
 
-    internal var carbRequest: CarbPresetIntentRequest
-
     init() {
-        carbRequest = CarbPresetIntentRequest()
         dateAdded = Date()
     }
 
@@ -89,7 +86,7 @@ import Swinject
                 )
             }
 
-            let finalQuantityCarbsDisplay = try await carbRequest.addCarbs(
+            let finalQuantityCarbsDisplay = try await CarbPresetIntentRequest().addCarbs(
                 quantityCarbs,
                 fatQuantity,
                 proteinQuantity,

+ 1 - 7
FreeAPS/Sources/Shortcuts/Override/CancelOverrideIntent.swift

@@ -8,15 +8,9 @@ struct CancelOverrideIntent: AppIntent {
     // Description of the action in the Shortcuts app
     static var description = IntentDescription(.init("Cancel an active override", table: "ShortcutsDetail"))
 
-    internal var intentRequest: OverridePresetsIntentRequest
-
-    init() {
-        intentRequest = OverridePresetsIntentRequest()
-    }
-
     @MainActor func perform() async throws -> some ProvidesDialog {
         do {
-            await intentRequest.cancelOverride()
+            await OverridePresetsIntentRequest().cancelOverride()
             return .result(
                 dialog: IntentDialog(LocalizedStringResource("Override canceled", table: "ShortcutsDetail"))
             )