Просмотр исходного кода

Purge NS import from Settings > Services > Nightscout

Deniz Cengiz 1 год назад
Родитель
Сommit
9b19717a98

+ 0 - 16
Trio.xcodeproj/project.pbxproj

@@ -572,8 +572,6 @@
 		DD68889D2C386E17006E3C44 /* NightscoutExercise.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD68889C2C386E17006E3C44 /* NightscoutExercise.swift */; };
 		DD68889D2C386E17006E3C44 /* NightscoutExercise.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD68889C2C386E17006E3C44 /* NightscoutExercise.swift */; };
 		DD6B7CB22C7B6F0800B75029 /* Rounding.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6B7CB12C7B6F0800B75029 /* Rounding.swift */; };
 		DD6B7CB22C7B6F0800B75029 /* Rounding.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6B7CB12C7B6F0800B75029 /* Rounding.swift */; };
 		DD6B7CB42C7B71F700B75029 /* ForecastDisplayType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6B7CB32C7B71F700B75029 /* ForecastDisplayType.swift */; };
 		DD6B7CB42C7B71F700B75029 /* ForecastDisplayType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6B7CB32C7B71F700B75029 /* ForecastDisplayType.swift */; };
-		DD6B7CB92C7BAC6900B75029 /* NightscoutImportResultView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6B7CB82C7BAC6900B75029 /* NightscoutImportResultView.swift */; };
-		DD6B7CBB2C7FBBFA00B75029 /* ReviewInsulinActionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6B7CBA2C7FBBFA00B75029 /* ReviewInsulinActionView.swift */; };
 		DD6D67E42C9C253500660C9B /* ColorSchemeOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6D67E32C9C253500660C9B /* ColorSchemeOption.swift */; };
 		DD6D67E42C9C253500660C9B /* ColorSchemeOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6D67E32C9C253500660C9B /* ColorSchemeOption.swift */; };
 		DD6F63CC2D27F615007D94CF /* TreatmentMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6F63CB2D27F606007D94CF /* TreatmentMenuView.swift */; };
 		DD6F63CC2D27F615007D94CF /* TreatmentMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6F63CB2D27F606007D94CF /* TreatmentMenuView.swift */; };
 		DD73FA0F2D74F58E00D19D1E /* BackgroundTask+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD73FA0E2D74F57300D19D1E /* BackgroundTask+Helper.swift */; };
 		DD73FA0F2D74F58E00D19D1E /* BackgroundTask+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD73FA0E2D74F57300D19D1E /* BackgroundTask+Helper.swift */; };
@@ -1354,8 +1352,6 @@
 		DD68889C2C386E17006E3C44 /* NightscoutExercise.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NightscoutExercise.swift; sourceTree = "<group>"; };
 		DD68889C2C386E17006E3C44 /* NightscoutExercise.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NightscoutExercise.swift; sourceTree = "<group>"; };
 		DD6B7CB12C7B6F0800B75029 /* Rounding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Rounding.swift; sourceTree = "<group>"; };
 		DD6B7CB12C7B6F0800B75029 /* Rounding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Rounding.swift; sourceTree = "<group>"; };
 		DD6B7CB32C7B71F700B75029 /* ForecastDisplayType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForecastDisplayType.swift; sourceTree = "<group>"; };
 		DD6B7CB32C7B71F700B75029 /* ForecastDisplayType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForecastDisplayType.swift; sourceTree = "<group>"; };
-		DD6B7CB82C7BAC6900B75029 /* NightscoutImportResultView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NightscoutImportResultView.swift; sourceTree = "<group>"; };
-		DD6B7CBA2C7FBBFA00B75029 /* ReviewInsulinActionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewInsulinActionView.swift; sourceTree = "<group>"; };
 		DD6D67E32C9C253500660C9B /* ColorSchemeOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorSchemeOption.swift; sourceTree = "<group>"; };
 		DD6D67E32C9C253500660C9B /* ColorSchemeOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorSchemeOption.swift; sourceTree = "<group>"; };
 		DD6F63CB2D27F606007D94CF /* TreatmentMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TreatmentMenuView.swift; sourceTree = "<group>"; };
 		DD6F63CB2D27F606007D94CF /* TreatmentMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TreatmentMenuView.swift; sourceTree = "<group>"; };
 		DD73FA0E2D74F57300D19D1E /* BackgroundTask+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BackgroundTask+Helper.swift"; sourceTree = "<group>"; };
 		DD73FA0E2D74F57300D19D1E /* BackgroundTask+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BackgroundTask+Helper.swift"; sourceTree = "<group>"; };
@@ -2512,7 +2508,6 @@
 		4F4AE4D901E8BA872B207D7F /* View */ = {
 		4F4AE4D901E8BA872B207D7F /* View */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				DD6B7CB72C7BAC1B00B75029 /* ProfileImport */,
 				8782B44544F38F2B2D82C38E /* NightscoutConfigRootView.swift */,
 				8782B44544F38F2B2D82C38E /* NightscoutConfigRootView.swift */,
 				5A2325512BFCBF55003518CA /* NightscoutUploadView.swift */,
 				5A2325512BFCBF55003518CA /* NightscoutUploadView.swift */,
 				5A2325532BFCBF65003518CA /* NightscoutFetchView.swift */,
 				5A2325532BFCBF65003518CA /* NightscoutFetchView.swift */,
@@ -3246,15 +3241,6 @@
 			path = ViewElements;
 			path = ViewElements;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
 		};
 		};
