Преглед изворни кода

Use Swift Oref by default

This change updates the oref swift setting to be an oref javascript
setting instead, effectively defaulting all users into the Swift
implementation.

By defaulting people into the Swift implementation we will get a
chance to find any lingering issues with the implementation before
removing the Javascript code from the codebase. If there are any
issues, people can switch back to JS without needing to recompile.
Sam King пре 3 дана
родитељ
комит
f51bf3f275

+ 5 - 5
Trio/Sources/APS/APSManager.swift

@@ -184,7 +184,7 @@ final class BaseAPSManager: APSManager, Injectable {
             if wasParsed {
             if wasParsed {
                 Task {
                 Task {
                     do {
                     do {
-                        try await openAPS.createProfiles(useSwiftOref: settings.useSwiftOref)
+                        try await openAPS.createProfiles(useJavascriptOref: settings.useJavascriptOref)
                     } catch {
                     } catch {
                         debug(
                         debug(
                             .apsManager,
                             .apsManager,
@@ -434,7 +434,7 @@ final class BaseAPSManager: APSManager, Injectable {
         else {
         else {
             let result = try await openAPS.autosense(
             let result = try await openAPS.autosense(
                 shouldSmoothGlucose: settingsManager.settings.smoothGlucose,
                 shouldSmoothGlucose: settingsManager.settings.smoothGlucose,
-                useSwiftOref: settings.useSwiftOref
+                useJavascriptOref: settings.useJavascriptOref
             )
             )
             return result != nil
             return result != nil
         }
         }
@@ -501,14 +501,14 @@ final class BaseAPSManager: APSManager, Injectable {
             let now = Date()
             let now = Date()
 
 
             // put profile creation up front since autosens needs it
             // put profile creation up front since autosens needs it
-            try await openAPS.createProfiles(useSwiftOref: settings.useSwiftOref)
+            try await openAPS.createProfiles(useJavascriptOref: settings.useJavascriptOref)
             let currentTemp = try await fetchCurrentTempBasal(date: now)
             let currentTemp = try await fetchCurrentTempBasal(date: now)
             _ = try await autosense()
             _ = try await autosense()
 
 
             let determination = try await openAPS.determineBasal(
             let determination = try await openAPS.determineBasal(
                 currentTemp: currentTemp,
                 currentTemp: currentTemp,
                 shouldSmoothGlucose: settingsManager.settings.smoothGlucose,
                 shouldSmoothGlucose: settingsManager.settings.smoothGlucose,
-                useSwiftOref: settings.useSwiftOref,
+                useJavascriptOref: settings.useJavascriptOref,
                 clock: now
                 clock: now
             )
             )
             iobFileDidUpdate.send(())
             iobFileDidUpdate.send(())
@@ -555,7 +555,7 @@ final class BaseAPSManager: APSManager, Injectable {
             return try await openAPS.determineBasal(
             return try await openAPS.determineBasal(
                 currentTemp: temp,
                 currentTemp: temp,
                 shouldSmoothGlucose: settingsManager.settings.smoothGlucose,
                 shouldSmoothGlucose: settingsManager.settings.smoothGlucose,
-                useSwiftOref: settings.useSwiftOref,
+                useJavascriptOref: settings.useJavascriptOref,
                 clock: Date(),
                 clock: Date(),
                 simulatedCarbsAmount: simulatedCarbsAmount,
                 simulatedCarbsAmount: simulatedCarbsAmount,
                 simulatedBolusAmount: simulatedBolusAmount,
                 simulatedBolusAmount: simulatedBolusAmount,

+ 60 - 54
Trio/Sources/APS/OpenAPS/OpenAPS.swift

@@ -385,7 +385,7 @@ final class OpenAPS {
     func determineBasal(
     func determineBasal(
         currentTemp: TempBasal,
         currentTemp: TempBasal,
         shouldSmoothGlucose: Bool,
         shouldSmoothGlucose: Bool,
-        useSwiftOref: Bool,
+        useJavascriptOref: Bool,
         clock: Date = Date(),
         clock: Date = Date(),
         simulatedCarbsAmount: Decimal? = nil,
         simulatedCarbsAmount: Decimal? = nil,
         simulatedBolusAmount: Decimal? = nil,
         simulatedBolusAmount: Decimal? = nil,
@@ -448,7 +448,7 @@ final class OpenAPS {
             clock: clock,
             clock: clock,
             carbs: carbsAsJSON,
             carbs: carbsAsJSON,
             glucose: glucoseAsJSON,
             glucose: glucoseAsJSON,
-            useSwiftOref: useSwiftOref
+            useJavascriptOref: useJavascriptOref
         )
         )
 
 
         // IOB calculation
         // IOB calculation
@@ -457,7 +457,7 @@ final class OpenAPS {
             profile: profile,
             profile: profile,
             clock: clock,
             clock: clock,
             autosens: autosens.isEmpty ? .null : autosens,
             autosens: autosens.isEmpty ? .null : autosens,
-            useSwiftOref: useSwiftOref
+            useJavascriptOref: useJavascriptOref
         )
         )
 
 
         // TODO: refactor this to core data
         // TODO: refactor this to core data
@@ -485,7 +485,7 @@ final class OpenAPS {
             preferences: preferences,
             preferences: preferences,
             basalProfile: basalProfile,
             basalProfile: basalProfile,
             trioCustomOrefVariables: trioCustomOrefVariables,
             trioCustomOrefVariables: trioCustomOrefVariables,
-            useSwiftOref: useSwiftOref
+            useJavascriptOref: useJavascriptOref
         )
         )
 
 
         debug(.openAPS, "\(simulation ? "[SIMULATION]" : "") OREF DETERMINATION: \(orefDetermination)")
         debug(.openAPS, "\(simulation ? "[SIMULATION]" : "") OREF DETERMINATION: \(orefDetermination)")
@@ -578,7 +578,7 @@ final class OpenAPS {
         }
         }
     }
     }
 
 
-    func autosense(shouldSmoothGlucose: Bool, useSwiftOref: Bool) async throws -> Autosens? {
+    func autosense(shouldSmoothGlucose: Bool, useJavascriptOref: Bool) async throws -> Autosens? {
         debug(.openAPS, "Start autosens")
         debug(.openAPS, "Start autosens")
 
 
         // Perform asynchronous calls in parallel
         // Perform asynchronous calls in parallel
@@ -607,7 +607,7 @@ final class OpenAPS {
             profile: profile,
             profile: profile,
             carbs: carbsAsJSON,
             carbs: carbsAsJSON,
             temptargets: tempTargets,
             temptargets: tempTargets,
-            useSwiftOref: useSwiftOref
+            useJavascriptOref: useJavascriptOref
         )
         )
 
 
         debug(.openAPS, "AUTOSENS: \(autosenseResult)")
         debug(.openAPS, "AUTOSENS: \(autosenseResult)")
@@ -621,7 +621,7 @@ final class OpenAPS {
         }
         }
     }
     }
 
 
-    func createProfiles(useSwiftOref: Bool) async throws {
+    func createProfiles(useJavascriptOref: Bool) async throws {
         debug(.openAPS, "Start creating pump profile and user profile")
         debug(.openAPS, "Start creating pump profile and user profile")
 
 
         // Load required settings and profiles asynchronously
         // Load required settings and profiles asynchronously
@@ -698,7 +698,7 @@ final class OpenAPS {
                 model: model,
                 model: model,
                 autotune: RawJSON.null,
                 autotune: RawJSON.null,
                 trioSettings: trioSettings,
                 trioSettings: trioSettings,
-                useSwiftOref: useSwiftOref,
+                useJavascriptOref: useJavascriptOref,
                 clock: clock
                 clock: clock
             )
             )
 
 
@@ -713,7 +713,7 @@ final class OpenAPS {
                 model: model,
                 model: model,
                 autotune: RawJSON.null,
                 autotune: RawJSON.null,
                 trioSettings: trioSettings,
                 trioSettings: trioSettings,
-                useSwiftOref: useSwiftOref,
+                useJavascriptOref: useJavascriptOref,
                 clock: clock
                 clock: clock
             )
             )
 
 
@@ -729,20 +729,26 @@ final class OpenAPS {
         }
         }
     }
     }
 
 
-    private func iob(pumphistory: JSON, profile: JSON, clock: JSON, autosens: JSON, useSwiftOref: Bool) async throws -> RawJSON {
+    private func iob(
+        pumphistory: JSON,
+        profile: JSON,
+        clock: JSON,
+        autosens: JSON,
+        useJavascriptOref: Bool
+    ) async throws -> RawJSON {
         // FIXME: For now we'll just remove duplicate suspends here (ISSUE-399)
         // FIXME: For now we'll just remove duplicate suspends here (ISSUE-399)
         var pumphistory = pumphistory
         var pumphistory = pumphistory
         if let pumpHistoryArray = try? JSONBridge.pumpHistory(from: pumphistory) {
         if let pumpHistoryArray = try? JSONBridge.pumpHistory(from: pumphistory) {
             pumphistory = pumpHistoryArray.removingDuplicateSuspendResumeEvents().rawJSON
             pumphistory = pumpHistoryArray.removingDuplicateSuspendResumeEvents().rawJSON
         }
         }
 
 
-        if useSwiftOref {
+        if useJavascriptOref {
+            let jsResult = await iobJavascript(pumphistory: pumphistory, profile: profile, clock: clock, autosens: autosens)
+            return try jsResult.returnOrThrow()
+        } else {
             let swiftResult = OpenAPSSwift
             let swiftResult = OpenAPSSwift
                 .iob(pumphistory: pumphistory, profile: profile, clock: clock, autosens: autosens)
                 .iob(pumphistory: pumphistory, profile: profile, clock: clock, autosens: autosens)
             return try swiftResult.returnOrThrow()
             return try swiftResult.returnOrThrow()
-        } else {
-            let jsResult = await iobJavascript(pumphistory: pumphistory, profile: profile, clock: clock, autosens: autosens)
-            return try jsResult.returnOrThrow()
         }
         }
     }
     }
 
 
@@ -777,9 +783,19 @@ final class OpenAPS {
         clock: JSON,
         clock: JSON,
         carbs: JSON,
         carbs: JSON,
         glucose: JSON,
         glucose: JSON,
-        useSwiftOref: Bool
+        useJavascriptOref: Bool
     ) async throws -> RawJSON {
     ) async throws -> RawJSON {
-        if useSwiftOref {
+        if useJavascriptOref {
+            let jsResult = await mealJavascript(
+                pumphistory: pumphistory,
+                profile: profile,
+                basalProfile: basalProfile,
+                clock: clock,
+                carbs: carbs,
+                glucose: glucose
+            )
+            return try jsResult.returnOrThrow()
+        } else {
             let swiftResult = OpenAPSSwift
             let swiftResult = OpenAPSSwift
                 .meal(
                 .meal(
                     pumphistory: pumphistory,
                     pumphistory: pumphistory,
@@ -790,16 +806,6 @@ final class OpenAPS {
                     glucose: glucose
                     glucose: glucose
                 )
                 )
             return try swiftResult.returnOrThrow()
             return try swiftResult.returnOrThrow()
-        } else {
-            let jsResult = await mealJavascript(
-                pumphistory: pumphistory,
-                profile: profile,
-                basalProfile: basalProfile,
-                clock: clock,
-                carbs: carbs,
-                glucose: glucose
-            )
-            return try jsResult.returnOrThrow()
         }
         }
     }
     }
 
 
@@ -843,9 +849,19 @@ final class OpenAPS {
         profile: JSON,
         profile: JSON,
         carbs: JSON,
         carbs: JSON,
         temptargets: JSON,
         temptargets: JSON,
-        useSwiftOref: Bool
+        useJavascriptOref: Bool
     ) async throws -> RawJSON {
     ) async throws -> RawJSON {
-        if useSwiftOref {
+        if useJavascriptOref {
+            let jsResult = await autosenseJavascript(
+                glucose: glucose,
+                pumpHistory: pumpHistory,
+                basalprofile: basalprofile,
+                profile: profile,
+                carbs: carbs,
+                temptargets: temptargets
+            )
+            return try jsResult.returnOrThrow()
+        } else {
             let swiftResult = OpenAPSSwift
             let swiftResult = OpenAPSSwift
                 .autosense(
                 .autosense(
                     glucose: glucose,
                     glucose: glucose,
@@ -857,16 +873,6 @@ final class OpenAPS {
                     clock: Date()
                     clock: Date()
                 )
                 )
             return try swiftResult.returnOrThrow()
             return try swiftResult.returnOrThrow()
-        } else {
-            let jsResult = await autosenseJavascript(
-                glucose: glucose,
-                pumpHistory: pumpHistory,
-                basalprofile: basalprofile,
-                profile: profile,
-                carbs: carbs,
-                temptargets: temptargets
-            )
-            return try jsResult.returnOrThrow()
         }
         }
     }
     }
 
 
@@ -916,12 +922,12 @@ final class OpenAPS {
         preferences: JSON,
         preferences: JSON,
         basalProfile: JSON,
         basalProfile: JSON,
         trioCustomOrefVariables: JSON,
         trioCustomOrefVariables: JSON,
-        useSwiftOref: Bool
+        useJavascriptOref: Bool
     ) async throws -> RawJSON {
     ) async throws -> RawJSON {
         let clock = Date()
         let clock = Date()
 
 
-        if useSwiftOref {
-            let swiftResult = OpenAPSSwift.determineBasal(
+        if useJavascriptOref {
+            let jsResult = await determineBasalJavascript(
                 glucose: glucose,
                 glucose: glucose,
                 currentTemp: currentTemp,
                 currentTemp: currentTemp,
                 iob: iob,
                 iob: iob,
@@ -936,9 +942,9 @@ final class OpenAPS {
                 trioCustomOrefVariables: trioCustomOrefVariables,
                 trioCustomOrefVariables: trioCustomOrefVariables,
                 clock: clock
                 clock: clock
             )
             )
-            return try swiftResult.returnOrThrow()
+            return try jsResult.returnOrThrow()
         } else {
         } else {
-            let jsResult = await determineBasalJavascript(
+            let swiftResult = OpenAPSSwift.determineBasal(
                 glucose: glucose,
                 glucose: glucose,
                 currentTemp: currentTemp,
                 currentTemp: currentTemp,
                 iob: iob,
                 iob: iob,
@@ -953,7 +959,7 @@ final class OpenAPS {
                 trioCustomOrefVariables: trioCustomOrefVariables,
                 trioCustomOrefVariables: trioCustomOrefVariables,
                 clock: clock
                 clock: clock
             )
             )
-            return try jsResult.returnOrThrow()
+            return try swiftResult.returnOrThrow()
         }
         }
     }
     }
 
 
@@ -1073,11 +1079,11 @@ final class OpenAPS {
         model: JSON,
         model: JSON,
         autotune: JSON,
         autotune: JSON,
         trioSettings: JSON,
         trioSettings: JSON,
-        useSwiftOref: Bool,
+        useJavascriptOref: Bool,
         clock: Date
         clock: Date
     ) async throws -> RawJSON {
     ) async throws -> RawJSON {
-        if useSwiftOref {
-            let swiftResult = OpenAPSSwift.makeProfile(
+        if useJavascriptOref {
+            let jsResult = await makeProfileJavascript(
                 preferences: preferences,
                 preferences: preferences,
                 pumpSettings: pumpSettings,
                 pumpSettings: pumpSettings,
                 bgTargets: bgTargets,
                 bgTargets: bgTargets,
@@ -1086,12 +1092,12 @@ final class OpenAPS {
                 carbRatio: carbRatio,
                 carbRatio: carbRatio,
                 tempTargets: tempTargets,
                 tempTargets: tempTargets,
                 model: model,
                 model: model,
-                trioSettings: trioSettings,
-                clock: clock
+                autotune: autotune,
+                trioSettings: trioSettings
             )
             )
-            return try swiftResult.returnOrThrow()
+            return try jsResult.returnOrThrow()
         } else {
         } else {
-            let jsResult = await makeProfileJavascript(
+            let swiftResult = OpenAPSSwift.makeProfile(
                 preferences: preferences,
                 preferences: preferences,
                 pumpSettings: pumpSettings,
                 pumpSettings: pumpSettings,
                 bgTargets: bgTargets,
                 bgTargets: bgTargets,
@@ -1100,10 +1106,10 @@ final class OpenAPS {
                 carbRatio: carbRatio,
                 carbRatio: carbRatio,
                 tempTargets: tempTargets,
                 tempTargets: tempTargets,
                 model: model,
                 model: model,
-                autotune: autotune,
-                trioSettings: trioSettings
+                trioSettings: trioSettings,
+                clock: clock
             )
             )
-            return try jsResult.returnOrThrow()
+            return try swiftResult.returnOrThrow()
         }
         }
     }
     }
 
 

+ 10 - 13
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -116203,9 +116203,6 @@
         }
         }
       }
       }
     },
     },
-    "EXPERIMENTAL FEATURE! Enables new, fully Swift-based algorithm version." : {
-      "comment" : "Use Swift Oref mini hint"
-    },
     "Expiration Reminder" : {
     "Expiration Reminder" : {
       "extractionState" : "manual",
       "extractionState" : "manual",
       "localizations" : {
       "localizations" : {
@@ -239226,6 +239223,9 @@
         }
         }
       }
       }
     },
     },
