Przeglądaj źródła

Merge branch 'dev' of github.com:nightscout/Trio into backdatingCarbs

Marvin Polscheit 1 rok temu
rodzic
commit
9e953f5adb

+ 7 - 1
.github/workflows/auto_version_dev.yml

@@ -25,7 +25,11 @@
 # - Second push to `dev`:     → `APP_DEV_VERSION = 0.5.0.2`
 # - ...
 #
+# Commit Handling:
 # The updated value is committed and pushed back to the `dev` branch.
+# - The bump commit includes the `[skip ci]` tag in its message
+# - This prevents the workflow from re-triggering itself in a loop
+# 
 #
 # Prerequisites:
 # - `APP_VERSION` must be present in `Config.xcconfig` in the form `x.y.z`
@@ -49,6 +53,8 @@ jobs:
     steps:
       - name: Checkout repo
         uses: actions/checkout@v4
+        with:
+         token: ${{ secrets.TRIO_TOKEN_AUTOBUMP }}
 
       - name: Set up Git
         run: |
@@ -96,5 +102,5 @@ jobs:
       - name: Commit and push updated dev version
         run: |
           git add Config.xcconfig
-          git commit -m "CI: Bump APP_DEV_VERSION to $NEW_DEV_VERSION"
+          git commit -m "CI: Bump APP_DEV_VERSION to $NEW_DEV_VERSION [skip ci]"
           git push

+ 2 - 2
Config.xcconfig

@@ -1,6 +1,6 @@
 APP_DISPLAY_NAME = Trio
-APP_VERSION = 0.4.1
-APP_DEV_VERSION = 0.4.1.9
+APP_VERSION = 0.5.0
+APP_DEV_VERSION = 0.5.0.3
 APP_BUILD_NUMBER = 1
 COPYRIGHT_NOTICE =
 DEVELOPER_TEAM = ##TEAM_ID##

Plik diff jest za duży
+ 359 - 359
Trio/Sources/Localizations/Main/Localizable.xcstrings


+ 25 - 4
Trio/Sources/Modules/Onboarding/View/OnboardingSteps/BluetoothPermissionStepView.swift

@@ -69,6 +69,15 @@ struct BluetoothPermissionStepView: View {
                 allowTitle: String(localized: "Allow"),
                 denyTitle: String(localized: "Don’t Allow"),
                 onAllow: {
+                    /// Requests Bluetooth permission and updates onboarding state based on the system’s response.
+                    /// It calls `authorizeBluetooth`, which initializes `CBCentralManager` and triggers the
+                    /// native system permission prompt (if not previously shown).
+                    ///
+                    /// The resulting authorization is checked — if the user grants permission (`.authorized`),
+                    /// `hasBluetoothGranted` is set to `true`, allowing the app to proceed with Bluetooth operations.
+                    /// Otherwise, it remains `false`, and the user can be guided to manually enable Bluetooth later.
+                    ///
+                    /// This ensures the app only treats Bluetooth as granted when the system confirms it.
                     bluetoothManager.authorizeBluetooth { auth in
                         DispatchQueue.main.async {
                             state.hasBluetoothGranted = (auth == .authorized)
@@ -80,10 +89,22 @@ struct BluetoothPermissionStepView: View {
                     }
                 },
                 onDeny: {
-                    state.hasBluetoothGranted = false
-                    state.shouldDisplayBluetoothRequestAlert = false
-                    if let next = currentStep.wrappedValue.next {
-                        currentStep.wrappedValue = next
+                    /// Requests Bluetooth permission and updates onboarding state based on the system’s response.
+                    /// Although `authorizeBluetooth` is still called (to ensure iOS shows the app under
+                    /// Settings > Privacy & Security > Bluetooth), the app forcibly sets `hasBluetoothGranted` to `false`
+                    /// regardless of the system-reported authorization status.
+                    ///
+                    /// This ensures the app tracks user intent correctly (denial),
+                    /// while still letting the system recognize Bluetooth usage,
+                    /// so users can later re-enable it manually in iOS Settings.
+                    bluetoothManager.authorizeBluetooth { _ in
+                        DispatchQueue.main.async {
+                            state.hasBluetoothGranted = false
+                            state.shouldDisplayBluetoothRequestAlert = false
+                            if let next = currentStep.wrappedValue.next {
+                                currentStep.wrappedValue = next
+                            }
+                        }
                     }
                 }
             )