-		DD6B7CB72C7BAC1B00B75029 /* ProfileImport */ = {
-			isa = PBXGroup;
-			children = (
-				DD6B7CB82C7BAC6900B75029 /* NightscoutImportResultView.swift */,
-				DD6B7CBA2C7FBBFA00B75029 /* ReviewInsulinActionView.swift */,
-			);
-			path = ProfileImport;
-			sourceTree = "<group>";
-		};
 		DD9ECB662CA99EFE00AA7C45 /* RemoteControl */ = {
 		DD9ECB662CA99EFE00AA7C45 /* RemoteControl */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
@@ -3915,7 +3901,6 @@
 				3894873A2614928B004DF424 /* DispatchTimer.swift in Sources */,
 				3894873A2614928B004DF424 /* DispatchTimer.swift in Sources */,
 				3895E4C625B9E00D00214B37 /* Preferences.swift in Sources */,
 				3895E4C625B9E00D00214B37 /* Preferences.swift in Sources */,
 				CE94598429E9E3E60047C9C6 /* WatchConfigStateModel.swift in Sources */,
 				CE94598429E9E3E60047C9C6 /* WatchConfigStateModel.swift in Sources */,
-				DD6B7CB92C7BAC6900B75029 /* NightscoutImportResultView.swift in Sources */,
 				38DF1786276A73D400B3528F /* TagCloudView.swift in Sources */,
 				38DF1786276A73D400B3528F /* TagCloudView.swift in Sources */,
 				38B4F3CD25E5031100E76A18 /* Broadcaster.swift in Sources */,
 				38B4F3CD25E5031100E76A18 /* Broadcaster.swift in Sources */,
 				383420D925FFEB3F002D46C1 /* Popup.swift in Sources */,
 				383420D925FFEB3F002D46C1 /* Popup.swift in Sources */,
@@ -4161,7 +4146,6 @@
 				DD32CFA02CC824D6003686D6 /* TrioRemoteControl+APNS.swift in Sources */,
 				DD32CFA02CC824D6003686D6 /* TrioRemoteControl+APNS.swift in Sources */,
 				CE7CA3532A064973004BE681 /* TempPresetIntent.swift in Sources */,
 				CE7CA3532A064973004BE681 /* TempPresetIntent.swift in Sources */,
 				D6DEC113821A7F1056C4AA1E /* NightscoutConfigDataFlow.swift in Sources */,
 				D6DEC113821A7F1056C4AA1E /* NightscoutConfigDataFlow.swift in Sources */,
-				DD6B7CBB2C7FBBFA00B75029 /* ReviewInsulinActionView.swift in Sources */,
 				38E98A3025F52FF700C0CED0 /* Config.swift in Sources */,
 				38E98A3025F52FF700C0CED0 /* Config.swift in Sources */,
 				BDB899882C564509006F3298 /* ForecastChart.swift in Sources */,
 				BDB899882C564509006F3298 /* ForecastChart.swift in Sources */,
 				110AEDE32C5193D200615CC9 /* BolusIntent.swift in Sources */,
 				110AEDE32C5193D200615CC9 /* BolusIntent.swift in Sources */,

+ 0 - 264
Trio/Sources/Modules/NightscoutConfig/NightscoutConfigStateModel.swift

@@ -35,19 +35,6 @@ extension NightscoutConfig {
         @Published var maxBolus: Decimal = 10
         @Published var maxBolus: Decimal = 10
         @Published var isConnectedToNS: Bool = false
         @Published var isConnectedToNS: Bool = false
 
 
-        @Published var isImportResultReviewPresented: Bool = false
-        @Published var importErrors: [String] = []
-        @Published var importStatus: ImportStatus = .finished
-        @Published var importedInsulinActionCurve: Decimal = 6
-
-        var pumpSettings: PumpSettings {
-            provider.getPumpSettings()
-        }
-
-        var isPumpSettingUnchanged: Bool {
-            pumpSettings.insulinActionCurve == importedInsulinActionCurve
-        }
-
         override func subscribe() {
         override func subscribe() {
             url = keychain.getValue(String.self, forKey: Config.urlKey) ?? ""
             url = keychain.getValue(String.self, forKey: Config.urlKey) ?? ""
             secret = keychain.getValue(String.self, forKey: Config.secretKey) ?? ""
             secret = keychain.getValue(String.self, forKey: Config.secretKey) ?? ""
@@ -63,8 +50,6 @@ extension NightscoutConfig {
             subscribeSetting(\.localGlucosePort, on: $localPort.map(Int.init)) { localPort = Decimal($0) }
             subscribeSetting(\.localGlucosePort, on: $localPort.map(Int.init)) { localPort = Decimal($0) }
             subscribeSetting(\.uploadGlucose, on: $uploadGlucose, initial: { uploadGlucose = $0 })
             subscribeSetting(\.uploadGlucose, on: $uploadGlucose, initial: { uploadGlucose = $0 })
 
 
-            importedInsulinActionCurve = pumpSettings.insulinActionCurve
-
             isConnectedToNS = nightscoutAPI != nil
             isConnectedToNS = nightscoutAPI != nil
 
 
             $isUploadEnabled
             $isUploadEnabled
@@ -155,217 +140,6 @@ extension NightscoutConfig {
             return lowTargetValue
             return lowTargetValue
         }
         }
 
 
-        func correctUnitParsingOffsets(_ parsedValue: Decimal) -> Decimal {
-            Int(parsedValue) % 2 == 0 ? parsedValue : parsedValue + 1
-        }
-
-        func importSettings() async {
-            importStatus = .running
-
-            do {
-                guard let fetchedProfile = await nightscoutManager.importSettings() else {
-                    await MainActor.run {
-                        importStatus = .failed
-                    }
-                    throw NSError(
-                        domain: "ImportError",
-                        code: 1,
-                        userInfo: [NSLocalizedDescriptionKey: "Cannot find the default Nightscout Profile."]
-                    )
-                }
-
-                // determine, i.e. guesstimate, whether fetched values are mmol/L or mg/dL values
-                let shouldConvertToMgdL = fetchedProfile.units.contains("mmol") || fetchedProfile.target_low
-                    .contains(where: { $0.value <= 39 }) || fetchedProfile.target_high.contains(where: { $0.value <= 39 })
-
-                // Carb Ratios
-                let carbratios = fetchedProfile.carbratio.map { carbratio in
-                    CarbRatioEntry(
-                        start: carbratio.time,
-                        offset: offset(carbratio.time) / 60,
-                        ratio: carbratio.value
-                    )
-                }
-
-                if carbratios.contains(where: { $0.ratio <= 0 }) {
-                    await MainActor.run {
-                        importStatus = .failed
-                    }
-                    throw NSError(
-                        domain: "ImportError",
-                        code: 2,
-                        userInfo: [NSLocalizedDescriptionKey: "Invalid Carb Ratio settings in Nightscout. Import aborted."]
-                    )
-                }
-
-                let carbratiosProfile = CarbRatios(units: .grams, schedule: carbratios)
-
-                // Basal Profile
-                let pumpName = apsManager.pumpName.value
-                let basals = fetchedProfile.basal.map { basal in
-                    BasalProfileEntry(
-                        start: basal.time,
-                        minutes: offset(basal.time) / 60,
-                        rate: basal.value
-                    )
-                }
-
-                if pumpName != "Omnipod DASH", basals.contains(where: { $0.rate <= 0 }) {
-                    await MainActor.run {
-                        importStatus = .failed
-                    }
-                    throw NSError(
-                        domain: "ImportError",
-                        code: 3,
-                        userInfo: [NSLocalizedDescriptionKey: "Invalid Nightscout basal rates found. Import aborted."]
-                    )
-                }
-
-                if pumpName == "Omnipod DASH", basals.reduce(0, { $0 + $1.rate }) <= 0 {
-                    await MainActor.run {
-                        importStatus = .failed
-                    }
-                    throw NSError(
-                        domain: "ImportError",
-                        code: 4,
-                        userInfo: [
-                            NSLocalizedDescriptionKey: "Invalid Nightscout basal rates found. Basal rate total cannot be 0 U/hr. Import aborted."
-                        ]
-                    )
-                }
-
-                // Sensitivities
-                let sensitivities = fetchedProfile.sens.map { sensitivity in
-                    InsulinSensitivityEntry(
-                        sensitivity: shouldConvertToMgdL ? correctUnitParsingOffsets(sensitivity.value.asMgdL) : sensitivity
-                            .value,
-                        offset: offset(sensitivity.time) / 60,
-                        start: sensitivity.time
-                    )
-                }
-
-                if sensitivities.contains(where: { $0.sensitivity <= 0 }) {
-                    await MainActor.run {
-                        importStatus = .failed
-                    }
-                    throw NSError(
-                        domain: "ImportError",
-                        code: 5,
-                        userInfo: [NSLocalizedDescriptionKey: "Invalid Nightscout insulin sensitivity profile. Import aborted."]
-                    )
-                }
-
-                let sensitivitiesProfile = InsulinSensitivities(
-                    units: .mgdL,
-                    userPreferredUnits: .mgdL,
-                    sensitivities: sensitivities
-                )
-
-                // Targets
-                let targets = fetchedProfile.target_low.map { target in
-                    BGTargetEntry(
-                        low: shouldConvertToMgdL ? correctUnitParsingOffsets(target.value.asMgdL) : target.value,
-                        high: shouldConvertToMgdL ? correctUnitParsingOffsets(target.value.asMgdL) : target.value,
-                        start: target.time,
-                        offset: offset(target.time) / 60
-                    )
-                }
-
-                let targetsProfile = BGTargets(units: .mgdL, userPreferredUnits: .mgdL, targets: targets)
-
-                // Save to storage and pump
-                if let pump = apsManager.pumpManager {
-                    let syncValues = basals.map {
-                        RepeatingScheduleValue(startTime: TimeInterval($0.minutes * 60), value: Double($0.rate))
-                    }
-
-                    await withCheckedContinuation { continuation in
-                        pump.syncBasalRateSchedule(items: syncValues) { [weak self] result in
-                            guard let self else {
-                                continuation.resume()
-                                return
-                            }
-
-                            switch result {
-                            case .success:
-                                self.storage.save(basals, as: OpenAPS.Settings.basalProfile)
-                                self.finalizeImport(
-                                    carbratiosProfile: carbratiosProfile,
-                                    sensitivitiesProfile: sensitivitiesProfile,
-                                    targetsProfile: targetsProfile,
-                                    dia: fetchedProfile.dia
-                                )
-                            case .failure:
-                                Task { @MainActor in
-                                    self.importErrors.append(
-                                        "Settings were imported but the basal rates could not be saved to pump (communication error)."
-                                    )
-                                    self.importStatus = .failed
-                                }
-                            }
-                            continuation.resume()
-                        }
-                    }
-
-                    if await MainActor.run(body: { importErrors.isNotEmpty && importStatus == .failed }) {
-                        throw NSError(
-                            domain: "ImportError",
-                            code: 6,
-                            userInfo: [
-                                NSLocalizedDescriptionKey: "Settings were imported but the basal rates could not be saved to pump (communication error)."
-                            ]
-                        )
-                    }
-                } else {
-                    storage.save(basals, as: OpenAPS.Settings.basalProfile)
-                    finalizeImport(
-                        carbratiosProfile: carbratiosProfile,
-                        sensitivitiesProfile: sensitivitiesProfile,
-                        targetsProfile: targetsProfile,
-                        dia: fetchedProfile.dia
-                    )
-                }
-            } catch {
-                await MainActor.run {
-                    self.importErrors.append(error.localizedDescription)
-                    debug(.service, "Settings import failed with error: \(error.localizedDescription)")
-                }
-            }
-        }
-
-        private func finalizeImport(
-            carbratiosProfile: CarbRatios,
-            sensitivitiesProfile: InsulinSensitivities,
-            targetsProfile: BGTargets,
-            dia: Decimal
-        ) {
-            storage.save(carbratiosProfile, as: OpenAPS.Settings.carbRatios)
-            storage.save(sensitivitiesProfile, as: OpenAPS.Settings.insulinSensitivities)
-            storage.save(targetsProfile, as: OpenAPS.Settings.bgTargets)
-
-            // Save DIA if different
-            if dia != self.dia, dia >= 0 {
-                let file = PumpSettings(insulinActionCurve: dia, maxBolus: maxBolus, maxBasal: maxBasal)
-                storage.save(file, as: OpenAPS.Settings.settings)
-                debug(.nightscout, "DIA setting updated to \(dia) after a NS import.")
-            }
-
-            debug(.service, "Settings imported successfully.")
-
-            DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
-                // stop blur
-                self.importStatus = .finished
-                // display next import rewview step
-                self.isImportResultReviewPresented = true
-            }
-        }
-
-        func offset(_ string: String) -> Int {
-            let hours = Int(string.prefix(2)) ?? 0
-            let minutes = Int(string.suffix(2)) ?? 0
-            return ((hours * 60) + minutes) * 60
-        }
-
         func backfillGlucose() async {
         func backfillGlucose() async {
             await MainActor.run {
             await MainActor.run {
                 backfilling = true
                 backfilling = true
@@ -403,35 +177,6 @@ extension NightscoutConfig {
             secret = ""
             secret = ""
             isConnectedToNS = false
             isConnectedToNS = false
         }
         }
-
-        func saveReviewedInsulinAction() {
-            if !isPumpSettingUnchanged {
-                let settings = PumpSettings(
-                    insulinActionCurve: importedInsulinActionCurve,
-                    maxBolus: pumpSettings.maxBolus,
-                    maxBasal: pumpSettings.maxBasal
-                )
-                provider.savePumpSettings(settings: settings)
-                    .receive(on: DispatchQueue.main)
-                    .sink { _ in
-                        let settings = self.provider.getPumpSettings()
-                        self.importedInsulinActionCurve = settings.insulinActionCurve
-
-                        Task.detached(priority: .low) {
-                            do {
-                                debug(.nightscout, "Attempting to upload DIA to Nightscout after import review")
-                                try await self.nightscoutManager.uploadProfiles()
-                            } catch {
-                                debug(
-                                    .default,
-                                    "\(DebuggingIdentifiers.failed) failed to upload DIA to Nightscout: \(error.localizedDescription)"
-                                )
-                            }
-                        }
-                    } receiveValue: {}
-                    .store(in: &lifetime)
-            }
-        }
     }
     }
 }
 }
 
 
@@ -440,12 +185,3 @@ extension NightscoutConfig.StateModel: SettingsObserver {
         units = settingsManager.settings.units
         units = settingsManager.settings.units
     }
     }
 }
 }