+    "Switches back to the legacy JavaScript-based algorithm version." : {
+      "comment" : "Use JavaScript Oref mini hint"
+    },
     "Synth" : {
     "Synth" : {
       "comment" : "Display name for the synth alarm sound.",
       "comment" : "Display name for the synth alarm sound.",
       "isCommentAutoGenerated" : true
       "isCommentAutoGenerated" : true
@@ -252792,9 +252792,6 @@
         }
         }
       }
       }
     },
     },
-    "This feature is EXPERIMENTAL and not yet cleared for general use." : {
-
-    },
     "This feature resets the Autosens Ratio to neutral when you rewind your pump on the assumption that this corresponds to a site change." : {
     "This feature resets the Autosens Ratio to neutral when you rewind your pump on the assumption that this corresponds to a site change." : {
       "localizations" : {
       "localizations" : {
         "bg" : {
         "bg" : {
@@ -269121,6 +269118,9 @@
         }
         }
       }
       }
     },
     },
+    "Trio now uses a fully Swift-based version of the algorithm (Oref) by default. It's faster, more accurate and improves Trio for everyone." : {
+
+    },
     "Trio Personalization" : {
     "Trio Personalization" : {
       "localizations" : {
       "localizations" : {
         "bg" : {
         "bg" : {
@@ -277569,6 +277569,9 @@
         }
         }
       }
       }
     },
     },
