Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ jobs:
CODE_SIGN_STYLE=Manual \
CODE_SIGN_IDENTITY="iPhone Distribution" \
DEVELOPMENT_TEAM=DL8TF3X4K3 \
DEMO_BUNDLE_ID=com.onesignal.sdkdemo \
DEMO_TEAM_ID=DL8TF3X4K3 \
COMPILER_INDEX_STORE_ENABLE=NO
xcodebuild -exportArchive \
-archivePath examples/demo/build/App.xcarchive \
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/App.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<string>$(APS_ENVIRONMENT)</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.onesignal.sdkdemo.onesignal</string>
<string>group.$(DEMO_BUNDLE_ID).onesignal</string>
</array>
</dict>
</plist>
54 changes: 39 additions & 15 deletions examples/demo/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
E194A3F19072CB17A8F1A12E /* SmsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmsSection.swift; sourceTree = "<group>"; };
ECAC7EF0B67920F9FEC4F129 /* TagsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsSection.swift; sourceTree = "<group>"; };
F46DFACB9F304B9374F3C570 /* ToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastView.swift; sourceTree = "<group>"; };
"TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Build.xcconfig; sourceTree = "<group>"; };
"TEMP_F66E8CF6-A4CF-4CA4-B7D5-3C76B0C73751" /* Build.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Build.xcconfig; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -591,10 +591,10 @@
path = Support;
sourceTree = "<group>";
};
"TEMP_915DBED0-7714-4B53-A845-B8138FF5BA7F" /* demo */ = {
"TEMP_2963AA5B-1BB6-4987-8B27-65DF0A8CCD40" /* demo */ = {
isa = PBXGroup;
children = (
"TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */,
"TEMP_F66E8CF6-A4CF-4CA4-B7D5-3C76B0C73751" /* Build.xcconfig */,
);
path = demo;
sourceTree = "<group>";
Expand Down Expand Up @@ -627,6 +627,7 @@
isa = PBXNativeTarget;
buildConfigurationList = FFC1863BD4026D2C17CBE82B /* Build configuration list for PBXNativeTarget "App" */;
buildPhases = (
681E85E00F91D8E7BEBFA818 /* Create empty Secrets.plist if missing */,
B77F0AF073564580D75A2CF1 /* Sources */,
37BFF6A8CB5CC7FA21AD3FA3 /* Resources */,
BC0DC3536DED64E0E8C9923E /* Frameworks */,
Expand Down Expand Up @@ -808,6 +809,29 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
681E85E00F91D8E7BEBFA818 /* Create empty Secrets.plist if missing */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Create empty Secrets.plist if missing";
outputFileListPaths = (
);
outputPaths = (
"$(SRCROOT)/App/Secrets.plist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "[ -f \"$SRCROOT/App/Secrets.plist\" ] || /usr/bin/plutil -create xml1 \"$SRCROOT/App/Secrets.plist\"\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
5F10FF7EC3754C580B64A5B5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -968,14 +992,14 @@
/* Begin XCBuildConfiguration section */
0D2EF3911CA89837C30DB0D1 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */;
baseConfigurationReference = "TEMP_F66E8CF6-A4CF-4CA4-B7D5-3C76B0C73751" /* Build.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
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.sdkdemo.LA;
PRODUCT_BUNDLE_IDENTIFIER = "$(DEMO_BUNDLE_ID).LA";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
Expand All @@ -985,7 +1009,7 @@
};
4A0C935808978B5A7673E412 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */;
baseConfigurationReference = "TEMP_F66E8CF6-A4CF-4CA4-B7D5-3C76B0C73751" /* Build.xcconfig */;
buildSettings = {
APS_ENVIRONMENT = development;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
Expand All @@ -995,7 +1019,7 @@
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.sdkdemo;
PRODUCT_BUNDLE_IDENTIFIER = "$(DEMO_BUNDLE_ID)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h";
Expand Down Expand Up @@ -1068,7 +1092,7 @@
};
D0E56A85F1C385808720F94B /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */;
baseConfigurationReference = "TEMP_F66E8CF6-A4CF-4CA4-B7D5-3C76B0C73751" /* Build.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
Expand All @@ -1078,7 +1102,7 @@
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.sdkdemo.NSE;
PRODUCT_BUNDLE_IDENTIFIER = "$(DEMO_BUNDLE_ID).NSE";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Appium Demo - NSE";
Expand All @@ -1090,7 +1114,7 @@
};
EB1CC3A930E09FEBECF9195D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */;
baseConfigurationReference = "TEMP_F66E8CF6-A4CF-4CA4-B7D5-3C76B0C73751" /* Build.xcconfig */;
buildSettings = {
APS_ENVIRONMENT = production;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
Expand All @@ -1104,7 +1128,7 @@
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.sdkdemo;
PRODUCT_BUNDLE_IDENTIFIER = "$(DEMO_BUNDLE_ID)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Appium Demo - Main";
Expand All @@ -1116,7 +1140,7 @@
};
F305A3E63851EE49DA2D190E /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */;
baseConfigurationReference = "TEMP_F66E8CF6-A4CF-4CA4-B7D5-3C76B0C73751" /* Build.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
Expand All @@ -1127,7 +1151,7 @@
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.sdkdemo.LA;
PRODUCT_BUNDLE_IDENTIFIER = "$(DEMO_BUNDLE_ID).LA";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Appium Demo - Live Activity";
Expand All @@ -1139,13 +1163,13 @@
};
F5FD25168D9B32A08A468069 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = "TEMP_2F85E914-D20C-4EA7-A633-D4D6487C35EA" /* Build.xcconfig */;
baseConfigurationReference = "TEMP_F66E8CF6-A4CF-4CA4-B7D5-3C76B0C73751" /* Build.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements;
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.sdkdemo.NSE;
PRODUCT_BUNDLE_IDENTIFIER = "$(DEMO_BUNDLE_ID).NSE";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app uses your location to personalize notifications and content even when the app is in the background.</string>
<key>OneSignal_app_groups_key</key>
<string>group.com.onesignal.sdkdemo.onesignal</string>
<string>group.$(DEMO_BUNDLE_ID).onesignal</string>
<key>NSSupportsLiveActivities</key>
<true/>
<key>NSSupportsLiveActivitiesFrequentUpdates</key>
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/App/Services/SecretsConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import Foundation
enum SecretsConfig {

/// Hard-coded fallback when `ONESIGNAL_APP_ID` is missing or empty in
/// `Secrets.plist`. Matches the default in `sdk-shared/demo/build.md`.
static let defaultAppId = "77e32082-ea27-42e3-a898-c72e141824ef"
/// `Secrets.plist`. Shared example app used by every SDK demo.
static let defaultAppId = "1154c350-e715-4b71-a58b-1b84b6745baa"

/// Resolved OneSignal App ID. Reads `ONESIGNAL_APP_ID` from `Secrets.plist`
/// and falls back to `defaultAppId` when missing or empty.
Expand Down
10 changes: 7 additions & 3 deletions examples/demo/Build.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
// 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
// E2E overrides both on the xcodebuild command line
// (DEMO_BUNDLE_ID=com.onesignal.sdkdemo DEMO_TEAM_ID=DL8TF3X4K3).
DEMO_BUNDLE_ID = com.onesignal.example
DEMO_TEAM_ID = 99SW8E36CT

// Debug signing team. Release pins its own In House profiles in project.yml.
DEVELOPMENT_TEAM = $(DEMO_TEAM_ID)

#include? "Local.xcconfig"
8 changes: 5 additions & 3 deletions examples/demo/Local.xcconfig.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
// Anything you set here survives `xcodegen generate`; settings you change
// only in Xcode's Signing & Capabilities UI are wiped on regeneration.

// Apple Developer team id used by automatic signing. Required to run on a
// physical device.
// DEVELOPMENT_TEAM = ABCDE12345
// Bundle ID and Apple Developer team used by automatic signing. The NSE and
// widget get `.NSE` / `.LA` suffixes and the App Group becomes
// `group.<DEMO_BUNDLE_ID>.onesignal`.
// DEMO_BUNDLE_ID = com.example.mydemo
// DEMO_TEAM_ID = ABCDE12345

// Switch from automatic to manual signing if you have a specific
// provisioning profile to attach. Leave on Automatic for most cases.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleVersion</key>
<string>1</string>
<key>OneSignal_app_groups_key</key>
<string>group.com.onesignal.sdkdemo.onesignal</string>
<string>group.$(DEMO_BUNDLE_ID).onesignal</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.onesignal.sdkdemo.onesignal</string>
<string>group.$(DEMO_BUNDLE_ID).onesignal</string>
</array>
</dict>
</plist>
4 changes: 2 additions & 2 deletions examples/demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.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`.
The shipped `App.entitlements` and `OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements` use `group.$(DEMO_BUNDLE_ID).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. The demo builds as `com.onesignal.example` on team `99SW8E36CT` by default. To use your own bundle ID or team, set `DEMO_BUNDLE_ID` / `DEMO_TEAM_ID` in `Local.xcconfig` (see `Local.xcconfig.example`). The other capabilities (Push Notifications, Remote notifications background mode, `NSSupportsLiveActivities`) are already declared in the entitlements / `App/Info.plist`.

### 4. Configure your OneSignal credentials

Expand All @@ -107,7 +107,7 @@ Both the App ID and (optional) REST API key live in a single `Secrets.plist` nex
</dict>
```

- `ONESIGNAL_APP_ID` — optional. Falls back to the placeholder in `SecretsConfig.defaultAppId` when missing.
- `ONESIGNAL_APP_ID` — optional. Falls back to the shared example app in `SecretsConfig.defaultAppId` when missing.
- `ONESIGNAL_API_KEY` — optional, only needed for Live Activity **Update** / **End**. Without it, those buttons disable themselves and the section shows a hint.

> The widget renders `DefaultLiveActivityAttributes` (provided by the SDK), so the Activity ID + Order # you type into the demo flows through to the same widget regardless of whether the update came from `OneSignal.LiveActivities` locally or from the REST `/live_activities/{id}/notifications` endpoint.
Expand Down
12 changes: 6 additions & 6 deletions examples/demo/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ 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 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.
- `Build.xcconfig` -- root xcconfig referenced by every target's `configFiles: { Debug, Release }`. It sets `DEMO_BUNDLE_ID` (`com.onesignal.example`) and `DEMO_TEAM_ID` (`99SW8E36CT`), uses the team as the Debug `DEVELOPMENT_TEAM`, and then does `#include? "Local.xcconfig"`, so a fresh clone builds with no extra setup. Every target derives its bundle ID from `DEMO_BUNDLE_ID` (`.NSE` and `.LA` suffixes for the extensions), and the App Group is `group.$(DEMO_BUNDLE_ID).onesignal`. E2E passes `DEMO_BUNDLE_ID=com.onesignal.sdkdemo DEMO_TEAM_ID=DL8TF3X4K3` to `xcodebuild`.
- `Local.xcconfig` (gitignored) -- per-developer overrides such as `DEMO_BUNDLE_ID`, `DEMO_TEAM_ID`, `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`) -- `<dict>` 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.

Expand Down Expand Up @@ -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.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.
The NSE entitlements file (`OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements`) **must** declare the same `com.apple.security.application-groups` value as the main app — both use `group.$(DEMO_BUNDLE_ID).onesignal`, so they stay in sync when `DEMO_BUNDLE_ID` changes.

### Widget Extension (Live Activities)

Expand All @@ -194,7 +194,7 @@ The widget target's deployment target is `16.2` (project-wide is `16.0`) because
<string>$(APS_ENVIRONMENT)</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.onesignal.sdkdemo.onesignal</string>
<string>group.$(DEMO_BUNDLE_ID).onesignal</string>
</array>
```

Expand All @@ -204,7 +204,7 @@ The widget target's deployment target is `16.2` (project-wide is `16.0`) because

### Release signing

Release builds are signed for enterprise (In House) distribution so the Appium suite can run push tests on BrowserStack real devices.
Release builds are signed for enterprise (In House) distribution so the Appium suite can run push tests on BrowserStack real devices. They require the E2E bundle ID (`DEMO_BUNDLE_ID=com.onesignal.sdkdemo`).

- 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.
Expand Down Expand Up @@ -256,7 +256,7 @@ examples/demo/
├── Build.xcconfig # Root xcconfig wired into every target;
│ # Debug team + `#include? "Local.xcconfig"`
├── Local.xcconfig.example # Per-developer overrides template
│ # (DEVELOPMENT_TEAM, CODE_SIGN_STYLE, ...)
│ # (DEMO_BUNDLE_ID, DEMO_TEAM_ID, ...)
├── build.md # This file
├── README.md
├── App/ # Main app target source
Expand Down
Loading
Loading