-
-extension NightscoutConfig.StateModel {
-    enum ImportStatus {
-        case running
-        case finished
-        case failed
-        case noPumpConnected
-    }
-}

+ 0 - 94
Trio/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift

@@ -47,89 +47,6 @@ extension NightscoutConfig {
                         }
                         }
                     ).listRowBackground(Color.chart)
                     ).listRowBackground(Color.chart)
 
 
-                    Section {
-                        VStack {
-                            Button {
-                                importAlert = Alert(
-                                    title: Text("Import Therapy Settings?"),
-                                    message: Text("Are you sure you want to import profile settings from Nightscout?\n\n")
-                                        + Text("This will overwrite the following Trio therapy settings:\n")
-                                        + Text("• Basal Rates\n")
-                                        + Text("• Insulin Sensitivities\n")
-                                        + Text("• Carb Ratios\n")
-                                        + Text("• Glucose Targets\n")
-                                        + Text("• Duration of Insulin Action"),
-                                    primaryButton: .default(
-                                        Text("Yes, Import!"),
-                                        action: {
-                                            Task {
-                                                await state.importSettings()
-                                                if state.importStatus == .failed, state.importErrors.isNotEmpty,
-                                                   let errorMessage = state.importErrors.first
-                                                {
-                                                    DispatchQueue.main.async {
-                                                        importAlert = Alert(
-                                                            title: Text("Import Failed"),
-                                                            message: Text(errorMessage.description),
-                                                            dismissButton: .default(Text("OK"))
-                                                        )
-                                                        isImportAlertPresented = true
-                                                    }
-                                                }
-                                            }
-                                        }
-                                    ),
-                                    secondaryButton: .cancel()
-                                )
-                                isImportAlertPresented = true
-                            } label: {
-                                Text("Import Settings")
-                                    .font(.title3) }
-                                .frame(maxWidth: .infinity, alignment: .center)
-                                .buttonStyle(.bordered)
-                                .disabled(state.url.isEmpty || state.connecting)
-
-                            HStack(alignment: .center) {
-                                Text(
-                                    "Import therapy settings from Nightscout.\nSee hint for the list of settings available for import."
-                                )
-                                .font(.footnote)
-                                .foregroundColor(.secondary)
-                                .lineLimit(nil)
-                                Spacer()
-                                Button(
-                                    action: {
-                                        hintLabel = String(localized: "Import Settings from Nightscout")
-                                        selectedVerboseHint =
-                                            AnyView(
-                                                VStack(alignment: .leading, spacing: 10) {
-                                                    Text(
-                                                        "This will overwrite the following Trio therapy settings:"
-                                                    )
-                                                    VStack(alignment: .leading) {
-                                                        Text("• Basal Rates")
-                                                        Text("• Insulin Sensitivities")
-                                                        Text("• Carb Ratios")
-                                                        Text("• Glucose Targets")
-                                                        Text("• Duration of Insulin Action")
-                                                    }
-                                                }
-                                            )
-                                        shouldDisplayHint.toggle()
-                                    },
-                                    label: {
-                                        HStack {
-                                            Image(systemName: "questionmark.circle")
-                                        }
-                                    }
-                                ).buttonStyle(BorderlessButtonStyle())
-                                    .alert(isPresented: $isImportAlertPresented) {
-                                        importAlert ?? Alert(title: Text("Unknown Error"))
-                                    }
-                            }.padding(.top)
-                        }.padding(.vertical)
-                    }.listRowBackground(Color.chart)
-
                     Section(
                     Section(
                         content:
                         content:
                         {
                         {
@@ -189,18 +106,7 @@ extension NightscoutConfig {
                     ).listRowBackground(Color.chart)
                     ).listRowBackground(Color.chart)
                 }
                 }
                 .listSectionSpacing(sectionSpacing)
                 .listSectionSpacing(sectionSpacing)
-                .blur(radius: state.importStatus == .running ? 5 : 0)
-
-                if state.importStatus == .running {
-                    CustomProgressView(text: String(
-                        localized: "Importing Profile...",
-                        comment: "Progress text when importing profile via Nightscout"
-                    ))
-                }
             }
             }