+    "Use JavaScript Oref" : {
+      "comment" : "Use JavaScript Oref"
+    },
     "Use local glucose server" : {
     "Use local glucose server" : {
       "extractionState" : "manual",
       "extractionState" : "manual",
       "localizations" : {
       "localizations" : {
@@ -277832,9 +277835,6 @@
         }
         }
       }
       }
     },
     },
-    "Use Swift Oref" : {
-      "comment" : "Use Swift Oref"
-    },
     "Use the diagnostics-sharing chooser above. Pick \"Crash Reports Only\" to keep crash reporting but disable telemetry, or \"Disable Sharing\" to turn off both. Changes take effect immediately." : {
     "Use the diagnostics-sharing chooser above. Pick \"Crash Reports Only\" to keep crash reporting but disable telemetry, or \"Disable Sharing\" to turn off both. Changes take effect immediately." : {
 
 
     },
     },
@@ -283229,9 +283229,6 @@
         }
         }
       }
       }
     },
     },
-    "We're building a faster and more maintainable Swift version of the algorithm (Oref) that runs in Trio. It's faster, more accurate and improves Trio for everyone." : {
-
-    },
     "Week" : {
     "Week" : {
       "extractionState" : "manual",
       "extractionState" : "manual",
       "localizations" : {
       "localizations" : {
@@ -285364,7 +285361,7 @@
         }
         }
       }
       }
     },
     },
