diff --git a/examples/demo/App.entitlements b/examples/demo/App.entitlements index 3446364950..4542af378b 100644 --- a/examples/demo/App.entitlements +++ b/examples/demo/App.entitlements @@ -3,10 +3,10 @@ aps-environment - development + $(APS_ENVIRONMENT) 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..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_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* 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_17E43425-D1F7-4A88-B0A0-C0368CB0E171" /* demo */ = { + "TEMP_915DBED0-7714-4B53-A845-B8138FF5BA7F" /* demo */ = { isa = PBXGroup; children = ( - "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */, + "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */, ); path = demo; sourceTree = ""; @@ -968,15 +968,14 @@ /* Begin XCBuildConfiguration section */ 0D2EF3911CA89837C30DB0D1 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* 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 = 99SW8E36CT; 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 +985,17 @@ }; 4A0C935808978B5A7673E412 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* 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 = 99SW8E36CT; 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 +1068,17 @@ }; D0E56A85F1C385808720F94B /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* 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 +1090,21 @@ }; EB1CC3A930E09FEBECF9195D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* 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 Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "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 +1116,18 @@ }; F305A3E63851EE49DA2D190E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* 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; - "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 +1139,13 @@ }; F5FD25168D9B32A08A468069 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = "TEMP_DEC528CA-1E47-4B0F-AAAF-071417BC60C5" /* Build.xcconfig */; + baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; - DEVELOPMENT_TEAM = 99SW8E36CT; 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/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 c591dcb6a1..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 centered modal dialog over the entire screen, - /// matching the styles.md "Dialogs" spec: 54% black backdrop, 16pt - /// horizontal / 24pt vertical insets, 28pt corner radius, white card. + /// Presents `content` as a modal dialog near the top of the screen, + /// 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,10 +228,16 @@ 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: a dialog that moves while + // open desyncs XCUITest frame reporting from the rendered layout. + VStack(spacing: 0) { + dialog() + .clipShape(RoundedRectangle(cornerRadius: OS.Radius.modal)) + .padding(.horizontal, 16) + .padding(.vertical, 24) + Spacer(minLength: 0) + } + .ignoresSafeArea(.keyboard) } .background(ClearBackgroundView()) } 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..c92553e8d7 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 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..fdb8fe3aa3 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 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 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..5d600417c8 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 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..eacc4524cc 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 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", + 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 ?? "", 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/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..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) @@ -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) @@ -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.example.onesignal + 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 22f5b3842d..5c750bbf98 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,13 @@ targets: SWIFT_OBJC_BRIDGING_HEADER: App/App-Bridging-Header.h configs: Debug: - DEVELOPMENT_TEAM: 99SW8E36CT + APS_ENVIRONMENT: development Release: - CODE_SIGN_IDENTITY: "iPhone Developer" + APS_ENVIRONMENT: production + "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 - Main" dependencies: @@ -130,20 +131,18 @@ 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" LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks" SKIP_INSTALL: YES configs: - Debug: - DEVELOPMENT_TEAM: 99SW8E36CT 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 +171,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" @@ -180,13 +179,11 @@ targets: ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME: AccentColor ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME: WidgetBackground configs: - Debug: - DEVELOPMENT_TEAM: 99SW8E36CT 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:-}"