-            .fullScreenCover(isPresented: $state.isImportResultReviewPresented, content: {
-                NightscoutImportResultView(resolver: resolver, state: state)
-            })
             .sheet(isPresented: $shouldDisplayHint) {
             .sheet(isPresented: $shouldDisplayHint) {
                 SettingInputHintView(
                 SettingInputHintView(
                     hintDetent: $hintDetent,
                     hintDetent: $hintDetent,

+ 0 - 128
Trio/Sources/Modules/NightscoutConfig/View/ProfileImport/NightscoutImportResultView.swift

@@ -1,128 +0,0 @@
-import SwiftUI
-import Swinject
-
-struct NightscoutImportResultView: BaseView {
-    var resolver: any Swinject.Resolver
-
-    @ObservedObject var state: NightscoutConfig.StateModel
-
-    @State private var shouldDisplayHint: Bool = false
-    @State private var hintDetent = PresentationDetent.large
-    @State private var selectedVerboseHint: String?
-    @State private var hintLabel: String?
-    @State private var decimalPlaceholder: Decimal = 0.0
-    @State private var booleanPlaceholder: Bool = false
-
-    @State private var hasVisitedBasalProfileEditor = false
-    @State private var hasVisitedISFEditor = false
-    @State private var hasVisitedCREditor = false
-    @State private var hasVisitedPumpSettingsEditor = false
-
-    @Environment(\.colorScheme) var colorScheme
-    @Environment(AppState.self) var appState
-
-    private var allViewsVisited: Bool {
-        hasVisitedBasalProfileEditor &&
-            hasVisitedISFEditor &&
-            hasVisitedCREditor &&
-            hasVisitedPumpSettingsEditor
-    }
-
-    var body: some View {
-        NavigationStack {
-            Form {
-                Section(
-                    header: Text("Imported Nightscout Data"),
-                    content: {
-                        Text(
-                            "Trio has successfully imported your default Nightscout profile and stored it as therapy settings. "
-                        ) +
-                            Text("This has replaced your previous therapy settings.").bold().foregroundColor(.accentColor)
-                        Text("Please review the following settings:").bold()
-                    }
-                ).listRowBackground(Color.chart)
-
-                Section {
-                    NavigationLink(
-                        destination: BasalProfileEditor.RootView(resolver: resolver)
-                            .onDisappear { hasVisitedBasalProfileEditor = true }
-                    ) {
-                        HStack {
-                            Text("Basal Rates")
-                            if hasVisitedBasalProfileEditor {
-                                Image(systemName: "checkmark.circle.fill")
-                                    .imageScale(.large)
-                                    .fontWeight(.bold)
-                                    .foregroundStyle(Color.green)
-                            }
-                        }.foregroundColor(hasVisitedBasalProfileEditor ? .secondary : .primary)
-                    }
-
-                    NavigationLink(
-                        destination: ISFEditor.RootView(resolver: resolver)
-                            .onDisappear { hasVisitedISFEditor = true }
-                    ) {
-                        HStack {
-                            Text("Insulin Sensitivities")
-                            if hasVisitedISFEditor {
-                                Image(systemName: "checkmark.circle.fill")
-                                    .imageScale(.large)
-                                    .fontWeight(.bold)
-                                    .foregroundStyle(Color.green)
-                            }
-                        }.foregroundColor(hasVisitedISFEditor ? .secondary : .primary)
-                    }
-
-                    NavigationLink(
-                        destination: CarbRatioEditor.RootView(resolver: resolver)
-                            .onDisappear { hasVisitedCREditor = true }
-                    ) {
-                        HStack {
-                            Text("Carb Ratios")
-                            if hasVisitedCREditor {
-                                Image(systemName: "checkmark.circle.fill")
-                                    .imageScale(.large)
-                                    .fontWeight(.bold)
-                                    .foregroundStyle(Color.green)
-                            }
-                        }.foregroundColor(hasVisitedCREditor ? .secondary : .primary)
-                    }
-
-                    NavigationLink(
-                        destination: ReviewInsulinActionView(resolver: resolver, state: state)
-                            .onDisappear { hasVisitedPumpSettingsEditor = true }
-                    ) {
-                        HStack {
-                            Text("Duration of Insulin Action (DIA)")
-                            if hasVisitedPumpSettingsEditor {
-                                Image(systemName: "checkmark.circle.fill")
-                                    .imageScale(.large)
-                                    .fontWeight(.bold)
-                                    .foregroundStyle(Color.green)
-                            }
-                        }.foregroundColor(hasVisitedPumpSettingsEditor ? .secondary : .primary)
-                    }
-                }.listRowBackground(Color.chart)
-
-                Section {
-                    HStack {
-                        Button {
-                            state.isImportResultReviewPresented = false
-                        } label: {
-                            Text("Finish").font(.title3)
-                        }
-                        .disabled(!allViewsVisited)
-                        .frame(maxWidth: .infinity, alignment: .center)
-                        .tint(.white)
-                    }
-                }.listRowBackground(allViewsVisited ? Color(.systemBlue) : Color(.systemGray4))
-            }
-            .navigationTitle("Review Import")
-            .navigationBarTitleDisplayMode(.large)
-            .scrollContentBackground(.hidden)
-            .background(appState.trioBackgroundColor(for: colorScheme))
-            .interactiveDismissDisabled(true)
-            .screenNavigation(self)
-        }
-    }
-}

+ 0 - 67
Trio/Sources/Modules/NightscoutConfig/View/ProfileImport/ReviewInsulinActionView.swift

@@ -1,67 +0,0 @@
-import Foundation
-
-import SwiftUI
-import Swinject
-
-struct ReviewInsulinActionView: BaseView {
-    var resolver: any Swinject.Resolver
-
-    @ObservedObject var state: NightscoutConfig.StateModel
-
-    @State private var shouldDisplayHint: Bool = false
-    @State private var hintDetent = PresentationDetent.large
-    @State private var selectedVerboseHint: AnyView?
-    @State private var hintLabel: String?
-    @State private var decimalPlaceholder: Decimal = 0.0
-    @State private var booleanPlaceholder: Bool = false
-
-    @Environment(\.colorScheme) var colorScheme
-    @Environment(AppState.self) var appState
-
-    var body: some View {
-        List {
-            SettingInputSection(
-                decimalValue: $state.importedInsulinActionCurve,
-                booleanValue: $booleanPlaceholder,
-                shouldDisplayHint: $shouldDisplayHint,
-                selectedVerboseHint: Binding(
-                    get: { selectedVerboseHint },
-                    set: {
-                        selectedVerboseHint = $0.map { AnyView($0) }
-                        hintLabel = String(localized: "Duration of Insulin Action")
-                    }
-                ),
-                units: state.units,
-                type: .decimal("dia"),
-                label: String(localized: "Duration of Insulin Action"),
-                miniHint: String(localized: "Number of hours insulin is active in your body."),
-                verboseHint:
-                VStack(alignment: .leading, spacing: 10) {
-                    Text("Default: 10 hours").bold()
-                    Text("Number of hours insulin will contribute to IOB after dosing.")
-                    Text(
-                        "Tip: It is better to use a Custom Peak Time than to adjust Duration of Insulin Action (DIA)."
-                    )
-                },
-                headerText: String(localized: "Review imported DIA")
-            )
-        }
-        .sheet(isPresented: $shouldDisplayHint) {
-            SettingInputHintView(
-                hintDetent: $hintDetent,
-                shouldDisplayHint: $shouldDisplayHint,
-                hintLabel: hintLabel ?? "",
-                hintText: selectedVerboseHint ?? AnyView(EmptyView()),
-                sheetTitle: String(localized: "Help", comment: "Help sheet title")
-            )
-        }
-        .scrollContentBackground(.hidden)
-        .background(appState.trioBackgroundColor(for: colorScheme))
-        .onAppear(perform: configureView)
-        .navigationTitle("Duration of Insulin Action")
-        .navigationBarTitleDisplayMode(.automatic)
-        .onDisappear {
-            state.saveReviewedInsulinAction()
-        }
-    }
-}