-    "When enabled, Trio will no longer use the old JavaScript-based algorithm that runs virtualized on your phone. Instead, it will use a fully Swift-based algorithm." : {
+    "When enabled, Trio will instead use the legacy JavaScript-based algorithm that runs virtualized on your phone. Only enable this if you encounter issues with the Swift-based algorithm." : {
 
 
     },
     },
     "When Remote Control is enabled, you can send boluses, overrides, temporary targets, carbs, and other commands to Trio via push notifications." : {
     "When Remote Control is enabled, you can send boluses, overrides, temporary targets, carbs, and other commands to Trio via push notifications." : {

+ 3 - 3
Trio/Sources/Models/TrioSettings.swift

@@ -68,7 +68,7 @@ struct TrioSettings: JSON, Equatable, Encodable {
     var bolusShortcut: BolusShortcutLimit = .notAllowed
     var bolusShortcut: BolusShortcutLimit = .notAllowed
     var timeInRangeType: TimeInRangeType = .timeInTightRange
     var timeInRangeType: TimeInRangeType = .timeInTightRange
     var requireAdjustmentsConfirmation: Bool = false
     var requireAdjustmentsConfirmation: Bool = false
-    var useSwiftOref: Bool = false
+    var useJavascriptOref: Bool = false
 
 
     /// Selected Garmin watchface (Trio or SwissAlpine)
     /// Selected Garmin watchface (Trio or SwissAlpine)
     var garminWatchface: GarminWatchface = .trio
     var garminWatchface: GarminWatchface = .trio
@@ -318,8 +318,8 @@ extension TrioSettings: Decodable {
             settings.requireAdjustmentsConfirmation = requireAdjustmentsConfirmation
             settings.requireAdjustmentsConfirmation = requireAdjustmentsConfirmation
         }
         }
 
 
-        if let useSwiftOref = try? container.decode(Bool.self, forKey: .useSwiftOref) {
-            settings.useSwiftOref = useSwiftOref
+        if let useJavascriptOref = try? container.decode(Bool.self, forKey: .useJavascriptOref) {
+            settings.useJavascriptOref = useJavascriptOref
         }
         }
 
 
         if let garminWatchface = try? container.decode(GarminWatchface.self, forKey: .garminWatchface) {
         if let garminWatchface = try? container.decode(GarminWatchface.self, forKey: .garminWatchface) {

+ 3 - 3
Trio/Sources/Modules/AlgorithmAdvancedSettings/AlgorithmAdvancedSettingsStateModel.swift

@@ -22,7 +22,7 @@ extension AlgorithmAdvancedSettings {
         @Published var remainingCarbsFraction: Decimal = 1.0
         @Published var remainingCarbsFraction: Decimal = 1.0
         @Published var remainingCarbsCap: Decimal = 90
         @Published var remainingCarbsCap: Decimal = 90
         @Published var noisyCGMTargetMultiplier: Decimal = 1.3
         @Published var noisyCGMTargetMultiplier: Decimal = 1.3
-        @Published var useSwiftOref: Bool = false
+        @Published var useJavascriptOref: Bool = false
         // preference
         // preference
         @Published var insulinActionCurve: Decimal = 10
         @Published var insulinActionCurve: Decimal = 10
         @Published var smbDeliveryRatio: Decimal = 0.5
         @Published var smbDeliveryRatio: Decimal = 0.5
@@ -48,8 +48,8 @@ extension AlgorithmAdvancedSettings {
             subscribePreferencesSetting(\.remainingCarbsCap, on: $remainingCarbsCap) { remainingCarbsCap = $0 }
             subscribePreferencesSetting(\.remainingCarbsCap, on: $remainingCarbsCap) { remainingCarbsCap = $0 }
             subscribePreferencesSetting(\.noisyCGMTargetMultiplier, on: $noisyCGMTargetMultiplier) {
             subscribePreferencesSetting(\.noisyCGMTargetMultiplier, on: $noisyCGMTargetMultiplier) {
                 noisyCGMTargetMultiplier = $0 }
                 noisyCGMTargetMultiplier = $0 }
-            subscribeSetting(\.useSwiftOref, on: $useSwiftOref) {
-                useSwiftOref = $0 }
+            subscribeSetting(\.useJavascriptOref, on: $useJavascriptOref) {
+                useJavascriptOref = $0 }
             subscribePreferencesSetting(\.smbDeliveryRatio, on: $smbDeliveryRatio) { smbDeliveryRatio = $0 }
             subscribePreferencesSetting(\.smbDeliveryRatio, on: $smbDeliveryRatio) { smbDeliveryRatio = $0 }
             subscribePreferencesSetting(\.smbInterval, on: $smbInterval) { smbInterval = $0 }
             subscribePreferencesSetting(\.smbInterval, on: $smbInterval) { smbInterval = $0 }
             subscribePreferencesSetting(\.smbDeliveryRatio, on: $smbDeliveryRatio) { smbDeliveryRatio = $0 }
             subscribePreferencesSetting(\.smbDeliveryRatio, on: $smbDeliveryRatio) { smbDeliveryRatio = $0 }

+ 7 - 8
Trio/Sources/Modules/AlgorithmAdvancedSettings/View/AlgorithmAdvancedSettingsRootView.swift

@@ -392,31 +392,30 @@ extension AlgorithmAdvancedSettings {
                 )
                 )
                 SettingInputSection(
                 SettingInputSection(
                     decimalValue: $decimalPlaceholder,
                     decimalValue: $decimalPlaceholder,
-                    booleanValue: $state.useSwiftOref,
+                    booleanValue: $state.useJavascriptOref,
                     shouldDisplayHint: $shouldDisplayHint,
                     shouldDisplayHint: $shouldDisplayHint,
                     selectedVerboseHint: Binding(
                     selectedVerboseHint: Binding(
                         get: { selectedVerboseHint },
                         get: { selectedVerboseHint },
                         set: {
                         set: {
                             selectedVerboseHint = $0.map { AnyView($0) }
                             selectedVerboseHint = $0.map { AnyView($0) }
-                            hintLabel = NSLocalizedString("Use Swift Oref", comment: "Use Swift Oref")
+                            hintLabel = NSLocalizedString("Use JavaScript Oref", comment: "Use JavaScript Oref")
                         }
                         }
                     ),
                     ),
                     units: state.units,
                     units: state.units,
                     type: .boolean,
                     type: .boolean,
-                    label: NSLocalizedString("Use Swift Oref", comment: "Use Swift Oref"),
+                    label: NSLocalizedString("Use JavaScript Oref", comment: "Use JavaScript Oref"),
                     miniHint: String(
                     miniHint: String(
-                        localized: "EXPERIMENTAL FEATURE! Enables new, fully Swift-based algorithm version.",
-                        comment: "Use Swift Oref mini hint"
+                        localized: "Switches back to the legacy JavaScript-based algorithm version.",
+                        comment: "Use JavaScript Oref mini hint"
                     ),
                     ),
                     verboseHint:
                     verboseHint:
                     VStack(alignment: .leading, spacing: 10) {
                     VStack(alignment: .leading, spacing: 10) {
                         Text("Default: OFF").bold()
                         Text("Default: OFF").bold()
-                        Text("This feature is EXPERIMENTAL and not yet cleared for general use.").bold().foregroundStyle(.orange)
                         Text(
                         Text(
-                            "We're building a faster and more maintainable Swift version of the algorithm (Oref) that runs in Trio. It's faster, more accurate and improves Trio for everyone."
+                            "Trio now uses a fully Swift-based version of the algorithm (Oref) by default. It's faster, more accurate and improves Trio for everyone."
                         )
                         )
                         Text(
                         Text(
-                            "When enabled, Trio will no longer use the old JavaScript-based algorithm that runs virtualized on your phone. Instead, it will use a fully Swift-based algorithm."
+                            "When enabled, Trio will instead use the legacy JavaScript-based algorithm that runs virtualized on your phone. Only enable this if you encounter issues with the Swift-based algorithm."
                         )
                         )
 
 
                         Text(
                         Text(

+ 1 - 1
Trio/Sources/Modules/Home/View/Header/LoopStatusView.swift

@@ -289,7 +289,7 @@ struct LoopStatusView: View {
         }
         }
 
 
         // FIXME: remove this before feat/dev-oref-swift is merged to dev
         // FIXME: remove this before feat/dev-oref-swift is merged to dev
-        if state.settingsManager.settings.useSwiftOref {
+        if !state.settingsManager.settings.useJavascriptOref {
             tags.append("Swift Oref")
             tags.append("Swift Oref")
         }
         }