From 7bdf3d343aaf29792cd38b610b6db5d7179e56f1 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Mon, 16 Nov 2026 14:46:00 -0800 Subject: [PATCH 1/7] chore: [SDK-5587] sign iOS demo with enterprise team and sdkdemo IDs Move the demo to the OneSignal, Inc. Enterprise team (DL8TF3X4K3) so BrowserStack can run in-house builds, and rename identifiers from com.onesignal.example to com.onesignal.sdkdemo (main, NSE, LA, App Group). Release signs with the in-house distribution identity and exports with method enterprise. Co-Authored-By: Claude Opus 5.5 --- examples/demo/App.entitlements | 2 +- examples/demo/App.xcodeproj/project.pbxproj | 48 +++++++++---------- examples/demo/App/Info.plist | 2 +- examples/demo/ExportOptions.plist | 10 ++-- .../Info.plist | 2 +- ...lNotificationServiceExtension.entitlements | 2 +- examples/demo/README.md | 2 +- examples/demo/build.md | 4 +- examples/demo/project.yml | 26 +++++----- examples/demo/scripts/retry/retry-test.sh | 2 +- 10 files changed, 50 insertions(+), 50 deletions(-) diff --git a/examples/demo/App.entitlements b/examples/demo/App.entitlements index 3446364950..6a1199ae75 100644 --- a/examples/demo/App.entitlements +++ b/examples/demo/App.entitlements @@ -6,7 +6,7 @@ development com.apple.security.application-groups - group.com.onesignal.example.onesignal + group.com.onesignal.sdkdemo.onesignal diff --git a/examples/demo/App.xcodeproj/project.pbxproj b/examples/demo/App.xcodeproj/project.pbxproj index 3306f20516..836132cf99 100644 --- a/examples/demo/App.xcodeproj/project.pbxproj +++ b/examples/demo/App.xcodeproj/project.pbxproj @@ -370,7 +370,7 @@ E194A3F19072CB17A8F1A12E /* SmsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmsSection.swift; sourceTree = ""; }; ECAC7EF0B67920F9FEC4F129 /* TagsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsSection.swift; sourceTree = ""; }; F46DFACB9F304B9374F3C570 /* ToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastView.swift; sourceTree = ""; }; - "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Build.xcconfig; sourceTree = ""; }; + "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Build.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -591,10 +591,10 @@ path = Support; sourceTree = ""; }; - "TEMP_17E43425-D1F7-4A88-B0A0-C0368CB0E171" /* demo */ = { + "TEMP_8BEE1241-4ECD-4578-B51C-4BA33D298337" /* demo */ = { isa = PBXGroup; children = ( - "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */, + "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */, ); path = demo; sourceTree = ""; @@ -968,15 +968,15 @@ /* Begin XCBuildConfiguration section */ 0D2EF3911CA89837C30DB0D1 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; - DEVELOPMENT_TEAM = 99SW8E36CT; + DEVELOPMENT_TEAM = DL8TF3X4K3; INFOPLIST_FILE = OneSignalWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.LA; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.sdkdemo.LA; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -986,17 +986,17 @@ }; 4A0C935808978B5A7673E412 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = App.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = 99SW8E36CT; + DEVELOPMENT_TEAM = DL8TF3X4K3; ENABLE_USER_SCRIPT_SANDBOXING = NO; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.sdkdemo; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h"; @@ -1069,17 +1069,17 @@ }; D0E56A85F1C385808720F94B /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 99SW8E36CT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = DL8TF3X4K3; INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.NSE; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.sdkdemo.NSE; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Appium Demo - NSE"; @@ -1091,19 +1091,19 @@ }; EB1CC3A930E09FEBECF9195D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = App.entitlements; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 99SW8E36CT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = DL8TF3X4K3; ENABLE_USER_SCRIPT_SANDBOXING = NO; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.sdkdemo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Appium Demo - Main"; @@ -1115,18 +1115,18 @@ }; F305A3E63851EE49DA2D190E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 99SW8E36CT; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = DL8TF3X4K3; INFOPLIST_FILE = OneSignalWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.LA; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.sdkdemo.LA; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Appium Demo - Live Activity"; @@ -1138,14 +1138,14 @@ }; F5FD25168D9B32A08A468069 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; - DEVELOPMENT_TEAM = 99SW8E36CT; + DEVELOPMENT_TEAM = DL8TF3X4K3; INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.NSE; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.sdkdemo.NSE; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; diff --git a/examples/demo/App/Info.plist b/examples/demo/App/Info.plist index 5138a7d3f0..265e26346a 100644 --- a/examples/demo/App/Info.plist +++ b/examples/demo/App/Info.plist @@ -27,7 +27,7 @@ NSLocationAlwaysAndWhenInUseUsageDescription This app uses your location to personalize notifications and content even when the app is in the background. OneSignal_app_groups_key - group.com.onesignal.example.onesignal + group.com.onesignal.sdkdemo.onesignal NSSupportsLiveActivities NSSupportsLiveActivitiesFrequentUpdates diff --git a/examples/demo/ExportOptions.plist b/examples/demo/ExportOptions.plist index b7361222ea..4e5feeb270 100644 --- a/examples/demo/ExportOptions.plist +++ b/examples/demo/ExportOptions.plist @@ -3,20 +3,20 @@ method - development + enterprise teamID - 99SW8E36CT + DL8TF3X4K3 signingStyle manual stripSwiftSymbols provisioningProfiles - com.onesignal.example + com.onesignal.sdkdemo Appium Demo - Main - com.onesignal.example.NSE + com.onesignal.sdkdemo.NSE Appium Demo - NSE - com.onesignal.example.LA + com.onesignal.sdkdemo.LA Appium Demo - Live Activity diff --git a/examples/demo/OneSignalNotificationServiceExtension/Info.plist b/examples/demo/OneSignalNotificationServiceExtension/Info.plist index 19587da714..a24b7ab723 100644 --- a/examples/demo/OneSignalNotificationServiceExtension/Info.plist +++ b/examples/demo/OneSignalNotificationServiceExtension/Info.plist @@ -21,7 +21,7 @@ CFBundleVersion 1 OneSignal_app_groups_key - group.com.onesignal.example.onesignal + group.com.onesignal.sdkdemo.onesignal NSExtension NSExtensionPointIdentifier diff --git a/examples/demo/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements b/examples/demo/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements index c70461e82d..68ed0e5070 100644 --- a/examples/demo/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements +++ b/examples/demo/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements @@ -4,7 +4,7 @@ com.apple.security.application-groups - group.com.onesignal.example.onesignal + group.com.onesignal.sdkdemo.onesignal diff --git a/examples/demo/README.md b/examples/demo/README.md index f12022972c..de60b67445 100644 --- a/examples/demo/README.md +++ b/examples/demo/README.md @@ -92,7 +92,7 @@ xcodegen generate # rewrites App.xcodeproj ### 3. Capabilities & App Group -The shipped `App.entitlements` and `OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements` use `group.com.onesignal.example.onesignal`. Both targets also set `OneSignal_app_groups_key` to this value because Catalyst derives a `maccatalyst.*` bundle identifier that would otherwise produce a different default group name. If you need a different group (for example to install on a real device under your own team), change the value in both entitlements and both Info.plists to the same string. The other capabilities (Push Notifications, Remote notifications background mode, `NSSupportsLiveActivities`) are already declared in the entitlements / `App/Info.plist`. +The shipped `App.entitlements` and `OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements` use `group.com.onesignal.sdkdemo.onesignal`. Both targets also set `OneSignal_app_groups_key` to this value because Catalyst derives a `maccatalyst.*` bundle identifier that would otherwise produce a different default group name. If you need a different group (for example to install on a real device under your own team), change the value in both entitlements and both Info.plists to the same string. The other capabilities (Push Notifications, Remote notifications background mode, `NSSupportsLiveActivities`) are already declared in the entitlements / `App/Info.plist`. ### 4. Configure your OneSignal credentials diff --git a/examples/demo/build.md b/examples/demo/build.md index d3277eee39..7f567b7d2e 100644 --- a/examples/demo/build.md +++ b/examples/demo/build.md @@ -173,7 +173,7 @@ override func serviceExtensionTimeWillExpire() { } ``` -The NSE entitlements file (`OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements`) **must** declare the same `com.apple.security.application-groups` value as the main app — both ship with `group.com.onesignal.example.onesignal`. If you change the group to install on a real device under your own team, change it in BOTH files to the same string. +The NSE entitlements file (`OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements`) **must** declare the same `com.apple.security.application-groups` value as the main app — both ship with `group.com.onesignal.sdkdemo.onesignal`. If you change the group to install on a real device under your own team, change it in BOTH files to the same string. ### Widget Extension (Live Activities) @@ -194,7 +194,7 @@ The widget target's deployment target is `16.2` (project-wide is `16.0`) because development com.apple.security.application-groups - group.com.onesignal.example.onesignal + group.com.onesignal.sdkdemo.onesignal ``` diff --git a/examples/demo/project.yml b/examples/demo/project.yml index 22f5b3842d..50b6334f95 100644 --- a/examples/demo/project.yml +++ b/examples/demo/project.yml @@ -1,6 +1,6 @@ name: App options: - bundleIdPrefix: com.onesignal.example + bundleIdPrefix: com.onesignal.sdkdemo deploymentTarget: iOS: "16.0" developmentLanguage: en @@ -55,7 +55,7 @@ targets: settings: base: PRODUCT_NAME: "$(TARGET_NAME)" - PRODUCT_BUNDLE_IDENTIFIER: com.onesignal.example + PRODUCT_BUNDLE_IDENTIFIER: com.onesignal.sdkdemo INFOPLIST_FILE: App/Info.plist CODE_SIGN_ENTITLEMENTS: App.entitlements TARGETED_DEVICE_FAMILY: "1,2" @@ -64,12 +64,12 @@ targets: SWIFT_OBJC_BRIDGING_HEADER: App/App-Bridging-Header.h configs: Debug: - DEVELOPMENT_TEAM: 99SW8E36CT + DEVELOPMENT_TEAM: DL8TF3X4K3 Release: - CODE_SIGN_IDENTITY: "iPhone Developer" + CODE_SIGN_IDENTITY: "iPhone Distribution" CODE_SIGN_STYLE: Manual DEVELOPMENT_TEAM: "" - "DEVELOPMENT_TEAM[sdk=iphoneos*]": 99SW8E36CT + "DEVELOPMENT_TEAM[sdk=iphoneos*]": DL8TF3X4K3 PROVISIONING_PROFILE_SPECIFIER: "" "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]": "Appium Demo - Main" dependencies: @@ -130,7 +130,7 @@ targets: settings: base: PRODUCT_NAME: "$(TARGET_NAME)" - PRODUCT_BUNDLE_IDENTIFIER: com.onesignal.example.NSE + PRODUCT_BUNDLE_IDENTIFIER: com.onesignal.sdkdemo.NSE INFOPLIST_FILE: OneSignalNotificationServiceExtension/Info.plist CODE_SIGN_ENTITLEMENTS: OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements TARGETED_DEVICE_FAMILY: "1,2" @@ -138,12 +138,12 @@ targets: SKIP_INSTALL: YES configs: Debug: - DEVELOPMENT_TEAM: 99SW8E36CT + DEVELOPMENT_TEAM: DL8TF3X4K3 Release: - "CODE_SIGN_IDENTITY[sdk=iphoneos*]": "iPhone Developer" + "CODE_SIGN_IDENTITY[sdk=iphoneos*]": "iPhone Distribution" CODE_SIGN_STYLE: Manual DEVELOPMENT_TEAM: "" - "DEVELOPMENT_TEAM[sdk=iphoneos*]": 99SW8E36CT + "DEVELOPMENT_TEAM[sdk=iphoneos*]": DL8TF3X4K3 PROVISIONING_PROFILE_SPECIFIER: "" "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]": "Appium Demo - NSE" dependencies: @@ -172,7 +172,7 @@ targets: settings: base: PRODUCT_NAME: "$(TARGET_NAME)" - PRODUCT_BUNDLE_IDENTIFIER: com.onesignal.example.LA + PRODUCT_BUNDLE_IDENTIFIER: com.onesignal.sdkdemo.LA INFOPLIST_FILE: OneSignalWidget/Info.plist TARGETED_DEVICE_FAMILY: "1,2" LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks" @@ -181,12 +181,12 @@ targets: ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME: WidgetBackground configs: Debug: - DEVELOPMENT_TEAM: 99SW8E36CT + DEVELOPMENT_TEAM: DL8TF3X4K3 Release: - "CODE_SIGN_IDENTITY[sdk=iphoneos*]": "iPhone Developer" + "CODE_SIGN_IDENTITY[sdk=iphoneos*]": "iPhone Distribution" CODE_SIGN_STYLE: Manual DEVELOPMENT_TEAM: "" - "DEVELOPMENT_TEAM[sdk=iphoneos*]": 99SW8E36CT + "DEVELOPMENT_TEAM[sdk=iphoneos*]": DL8TF3X4K3 PROVISIONING_PROFILE_SPECIFIER: "" "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]": "Appium Demo - Live Activity" dependencies: diff --git a/examples/demo/scripts/retry/retry-test.sh b/examples/demo/scripts/retry/retry-test.sh index 1f553c858d..81372579b5 100755 --- a/examples/demo/scripts/retry/retry-test.sh +++ b/examples/demo/scripts/retry/retry-test.sh @@ -16,7 +16,7 @@ PORT="${RETRY_TEST_PORT:-8899}" # network extension approved once, but leaves the Mac's proxy alone. # `manual` only listens; point a physical device's Wi-Fi proxy at this Mac yourself. PROXY_MODE="${RETRY_TEST_PROXY_MODE:-system}" -BUNDLE_ID="${RETRY_TEST_BUNDLE_ID:-com.onesignal.example}" +BUNDLE_ID="${RETRY_TEST_BUNDLE_ID:-com.onesignal.sdkdemo}" # Other demos (Cordova, Capacitor, ...) share the bundle ID, so give the harness its own simulator. DEVICE_NAME="${RETRY_TEST_DEVICE:-OneSignal Retry Test}" IV_APP_ID="${RETRY_TEST_IV_APP_ID:-}" From 2736a7778a673b284595c8423baae65695a3d3cc Mon Sep 17 00:00:00 2001 From: Fadi George Date: Mon, 16 Nov 2026 16:29:35 -0800 Subject: [PATCH 2/7] fix: [SDK-5587] keep demo dialogs fixed while the keyboard is open Dialogs slid up when the keyboard appeared, but XCUITest kept reporting the old frames, so Appium taps on dialog buttons (e.g. "+ Add" in Add Multiple Tags) missed. Anchor dialogs near the top and ignore the keyboard safe area so they never move while open. Co-Authored-By: Claude Opus 5.5 --- .../demo/App/Views/Components/OSDialog.swift | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/examples/demo/App/Views/Components/OSDialog.swift b/examples/demo/App/Views/Components/OSDialog.swift index c591dcb6a1..e32598535a 100644 --- a/examples/demo/App/Views/Components/OSDialog.swift +++ b/examples/demo/App/Views/Components/OSDialog.swift @@ -196,7 +196,7 @@ struct OSTextEditor: View { // MARK: - Centered dialog presentation extension View { - /// Presents `content` as a centered modal dialog over the entire screen, + /// Presents `content` as a modal dialog near the top of the screen, /// matching the styles.md "Dialogs" spec: 54% black backdrop, 16pt /// horizontal / 24pt vertical insets, 28pt corner radius, white card. /// Tapping the backdrop dismisses. @@ -228,10 +228,18 @@ private struct OSCenteredDialogModifier: ViewModifier { .contentShape(Rectangle()) .onTapGesture { isPresented = false } - dialog() - .clipShape(RoundedRectangle(cornerRadius: OS.Radius.modal)) - .padding(.horizontal, 16) - .padding(.vertical, 24) + // Top-anchored and keyboard-insensitive so the dialog never moves + // while open. When it slid up for the keyboard, XCUITest kept + // reporting the pre-keyboard frames, so Appium taps on dialog + // buttons landed on empty space. + VStack(spacing: 0) { + dialog() + .clipShape(RoundedRectangle(cornerRadius: OS.Radius.modal)) + .padding(.horizontal, 16) + .padding(.vertical, 24) + Spacer(minLength: 0) + } + .ignoresSafeArea(.keyboard) } .background(ClearBackgroundView()) } From 87aa32bd5152b1b4b51e5f1b357b15bbacbeecab Mon Sep 17 00:00:00 2001 From: Fadi George Date: Mon, 16 Nov 2026 17:02:30 -0800 Subject: [PATCH 3/7] fix: [SDK-5587] size demo dialogs to their content With dialogs pinned and ignoring the keyboard, the Track Event JSON editor expanded to fill the screen and pushed the Track button under the keyboard on iOS 26. Co-Authored-By: Claude Opus 5.5 --- examples/demo/App/Views/Components/OSDialog.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/demo/App/Views/Components/OSDialog.swift b/examples/demo/App/Views/Components/OSDialog.swift index e32598535a..f4d39d0f24 100644 --- a/examples/demo/App/Views/Components/OSDialog.swift +++ b/examples/demo/App/Views/Components/OSDialog.swift @@ -231,9 +231,12 @@ private struct OSCenteredDialogModifier: ViewModifier { // Top-anchored and keyboard-insensitive so the dialog never moves // while open. When it slid up for the keyboard, XCUITest kept // reporting the pre-keyboard frames, so Appium taps on dialog - // buttons landed on empty space. + // buttons landed on empty space. `fixedSize` keeps flexible content + // (e.g. TextEditor) at its natural height so the action buttons + // stay above the keyboard instead of being pushed under it. VStack(spacing: 0) { dialog() + .fixedSize(horizontal: false, vertical: true) .clipShape(RoundedRectangle(cornerRadius: OS.Radius.modal)) .padding(.horizontal, 16) .padding(.vertical, 24) From c0e0c39803846eae64c2e6d787688885e6b561c0 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Tue, 17 Nov 2026 10:23:00 -0800 Subject: [PATCH 4/7] chore: [SDK-5587] per-config aps-environment and overridable debug team Set aps-environment from APS_ENVIRONMENT (development for Debug, production for Release) so it matches the In House profiles. Scope the App Release signing identity to iphoneos like the extensions. Move the Debug team default into Build.xcconfig so Local.xcconfig can override it. Document Release signing in build.md. Co-Authored-By: Claude Opus 5.5 --- examples/demo/App.entitlements | 2 +- examples/demo/App.xcodeproj/project.pbxproj | 26 +++++++++---------- examples/demo/Build.xcconfig | 4 +++ examples/demo/build.md | 28 +++++++++++++++------ examples/demo/project.yml | 9 +++---- 5 files changed, 41 insertions(+), 28 deletions(-) diff --git a/examples/demo/App.entitlements b/examples/demo/App.entitlements index 6a1199ae75..4542af378b 100644 --- a/examples/demo/App.entitlements +++ b/examples/demo/App.entitlements @@ -3,7 +3,7 @@ aps-environment - development + $(APS_ENVIRONMENT) com.apple.security.application-groups group.com.onesignal.sdkdemo.onesignal diff --git a/examples/demo/App.xcodeproj/project.pbxproj b/examples/demo/App.xcodeproj/project.pbxproj index 836132cf99..a63cfa158d 100644 --- a/examples/demo/App.xcodeproj/project.pbxproj +++ b/examples/demo/App.xcodeproj/project.pbxproj @@ -370,7 +370,7 @@ E194A3F19072CB17A8F1A12E /* SmsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmsSection.swift; sourceTree = ""; }; ECAC7EF0B67920F9FEC4F129 /* TagsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsSection.swift; sourceTree = ""; }; F46DFACB9F304B9374F3C570 /* ToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastView.swift; sourceTree = ""; }; - "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Build.xcconfig; sourceTree = ""; }; + "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Build.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -591,10 +591,10 @@ path = Support; sourceTree = ""; }; - "TEMP_8BEE1241-4ECD-4578-B51C-4BA33D298337" /* demo */ = { + "TEMP_915DBED0-7714-4B53-A845-B8138FF5BA7F" /* demo */ = { isa = PBXGroup; children = ( - "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */, + "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */, ); path = demo; sourceTree = ""; @@ -968,11 +968,10 @@ /* Begin XCBuildConfiguration section */ 0D2EF3911CA89837C30DB0D1 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; - DEVELOPMENT_TEAM = DL8TF3X4K3; INFOPLIST_FILE = OneSignalWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; @@ -986,12 +985,12 @@ }; 4A0C935808978B5A7673E412 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */; buildSettings = { + APS_ENVIRONMENT = development; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = App.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = DL8TF3X4K3; ENABLE_USER_SCRIPT_SANDBOXING = NO; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1069,7 +1068,7 @@ }; D0E56A85F1C385808720F94B /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; @@ -1091,11 +1090,13 @@ }; EB1CC3A930E09FEBECF9195D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */; buildSettings = { + APS_ENVIRONMENT = production; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = App.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = DL8TF3X4K3; @@ -1115,7 +1116,7 @@ }; F305A3E63851EE49DA2D190E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; @@ -1138,10 +1139,9 @@ }; F5FD25168D9B32A08A468069 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_BD02E944-8110-4FDA-8C52-6487D8A749AD" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; - DEVELOPMENT_TEAM = DL8TF3X4K3; INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; diff --git a/examples/demo/Build.xcconfig b/examples/demo/Build.xcconfig index 8db97b911b..e799b90733 100644 --- a/examples/demo/Build.xcconfig +++ b/examples/demo/Build.xcconfig @@ -5,4 +5,8 @@ // optional include below is a no-op when the file is missing, so a fresh // clone builds without further setup. See `Local.xcconfig.example`. +// Debug signing team. Release pins its own team and In House profiles in +// project.yml. +DEVELOPMENT_TEAM = DL8TF3X4K3 + #include? "Local.xcconfig" diff --git a/examples/demo/build.md b/examples/demo/build.md index 7f567b7d2e..65f782b7df 100644 --- a/examples/demo/build.md +++ b/examples/demo/build.md @@ -37,7 +37,7 @@ Open `iOS_SDK/OneSignalSDK.xcworkspace`, select the **App** scheme, and run. The Per-developer build settings and OneSignal credentials are split across two layers, both wired into XcodeGen via `project.yml`: -- `Build.xcconfig` -- root xcconfig referenced by every target's `configFiles: { Debug, Release }`. It only does `#include? "Local.xcconfig"`, so a fresh clone builds with no extra setup. +- `Build.xcconfig` -- root xcconfig referenced by every target's `configFiles: { Debug, Release }`. It sets the default Debug `DEVELOPMENT_TEAM` (`DL8TF3X4K3`) and then does `#include? "Local.xcconfig"`, so a fresh clone builds with no extra setup. - `Local.xcconfig` (gitignored) -- per-developer overrides such as `DEVELOPMENT_TEAM`, `CODE_SIGN_STYLE`, and `PROVISIONING_PROFILE_SPECIFIER`. Anything set here survives `xcodegen generate`. See `Local.xcconfig.example` for the template. - `App/Secrets.plist` (gitignored, `optional: true` in `project.yml`) -- `` with `ONESIGNAL_APP_ID` and `ONESIGNAL_API_KEY` strings. Parsed at runtime by `App/Services/SecretsConfig.swift`. Bundled via an explicit `buildPhase: resources` source entry because XcodeGen otherwise treats `.plist` files as Info.plist-like and skips Copy Bundle Resources. - `App/vine_boom.wav` (gitignored optional) -- bundled custom notification sound; XcodeGen picks it up automatically from the `App/` source path. @@ -59,7 +59,7 @@ The only manual step is running `xcodegen generate` after editing `project.yml`. Use a single `OneSignalViewModel` (`App/ViewModels/OneSignalViewModel.swift`) as the central state manager. There is no repository wrapper -- the view-model calls the OneSignal SDK directly through a thin `OneSignalService` singleton (`App/Services/OneSignalService.swift`). - `@MainActor final class OneSignalViewModel: ObservableObject` with `@Published` properties for reactive state (app id, push subscription id and token, aliases, tags, emails, SMS, triggers, consent, location, IAM paused, `isLoading`) -- The only `@Published` UI overlay state is `activeTooltip: TooltipData?`. Action dialogs are NOT in the view-model -- each section owns its own `@State` boolean and binds `.osCenteredDialog(isPresented:)` locally +- The only `@Published` UI overlay state is `activeTooltip: TooltipData?`. Action dialogs are NOT in the view-model -- each section owns its own `@State` boolean and binds `.osDialog(isPresented:)` locally - `init` calls `refreshState()` and the private `setupObservers()`, which registers `OSPushSubscriptionObserver`, `OSUserStateObserver`, and `OSNotificationPermissionObserver`. SwiftUI keeps the view-model alive for the app lifetime via `@StateObject` in `App.swift`, so no manual teardown is needed - `OneSignalService` (singleton, `App/Services/OneSignalService.swift`) funnels every SDK call through one entry point and mirrors any setters the SDK doesn't expose as getters (consent flags) into `UserDefaults` - `NotificationSender` (singleton, `App/Services/NotificationSender.swift`) wraps the `/notifications` REST endpoint with `URLSession` and retries with exponential backoff when the API returns 200 with empty `id` / `recipients == 0` / a non-empty `errors` payload (transient race between subscription create and notification fan-out) @@ -121,10 +121,10 @@ Push subscription id, opt-in, notification permission, and the live `OneSignal.U ### Dialogs -- Tooltip state lives on the view model as `@Published var activeTooltip: TooltipData?`. `ContentView` owns layout only and binds the tooltip dialog via `viewModel.activeTooltip` / `viewModel.dismissTooltip()` attached with `.osCenteredDialog`. Sections call `viewModel.showTooltip(for:)` from info icons. -- Sections declare `@State` booleans for their action dialogs (`@State private var addOpen = false`, `@State private var loginOpen = false`, ...) and attach `.osCenteredDialog(isPresented: $addOpen) { AddItemDialog(...) }` on the section view. Dialog confirm handlers call ViewModel SDK methods and (where applicable) `toast.show(...)`. +- Tooltip state lives on the view model as `@Published var activeTooltip: TooltipData?`. `ContentView` owns layout only and binds the tooltip dialog via `viewModel.activeTooltip` / `viewModel.dismissTooltip()` attached with `.osDialog`. Sections call `viewModel.showTooltip(for:)` from info icons. +- Sections declare `@State` booleans for their action dialogs (`@State private var addOpen = false`, `@State private var loginOpen = false`, ...) and attach `.osDialog(isPresented: $addOpen) { AddItemDialog(...) }` on the section view. Dialog confirm handlers call ViewModel SDK methods and (where applicable) `toast.show(...)`. - `OneSignalViewModel` must not hold any action dialog visibility flags or dialog input drafts. -- `osCenteredDialog` (in `App/Views/Components/OSDialog.swift`) is implemented on top of `.fullScreenCover` with a `ClearBackgroundView` (`UIViewRepresentable`) so the dialog presents at the window level instead of being clipped to the section's frame inside `ScrollView`. The default slide-up animation is suppressed via `.transaction { $0.disablesAnimations = true }` so the dialog's own fade-in is preserved. +- `osDialog` (in `App/Views/Components/OSDialog.swift`) is implemented on top of `.fullScreenCover` with a `ClearBackgroundView` (`UIViewRepresentable`) so the dialog presents at the window level instead of being clipped to the section's frame inside `ScrollView`. The card is top-anchored and ignores the keyboard so it never moves while open (XCUITest otherwise reports stale frames). Dialog content must have a bounded height (fixed-height `OSTextEditor`, `ScrollView` + `maxHeight` for lists) so the action row stays on screen. The default slide-up animation is suppressed via `.transaction { $0.disablesAnimations = true }` so the dialog's own fade-in is preserved. - Shared dialog primitives live in `App/Views/Components/`: `AddItemDialog` (typed via `AddItemType` -- single-field and pair layouts both flow through it), `MultiPairInputDialog`, `RemoveMultiDialog`, `OutcomeDialog`, `CustomNotificationDialog`, `TrackEventDialog`, `TooltipDialog`. Sections import and compose them locally. ### Accessibility (Appium) @@ -191,15 +191,26 @@ The widget target's deployment target is `16.2` (project-wide is `16.0`) because ```xml aps-environment -development +$(APS_ENVIRONMENT) com.apple.security.application-groups group.com.onesignal.sdkdemo.onesignal ``` +`APS_ENVIRONMENT` is set per configuration in `project.yml`: `development` for Debug, `production` for Release (In House profiles only carry production). + `OneSignalNotificationServiceExtension.entitlements` mirrors the same app group. Both must match or rich pushes fail silently. +### Release signing + +Release builds are signed for enterprise (In House) distribution so the Appium suite can run push tests on BrowserStack real devices. + +- Team `DL8TF3X4K3` (OneSignal, Inc. Apple Developer Enterprise Program), identity `iPhone Distribution`, manual signing. All Release signing settings are scoped to `[sdk=iphoneos*]`. +- Provisioning profiles (type In House, created at developer.apple.com > Profiles with the in-house distribution certificate): `Appium Demo - Main` (`com.onesignal.sdkdemo`), `Appium Demo - NSE` (`com.onesignal.sdkdemo.NSE`), `Appium Demo - Live Activity` (`com.onesignal.sdkdemo.LA`). In House profiles need no registered devices. +- `ExportOptions.plist` exports with method `enterprise` and maps each bundle id to its profile. +- When uploading to BrowserStack App Automate, set `resignApp: false`; BrowserStack re-signing breaks push delivery. + ### Info.plist `App/Info.plist` declares: @@ -240,9 +251,10 @@ The iOS demo does NOT use a `.env` file. Instead, `App/Services/SecretsConfig.sw examples/demo/ ├── App.xcodeproj # Generated by `xcodegen generate` ├── project.yml # XcodeGen project definition +├── ExportOptions.plist # Enterprise export (In House profiles) ├── App.entitlements # aps-environment + app group ├── Build.xcconfig # Root xcconfig wired into every target; -│ # only does `#include? "Local.xcconfig"` +│ # Debug team + `#include? "Local.xcconfig"` ├── Local.xcconfig.example # Per-developer overrides template │ # (DEVELOPMENT_TEAM, CODE_SIGN_STYLE, ...) ├── build.md # This file @@ -316,7 +328,7 @@ examples/demo/ │ │ # MoreLink. No LoadingState / CollapsibleList │ ├── KeyValueRow.swift # Filename vs type name differ -- type is │ │ # `InfoRow` (currently unused in demo) -│ ├── OSDialog.swift # osCenteredDialog modifier + ClearBackgroundView +│ ├── OSDialog.swift # osDialog modifier + ClearBackgroundView │ ├── AddItemDialog.swift # Single + Pair input dialogs (typed via AddItemType) │ ├── MultiPairInputDialog.swift # Bulk add (aliases / tags / triggers) │ ├── RemoveMultiDialog.swift # Bulk remove (tags / triggers) diff --git a/examples/demo/project.yml b/examples/demo/project.yml index 50b6334f95..5c750bbf98 100644 --- a/examples/demo/project.yml +++ b/examples/demo/project.yml @@ -64,9 +64,10 @@ targets: SWIFT_OBJC_BRIDGING_HEADER: App/App-Bridging-Header.h configs: Debug: - DEVELOPMENT_TEAM: DL8TF3X4K3 + APS_ENVIRONMENT: development Release: - CODE_SIGN_IDENTITY: "iPhone Distribution" + APS_ENVIRONMENT: production + "CODE_SIGN_IDENTITY[sdk=iphoneos*]": "iPhone Distribution" CODE_SIGN_STYLE: Manual DEVELOPMENT_TEAM: "" "DEVELOPMENT_TEAM[sdk=iphoneos*]": DL8TF3X4K3 @@ -137,8 +138,6 @@ targets: LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks" SKIP_INSTALL: YES configs: - Debug: - DEVELOPMENT_TEAM: DL8TF3X4K3 Release: "CODE_SIGN_IDENTITY[sdk=iphoneos*]": "iPhone Distribution" CODE_SIGN_STYLE: Manual @@ -180,8 +179,6 @@ targets: ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME: AccentColor ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME: WidgetBackground configs: - Debug: - DEVELOPMENT_TEAM: DL8TF3X4K3 Release: "CODE_SIGN_IDENTITY[sdk=iphoneos*]": "iPhone Distribution" CODE_SIGN_STYLE: Manual From 7eb0bc14d87f45ecc0e186991f9cfeba05a944e0 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Tue, 17 Nov 2026 10:23:00 -0800 Subject: [PATCH 5/7] fix: [SDK-5587] bound demo dialog heights and lay out section buttons in a grid Drop fixedSize from the dialog presenter and give OSTextEditor a fixed height instead, so dialogs stay within the screen in landscape and TooltipDialog's ScrollView fallback works again. Rename osCenteredDialog to osDialog now that dialogs are top-anchored. Add ButtonGrid (two columns, odd last button spans both) and use it for every section with two or more buttons, matching Send In-App Message. Co-Authored-By: Claude Opus 5.5 --- .../App/Views/Components/ActionButton.swift | 45 +++++++++++++ .../App/Views/Components/AddItemDialog.swift | 2 +- .../Components/CustomNotificationDialog.swift | 2 +- .../Components/MultiPairInputDialog.swift | 2 +- .../demo/App/Views/Components/OSDialog.swift | 25 +++---- .../App/Views/Components/OutcomeDialog.swift | 2 +- .../Views/Components/RemoveMultiDialog.swift | 2 +- .../App/Views/Components/TooltipDialog.swift | 4 +- .../Views/Components/TrackEventDialog.swift | 4 +- examples/demo/App/Views/ContentView.swift | 2 +- .../App/Views/Sections/AliasesSection.swift | 16 +++-- .../Views/Sections/CustomEventsSection.swift | 2 +- .../App/Views/Sections/EmailsSection.swift | 2 +- .../Views/Sections/LiveActivitySection.swift | 66 ++++++++++--------- .../App/Views/Sections/LocationSection.swift | 14 ++-- .../App/Views/Sections/OutcomesSection.swift | 2 +- .../App/Views/Sections/SendIamSection.swift | 7 +- .../App/Views/Sections/SendPushSection.swift | 40 +++++------ .../demo/App/Views/Sections/SmsSection.swift | 2 +- .../demo/App/Views/Sections/TagsSection.swift | 34 +++++----- .../App/Views/Sections/TriggersSection.swift | 46 ++++++------- .../demo/App/Views/Sections/UserSection.swift | 42 ++++++------ 22 files changed, 206 insertions(+), 157 deletions(-) diff --git a/examples/demo/App/Views/Components/ActionButton.swift b/examples/demo/App/Views/Components/ActionButton.swift index ca596bb0bf..64ce06c425 100644 --- a/examples/demo/App/Views/Components/ActionButton.swift +++ b/examples/demo/App/Views/Components/ActionButton.swift @@ -110,3 +110,48 @@ struct ActionButton: View { } } } + +/// Lays out section buttons two per row. An odd last button spans both +/// columns. Conditionally hidden buttons drop out, so the grid reflows. +struct ButtonGrid: Layout { + var spacing: CGFloat = OS.Spacing.cardGap + + func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { + let width = proposal.replacingUnspecifiedDimensions().width + let heights = rowHeights(width: width, subviews: subviews) + let gaps = spacing * CGFloat(max(heights.count - 1, 0)) + return CGSize(width: width, height: heights.reduce(0, +) + gaps) + } + + func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) { + let heights = rowHeights(width: bounds.width, subviews: subviews) + var rowTop = bounds.minY + for (row, height) in heights.enumerated() { + for (column, frame) in cellFrames(row: row, width: bounds.width, count: subviews.count).enumerated() { + subviews[row * 2 + column].place( + at: CGPoint(x: bounds.minX + frame.minX, y: rowTop), + proposal: ProposedViewSize(width: frame.width, height: height) + ) + } + rowTop += height + spacing + } + } + + private func rowHeights(width: CGFloat, subviews: Subviews) -> [CGFloat] { + stride(from: 0, to: subviews.count, by: 2).map { first in + cellFrames(row: first / 2, width: width, count: subviews.count) + .enumerated() + .map { column, frame in + subviews[first + column].sizeThatFits(ProposedViewSize(width: frame.width, height: nil)).height + } + .max() ?? 0 + } + } + + /// Horizontal extent of each cell in `row`; one full-width cell for an odd last button. + private func cellFrames(row: Int, width: CGFloat, count: Int) -> [(minX: CGFloat, width: CGFloat)] { + if row * 2 + 1 == count { return [(0, width)] } + let half = (width - spacing) / 2 + return [(0, half), (half + spacing, half)] + } +} diff --git a/examples/demo/App/Views/Components/AddItemDialog.swift b/examples/demo/App/Views/Components/AddItemDialog.swift index 938a12f5e5..7b0a41993a 100644 --- a/examples/demo/App/Views/Components/AddItemDialog.swift +++ b/examples/demo/App/Views/Components/AddItemDialog.swift @@ -27,7 +27,7 @@ import SwiftUI -/// Reusable centered dialog for adding items with one or two text fields. +/// Reusable dialog for adding items with one or two text fields. struct AddItemDialog: View { let itemType: AddItemType let onAdd: (String, String) -> Void diff --git a/examples/demo/App/Views/Components/CustomNotificationDialog.swift b/examples/demo/App/Views/Components/CustomNotificationDialog.swift index 61df5e318e..d53b374651 100644 --- a/examples/demo/App/Views/Components/CustomNotificationDialog.swift +++ b/examples/demo/App/Views/Components/CustomNotificationDialog.swift @@ -27,7 +27,7 @@ import SwiftUI -/// Centered dialog for composing a custom push notification (title + body). +/// Dialog for composing a custom push notification (title + body). struct CustomNotificationDialog: View { let onSend: (String, String) -> Void let onCancel: () -> Void diff --git a/examples/demo/App/Views/Components/MultiPairInputDialog.swift b/examples/demo/App/Views/Components/MultiPairInputDialog.swift index b785b7c3c6..48642ee16e 100644 --- a/examples/demo/App/Views/Components/MultiPairInputDialog.swift +++ b/examples/demo/App/Views/Components/MultiPairInputDialog.swift @@ -27,7 +27,7 @@ import SwiftUI -/// Centered dialog that adds multiple key/value pairs at once +/// Dialog that adds multiple key/value pairs at once /// (Add Multiple Aliases / Tags / Triggers). struct MultiPairInputDialog: View { let type: MultiAddItemType diff --git a/examples/demo/App/Views/Components/OSDialog.swift b/examples/demo/App/Views/Components/OSDialog.swift index f4d39d0f24..cd317dd44f 100644 --- a/examples/demo/App/Views/Components/OSDialog.swift +++ b/examples/demo/App/Views/Components/OSDialog.swift @@ -157,7 +157,7 @@ struct OSTextField: View { struct OSTextEditor: View { let placeholder: String @Binding var text: String - var minHeight: CGFloat = 90 + var height: CGFloat = 90 var accessibilityID: String @FocusState private var focused: Bool @@ -180,7 +180,7 @@ struct OSTextEditor: View { .padding(.horizontal, 8) .padding(.vertical, 8) .focused($focused) - .frame(minHeight: minHeight) + .frame(height: height) .accessibilityIdentifier(accessibilityID) } .background( @@ -193,12 +193,12 @@ struct OSTextEditor: View { } } -// MARK: - Centered dialog presentation +// MARK: - Dialog presentation extension View { /// Presents `content` as a modal dialog near the top of the screen, - /// matching the styles.md "Dialogs" spec: 54% black backdrop, 16pt - /// horizontal / 24pt vertical insets, 28pt corner radius, white card. + /// with a 54% black backdrop, 16pt horizontal / 24pt vertical insets, + /// 28pt corner radius and a white card. /// Tapping the backdrop dismisses. /// /// Uses `.fullScreenCover` rather than `.overlay` so the backdrop and @@ -208,15 +208,15 @@ extension View { /// clear via `ClearBackgroundView` so the dialog's own backdrop is what /// the user sees (iOS 16.4+ has `presentationBackground(.clear)`; this /// works on the demo's 16.0 deployment target). - func osCenteredDialog( + func osDialog( isPresented: Binding, @ViewBuilder content: @escaping () -> DialogContent ) -> some View { - modifier(OSCenteredDialogModifier(isPresented: isPresented, dialog: content)) + modifier(OSDialogModifier(isPresented: isPresented, dialog: content)) } } -private struct OSCenteredDialogModifier: ViewModifier { +private struct OSDialogModifier: ViewModifier { @Binding var isPresented: Bool @ViewBuilder var dialog: () -> DialogContent @@ -228,15 +228,10 @@ private struct OSCenteredDialogModifier: ViewModifier { .contentShape(Rectangle()) .onTapGesture { isPresented = false } - // Top-anchored and keyboard-insensitive so the dialog never moves - // while open. When it slid up for the keyboard, XCUITest kept - // reporting the pre-keyboard frames, so Appium taps on dialog - // buttons landed on empty space. `fixedSize` keeps flexible content - // (e.g. TextEditor) at its natural height so the action buttons - // stay above the keyboard instead of being pushed under it. + // Top-anchored and keyboard-insensitive: a dialog that moves while + // open desyncs XCUITest frame reporting from the rendered layout. VStack(spacing: 0) { dialog() - .fixedSize(horizontal: false, vertical: true) .clipShape(RoundedRectangle(cornerRadius: OS.Radius.modal)) .padding(.horizontal, 16) .padding(.vertical, 24) diff --git a/examples/demo/App/Views/Components/OutcomeDialog.swift b/examples/demo/App/Views/Components/OutcomeDialog.swift index 23493d36cb..4a90ec730c 100644 --- a/examples/demo/App/Views/Components/OutcomeDialog.swift +++ b/examples/demo/App/Views/Components/OutcomeDialog.swift @@ -27,7 +27,7 @@ import SwiftUI -/// Centered dialog for sending an outcome (normal, unique, or with value). +/// Dialog for sending an outcome (normal, unique, or with value). struct OutcomeDialog: View { let onSend: (String, OutcomeMode, Double?) -> Void let onCancel: () -> Void diff --git a/examples/demo/App/Views/Components/RemoveMultiDialog.swift b/examples/demo/App/Views/Components/RemoveMultiDialog.swift index 53897fae5c..b70924ea20 100644 --- a/examples/demo/App/Views/Components/RemoveMultiDialog.swift +++ b/examples/demo/App/Views/Components/RemoveMultiDialog.swift @@ -27,7 +27,7 @@ import SwiftUI -/// Centered dialog that lets the user pick multiple keys to remove +/// Dialog that lets the user pick multiple keys to remove /// (Remove Tags / Remove Triggers). struct RemoveMultiDialog: View { let type: RemoveMultiItemType diff --git a/examples/demo/App/Views/Components/TooltipDialog.swift b/examples/demo/App/Views/Components/TooltipDialog.swift index f9392eb0de..b1773aa7da 100644 --- a/examples/demo/App/Views/Components/TooltipDialog.swift +++ b/examples/demo/App/Views/Components/TooltipDialog.swift @@ -28,8 +28,8 @@ import SwiftUI /// Tooltip dialog body shown when the user taps a section's info icon. -/// Single OK action — no Cancel. Presented as a centered modal via -/// `osCenteredDialog`, so this view renders only the card chrome. +/// Single OK action — no Cancel. Presented as a modal via +/// `osDialog`, so this view renders only the card chrome. struct TooltipDialog: View { let tooltip: TooltipData let onClose: () -> Void diff --git a/examples/demo/App/Views/Components/TrackEventDialog.swift b/examples/demo/App/Views/Components/TrackEventDialog.swift index 37d62161e6..04aa73ba9d 100644 --- a/examples/demo/App/Views/Components/TrackEventDialog.swift +++ b/examples/demo/App/Views/Components/TrackEventDialog.swift @@ -27,7 +27,7 @@ import SwiftUI -/// Centered dialog that captures an event name plus an optional +/// Dialog that captures an event name plus an optional /// JSON properties payload. struct TrackEventDialog: View { let onTrack: (String, [String: Any]?) -> Void @@ -61,7 +61,7 @@ struct TrackEventDialog: View { OSTextEditor( placeholder: "{ \"key\": \"value\" }", text: $propertiesText, - minHeight: 120, + height: 120, accessibilityID: "event_properties_input" ) diff --git a/examples/demo/App/Views/ContentView.swift b/examples/demo/App/Views/ContentView.swift index 610c5f3ab2..3a6fbf208f 100644 --- a/examples/demo/App/Views/ContentView.swift +++ b/examples/demo/App/Views/ContentView.swift @@ -90,7 +90,7 @@ struct ContentView: View { SecondaryView() } } - .osCenteredDialog( + .osDialog( isPresented: Binding( get: { viewModel.activeTooltip != nil }, set: { isPresented in if !isPresented { viewModel.dismissTooltip() } } diff --git a/examples/demo/App/Views/Sections/AliasesSection.swift b/examples/demo/App/Views/Sections/AliasesSection.swift index c6772a5bea..6cc49153a8 100644 --- a/examples/demo/App/Views/Sections/AliasesSection.swift +++ b/examples/demo/App/Views/Sections/AliasesSection.swift @@ -44,14 +44,16 @@ struct AliasesSection: View { sectionKey: "aliases" ) - ActionButton("ADD ALIAS", accessibilityID: "add_alias_button") { - addOpen = true - } - ActionButton("ADD MULTIPLE ALIASES", accessibilityID: "add_multiple_aliases_button") { - addMultipleOpen = true + ButtonGrid { + ActionButton("ADD ALIAS", accessibilityID: "add_alias_button") { + addOpen = true + } + ActionButton("ADD MULTIPLE ALIASES", accessibilityID: "add_multiple_aliases_button") { + addMultipleOpen = true + } } } - .osCenteredDialog(isPresented: $addOpen) { + .osDialog(isPresented: $addOpen) { AddItemDialog( itemType: .alias, onAdd: { key, value in @@ -61,7 +63,7 @@ struct AliasesSection: View { onCancel: { addOpen = false } ) } - .osCenteredDialog(isPresented: $addMultipleOpen) { + .osDialog(isPresented: $addMultipleOpen) { MultiPairInputDialog( type: .aliases, onAdd: { pairs in diff --git a/examples/demo/App/Views/Sections/CustomEventsSection.swift b/examples/demo/App/Views/Sections/CustomEventsSection.swift index 01d2e742e8..02c2f4b8e1 100644 --- a/examples/demo/App/Views/Sections/CustomEventsSection.swift +++ b/examples/demo/App/Views/Sections/CustomEventsSection.swift @@ -42,7 +42,7 @@ struct CustomEventsSection: View { open = true } } - .osCenteredDialog(isPresented: $open) { + .osDialog(isPresented: $open) { TrackEventDialog( onTrack: { name, properties in viewModel.trackEvent(name: name, properties: properties) diff --git a/examples/demo/App/Views/Sections/EmailsSection.swift b/examples/demo/App/Views/Sections/EmailsSection.swift index ba9ef1cad7..4e70082b8c 100644 --- a/examples/demo/App/Views/Sections/EmailsSection.swift +++ b/examples/demo/App/Views/Sections/EmailsSection.swift @@ -48,7 +48,7 @@ struct EmailsSection: View { addOpen = true } } - .osCenteredDialog(isPresented: $addOpen) { + .osDialog(isPresented: $addOpen) { AddItemDialog( itemType: .email, onAdd: { _, value in diff --git a/examples/demo/App/Views/Sections/LiveActivitySection.swift b/examples/demo/App/Views/Sections/LiveActivitySection.swift index 9086da6a22..d4f2dae1e2 100644 --- a/examples/demo/App/Views/Sections/LiveActivitySection.swift +++ b/examples/demo/App/Views/Sections/LiveActivitySection.swift @@ -49,40 +49,42 @@ struct LiveActivitySection: View { ) { inputCard - ActionButton( - "START LIVE ACTIVITY", - isDisabled: trimmedActivityId.isEmpty, - accessibilityID: "start_live_activity_button" - ) { - statusIndex = 0 - viewModel.startLiveActivity( - activityId: trimmedActivityId, - orderNumber: orderNumber.trimmingCharacters(in: .whitespacesAndNewlines), - status: statuses[0] - ) - } + ButtonGrid { + ActionButton( + "START LIVE ACTIVITY", + isDisabled: trimmedActivityId.isEmpty, + accessibilityID: "start_live_activity_button" + ) { + statusIndex = 0 + viewModel.startLiveActivity( + activityId: trimmedActivityId, + orderNumber: orderNumber.trimmingCharacters(in: .whitespacesAndNewlines), + status: statuses[0] + ) + } - ActionButton( - updateButtonTitle, - isDisabled: trimmedActivityId.isEmpty || !LiveActivityController.hasApiKey, - accessibilityID: "update_live_activity_button" - ) { - let nextIndex = (statusIndex + 1) % statuses.count - viewModel.updateLiveActivity( - activityId: trimmedActivityId, - status: statuses[nextIndex] - ) - statusIndex = nextIndex - } + ActionButton( + updateButtonTitle, + isDisabled: trimmedActivityId.isEmpty || !LiveActivityController.hasApiKey, + accessibilityID: "update_live_activity_button" + ) { + let nextIndex = (statusIndex + 1) % statuses.count + viewModel.updateLiveActivity( + activityId: trimmedActivityId, + status: statuses[nextIndex] + ) + statusIndex = nextIndex + } - ActionButton( - "END LIVE ACTIVITY", - style: .outline, - isDisabled: trimmedActivityId.isEmpty || !LiveActivityController.hasApiKey, - accessibilityID: "end_live_activity_button" - ) { - viewModel.endLiveActivity(activityId: trimmedActivityId) - } + ActionButton( + "END LIVE ACTIVITY", + style: .outline, + isDisabled: trimmedActivityId.isEmpty || !LiveActivityController.hasApiKey, + accessibilityID: "end_live_activity_button" + ) { + viewModel.endLiveActivity(activityId: trimmedActivityId) + } +} if !LiveActivityController.hasApiKey { Text("Set ONESIGNAL_API_KEY in Secrets.plist to enable update & end") diff --git a/examples/demo/App/Views/Sections/LocationSection.swift b/examples/demo/App/Views/Sections/LocationSection.swift index 41079cea7d..a70ade24c5 100644 --- a/examples/demo/App/Views/Sections/LocationSection.swift +++ b/examples/demo/App/Views/Sections/LocationSection.swift @@ -47,13 +47,15 @@ struct LocationSection: View { accessibilityID: "location_shared_toggle" ) - ActionButton("PROMPT LOCATION", accessibilityID: "prompt_location_button") { - viewModel.promptLocation() - } + ButtonGrid { + ActionButton("PROMPT LOCATION", accessibilityID: "prompt_location_button") { + viewModel.promptLocation() + } - ActionButton("CHECK LOCATION", accessibilityID: "check_location_button") { - let shared = viewModel.checkLocationShared() - toast.show("Location shared: \(shared)") + ActionButton("CHECK LOCATION", accessibilityID: "check_location_button") { + let shared = viewModel.checkLocationShared() + toast.show("Location shared: \(shared)") + } } } } diff --git a/examples/demo/App/Views/Sections/OutcomesSection.swift b/examples/demo/App/Views/Sections/OutcomesSection.swift index f4b84f259a..3982077c0d 100644 --- a/examples/demo/App/Views/Sections/OutcomesSection.swift +++ b/examples/demo/App/Views/Sections/OutcomesSection.swift @@ -42,7 +42,7 @@ struct OutcomesSection: View { open = true } } - .osCenteredDialog(isPresented: $open) { + .osDialog(isPresented: $open) { OutcomeDialog( onSend: { name, mode, value in switch mode { diff --git a/examples/demo/App/Views/Sections/SendIamSection.swift b/examples/demo/App/Views/Sections/SendIamSection.swift index 79a9c586ca..680c805949 100644 --- a/examples/demo/App/Views/Sections/SendIamSection.swift +++ b/examples/demo/App/Views/Sections/SendIamSection.swift @@ -31,18 +31,13 @@ import SwiftUI struct SendIamSection: View { @EnvironmentObject var viewModel: OneSignalViewModel - private let columns = Array( - repeating: GridItem(.flexible(), spacing: OS.Spacing.cardGap), - count: 2 - ) - var body: some View { SectionCard( title: "SEND IN-APP MESSAGE", sectionKey: "send_iam", onInfoTap: { viewModel.showTooltip(for: "sendInAppMessage") } ) { - LazyVGrid(columns: columns, spacing: OS.Spacing.cardGap) { + ButtonGrid { ForEach(InAppMessageType.allCases) { type in ActionButton( type.rawValue.uppercased(), diff --git a/examples/demo/App/Views/Sections/SendPushSection.swift b/examples/demo/App/Views/Sections/SendPushSection.swift index 329fa2c8e1..144e464cbe 100644 --- a/examples/demo/App/Views/Sections/SendPushSection.swift +++ b/examples/demo/App/Views/Sections/SendPushSection.swift @@ -38,27 +38,29 @@ struct SendPushSection: View { sectionKey: "send_push", onInfoTap: { viewModel.showTooltip(for: "sendPushNotification") } ) { - ActionButton("SIMPLE", accessibilityID: "send_simple_button") { - viewModel.sendNotification(.simple) - } - ActionButton("WITH IMAGE", accessibilityID: "send_image_button") { - viewModel.sendNotification(.withImage) - } - ActionButton("WITH SOUND", accessibilityID: "send_sound_button") { - viewModel.sendNotification(.withSound) - } - ActionButton("CUSTOM", accessibilityID: "send_custom_button") { - customOpen = true - } - ActionButton( - "CLEAR ALL", - style: .outline, - accessibilityID: "clear_all_button" - ) { - viewModel.clearAllNotifications() + ButtonGrid { + ActionButton("SIMPLE", accessibilityID: "send_simple_button") { + viewModel.sendNotification(.simple) + } + ActionButton("WITH IMAGE", accessibilityID: "send_image_button") { + viewModel.sendNotification(.withImage) + } + ActionButton("WITH SOUND", accessibilityID: "send_sound_button") { + viewModel.sendNotification(.withSound) + } + ActionButton("CUSTOM", accessibilityID: "send_custom_button") { + customOpen = true + } + ActionButton( + "CLEAR ALL", + style: .outline, + accessibilityID: "clear_all_button" + ) { + viewModel.clearAllNotifications() + } } } - .osCenteredDialog(isPresented: $customOpen) { + .osDialog(isPresented: $customOpen) { CustomNotificationDialog( onSend: { title, body in viewModel.sendCustomNotification(title: title, body: body) diff --git a/examples/demo/App/Views/Sections/SmsSection.swift b/examples/demo/App/Views/Sections/SmsSection.swift index d8deb5a1a5..d4a19213f4 100644 --- a/examples/demo/App/Views/Sections/SmsSection.swift +++ b/examples/demo/App/Views/Sections/SmsSection.swift @@ -48,7 +48,7 @@ struct SmsSection: View { addOpen = true } } - .osCenteredDialog(isPresented: $addOpen) { + .osDialog(isPresented: $addOpen) { AddItemDialog( itemType: .sms, onAdd: { _, value in diff --git a/examples/demo/App/Views/Sections/TagsSection.swift b/examples/demo/App/Views/Sections/TagsSection.swift index a7e7756556..e2a803d4a1 100644 --- a/examples/demo/App/Views/Sections/TagsSection.swift +++ b/examples/demo/App/Views/Sections/TagsSection.swift @@ -50,23 +50,25 @@ struct TagsSection: View { } ) - ActionButton("ADD TAG", accessibilityID: "add_tag_button") { - addOpen = true - } - ActionButton("ADD MULTIPLE TAGS", accessibilityID: "add_multiple_tags_button") { - addMultipleOpen = true - } - if !viewModel.tags.isEmpty { - ActionButton( - "REMOVE TAGS", - style: .outline, - accessibilityID: "remove_tags_button" - ) { - removeOpen = true + ButtonGrid { + ActionButton("ADD TAG", accessibilityID: "add_tag_button") { + addOpen = true + } + ActionButton("ADD MULTIPLE TAGS", accessibilityID: "add_multiple_tags_button") { + addMultipleOpen = true + } + if !viewModel.tags.isEmpty { + ActionButton( + "REMOVE TAGS", + style: .outline, + accessibilityID: "remove_tags_button" + ) { + removeOpen = true + } } } } - .osCenteredDialog(isPresented: $addOpen) { + .osDialog(isPresented: $addOpen) { AddItemDialog( itemType: .tag, onAdd: { key, value in @@ -76,7 +78,7 @@ struct TagsSection: View { onCancel: { addOpen = false } ) } - .osCenteredDialog(isPresented: $addMultipleOpen) { + .osDialog(isPresented: $addMultipleOpen) { MultiPairInputDialog( type: .tags, onAdd: { pairs in @@ -86,7 +88,7 @@ struct TagsSection: View { onCancel: { addMultipleOpen = false } ) } - .osCenteredDialog(isPresented: $removeOpen) { + .osDialog(isPresented: $removeOpen) { RemoveMultiDialog( type: .tags, items: viewModel.tags, diff --git a/examples/demo/App/Views/Sections/TriggersSection.swift b/examples/demo/App/Views/Sections/TriggersSection.swift index 0838045af8..bfefb0698e 100644 --- a/examples/demo/App/Views/Sections/TriggersSection.swift +++ b/examples/demo/App/Views/Sections/TriggersSection.swift @@ -50,30 +50,32 @@ struct TriggersSection: View { } ) - ActionButton("ADD TRIGGER", accessibilityID: "add_trigger_button") { - addOpen = true - } - ActionButton("ADD MULTIPLE TRIGGERS", accessibilityID: "add_multiple_triggers_button") { - addMultipleOpen = true - } - if !viewModel.triggers.isEmpty { - ActionButton( - "REMOVE TRIGGERS", - style: .outline, - accessibilityID: "remove_triggers_button" - ) { - removeOpen = true + ButtonGrid { + ActionButton("ADD TRIGGER", accessibilityID: "add_trigger_button") { + addOpen = true + } + ActionButton("ADD MULTIPLE TRIGGERS", accessibilityID: "add_multiple_triggers_button") { + addMultipleOpen = true } - ActionButton( - "CLEAR ALL TRIGGERS", - style: .outline, - accessibilityID: "clear_triggers_button" - ) { - viewModel.clearTriggers() + if !viewModel.triggers.isEmpty { + ActionButton( + "REMOVE TRIGGERS", + style: .outline, + accessibilityID: "remove_triggers_button" + ) { + removeOpen = true + } + ActionButton( + "CLEAR ALL TRIGGERS", + style: .outline, + accessibilityID: "clear_triggers_button" + ) { + viewModel.clearTriggers() + } } } } - .osCenteredDialog(isPresented: $addOpen) { + .osDialog(isPresented: $addOpen) { AddItemDialog( itemType: .trigger, onAdd: { key, value in @@ -83,7 +85,7 @@ struct TriggersSection: View { onCancel: { addOpen = false } ) } - .osCenteredDialog(isPresented: $addMultipleOpen) { + .osDialog(isPresented: $addMultipleOpen) { MultiPairInputDialog( type: .triggers, onAdd: { pairs in @@ -93,7 +95,7 @@ struct TriggersSection: View { onCancel: { addMultipleOpen = false } ) } - .osCenteredDialog(isPresented: $removeOpen) { + .osDialog(isPresented: $removeOpen) { RemoveMultiDialog( type: .triggers, items: viewModel.triggers, diff --git a/examples/demo/App/Views/Sections/UserSection.swift b/examples/demo/App/Views/Sections/UserSection.swift index 9eed1b6626..37f91f831b 100644 --- a/examples/demo/App/Views/Sections/UserSection.swift +++ b/examples/demo/App/Views/Sections/UserSection.swift @@ -159,32 +159,34 @@ struct UserSection: View { .accessibilityIdentifier("jwt_ask_banner") } - ActionButton( - viewModel.loginButtonTitle, - accessibilityID: "login_user_button" - ) { - loginOpen = true - } + ButtonGrid { + ActionButton( + viewModel.loginButtonTitle, + accessibilityID: "login_user_button" + ) { + loginOpen = true + } + + if viewModel.isLoggedIn { + ActionButton( + "LOGOUT USER", + style: .outline, + accessibilityID: "logout_user_button" + ) { + viewModel.logout() + } + } - if viewModel.isLoggedIn { ActionButton( - "LOGOUT USER", + "UPDATE USER JWT", style: .outline, - accessibilityID: "logout_user_button" + accessibilityID: "update_user_jwt_button" ) { - viewModel.logout() + updateJwtOpen = true } } - - ActionButton( - "UPDATE USER JWT", - style: .outline, - accessibilityID: "update_user_jwt_button" - ) { - updateJwtOpen = true - } } - .osCenteredDialog(isPresented: $loginOpen) { + .osDialog(isPresented: $loginOpen) { LoginUserDialog( onLogin: { externalId, jwt in viewModel.login(externalId: externalId, jwtToken: jwt) @@ -193,7 +195,7 @@ struct UserSection: View { onCancel: { loginOpen = false } ) } - .osCenteredDialog(isPresented: $updateJwtOpen) { + .osDialog(isPresented: $updateJwtOpen) { AddItemDialog( itemType: .updateUserJwt, initialKey: viewModel.jwtAskExternalId ?? viewModel.externalUserId ?? "", From e17622baedac89f16a4a936a9f7b114845b86c09 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Tue, 17 Nov 2026 10:25:22 -0800 Subject: [PATCH 6/7] chore: [SDK-5587] shorten demo list section button labels ADD MULTIPLE {TAGS,ALIASES,TRIGGERS} -> ADD {TAGS,ALIASES,TRIGGERS} and CLEAR ALL TRIGGERS -> CLEAR ALL so they fit the two-column grid without scaling down. Co-Authored-By: Claude Opus 5.5 --- examples/demo/App/Views/Sections/AliasesSection.swift | 2 +- examples/demo/App/Views/Sections/TagsSection.swift | 2 +- examples/demo/App/Views/Sections/TriggersSection.swift | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/demo/App/Views/Sections/AliasesSection.swift b/examples/demo/App/Views/Sections/AliasesSection.swift index 6cc49153a8..c92553e8d7 100644 --- a/examples/demo/App/Views/Sections/AliasesSection.swift +++ b/examples/demo/App/Views/Sections/AliasesSection.swift @@ -48,7 +48,7 @@ struct AliasesSection: View { ActionButton("ADD ALIAS", accessibilityID: "add_alias_button") { addOpen = true } - ActionButton("ADD MULTIPLE ALIASES", accessibilityID: "add_multiple_aliases_button") { + ActionButton("ADD ALIASES", accessibilityID: "add_multiple_aliases_button") { addMultipleOpen = true } } diff --git a/examples/demo/App/Views/Sections/TagsSection.swift b/examples/demo/App/Views/Sections/TagsSection.swift index e2a803d4a1..5d600417c8 100644 --- a/examples/demo/App/Views/Sections/TagsSection.swift +++ b/examples/demo/App/Views/Sections/TagsSection.swift @@ -54,7 +54,7 @@ struct TagsSection: View { ActionButton("ADD TAG", accessibilityID: "add_tag_button") { addOpen = true } - ActionButton("ADD MULTIPLE TAGS", accessibilityID: "add_multiple_tags_button") { + ActionButton("ADD TAGS", accessibilityID: "add_multiple_tags_button") { addMultipleOpen = true } if !viewModel.tags.isEmpty { diff --git a/examples/demo/App/Views/Sections/TriggersSection.swift b/examples/demo/App/Views/Sections/TriggersSection.swift index bfefb0698e..eacc4524cc 100644 --- a/examples/demo/App/Views/Sections/TriggersSection.swift +++ b/examples/demo/App/Views/Sections/TriggersSection.swift @@ -54,7 +54,7 @@ struct TriggersSection: View { ActionButton("ADD TRIGGER", accessibilityID: "add_trigger_button") { addOpen = true } - ActionButton("ADD MULTIPLE TRIGGERS", accessibilityID: "add_multiple_triggers_button") { + ActionButton("ADD TRIGGERS", accessibilityID: "add_multiple_triggers_button") { addMultipleOpen = true } if !viewModel.triggers.isEmpty { @@ -66,7 +66,7 @@ struct TriggersSection: View { removeOpen = true } ActionButton( - "CLEAR ALL TRIGGERS", + "CLEAR ALL", style: .outline, accessibilityID: "clear_triggers_button" ) { From 132e9ca6beb0a0cbb6e45b9a045935e6fc409868 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Tue, 17 Nov 2026 10:27:55 -0800 Subject: [PATCH 7/7] chore: [SDK-5587] shorten Live Activity button labels START/END LIVE ACTIVITY -> START/END ACTIVITY; the section title already names Live Activities and the shorter label fits a grid cell unscaled. Co-Authored-By: Claude Opus 5.5 --- examples/demo/App/Views/Sections/LiveActivitySection.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/demo/App/Views/Sections/LiveActivitySection.swift b/examples/demo/App/Views/Sections/LiveActivitySection.swift index d4f2dae1e2..fdb8fe3aa3 100644 --- a/examples/demo/App/Views/Sections/LiveActivitySection.swift +++ b/examples/demo/App/Views/Sections/LiveActivitySection.swift @@ -51,7 +51,7 @@ struct LiveActivitySection: View { ButtonGrid { ActionButton( - "START LIVE ACTIVITY", + "START ACTIVITY", isDisabled: trimmedActivityId.isEmpty, accessibilityID: "start_live_activity_button" ) { @@ -77,7 +77,7 @@ struct LiveActivitySection: View { } ActionButton( - "END LIVE ACTIVITY", + "END ACTIVITY", style: .outline, isDisabled: trimmedActivityId.isEmpty || !LiveActivityController.hasApiKey, accessibilityID: "end_live_activity_button"