Skip to content

Commit 6c8884f

Browse files
committed
refactor(demo): replace LogManager with console and add E2E value masking
chore(demo): enable WebView debugging for Appium style(demo): add subtle box-shadow to brand fix(ios): link OneSignal SPM products explicitly refactor(demo): lift OneSignal into context provider chore(ios): switch to manual code signing docs(demo): condense build guide feat(examples): add icon generation script feat(demo): add splash screen plugin ci: add E2E workflow for Android and iOS
1 parent 006421e commit 6c8884f

127 files changed

Lines changed: 1048 additions & 1304 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Setup Demo'
2+
description: 'Installs toolchains, builds the SDK, sets up the Capacitor demo app, and creates the .env file'
3+
inputs:
4+
onesignal-app-id:
5+
description: 'OneSignal App ID for the demo .env'
6+
required: true
7+
onesignal-api-key:
8+
description: 'OneSignal API Key for the demo .env'
9+
required: true
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Set up Bun
14+
uses: oven-sh/setup-bun@v2
15+
16+
- name: Cache SDK bun dependencies
17+
uses: actions/cache@v5
18+
with:
19+
path: node_modules
20+
key: bun-sdk-${{ runner.os }}-${{ hashFiles('bun.lock') }}
21+
restore-keys: bun-sdk-${{ runner.os }}-
22+
23+
- name: Cache demo bun dependencies
24+
uses: actions/cache@v5
25+
with:
26+
path: examples/demo/node_modules
27+
key: bun-demo-${{ runner.os }}-${{ hashFiles('examples/demo/bun.lock') }}
28+
restore-keys: bun-demo-${{ runner.os }}-
29+
30+
- name: Install SDK dependencies
31+
shell: bash
32+
run: bun install --frozen-lockfile
33+
34+
- name: Set up demo
35+
shell: bash
36+
working-directory: examples/demo
37+
run: bun run setup
38+
39+
- name: Create demo .env
40+
shell: bash
41+
working-directory: examples/demo
42+
run: |
43+
echo "VITE_ONESIGNAL_APP_ID=${{ inputs.onesignal-app-id }}" > .env
44+
echo "VITE_ONESIGNAL_API_KEY=${{ inputs.onesignal-api-key }}" >> .env
45+
echo "VITE_E2E_MODE=true" >> .env

.github/workflows/e2e.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- rel/**
7+
workflow_dispatch:
8+
inputs:
9+
platform:
10+
description: 'Platform to test'
11+
required: true
12+
default: 'both'
13+
type: choice
14+
options:
15+
- android
16+
- ios
17+
- both
18+
19+
permissions:
20+
contents: read
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
build-android:
28+
if: >-
29+
github.event_name == 'push' ||
30+
github.event.inputs.platform == 'android' ||
31+
github.event.inputs.platform == 'both'
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v6
36+
37+
- name: Set up Java
38+
uses: actions/setup-java@v5
39+
with:
40+
distribution: temurin
41+
java-version: '21'
42+
43+
- name: Set up demo
44+
uses: ./.github/actions/setup-demo
45+
with:
46+
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
47+
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
48+
49+
- name: Build release APK
50+
working-directory: examples/demo/android
51+
run: ./gradlew assembleRelease --quiet --console=plain --warning-mode=summary
52+
53+
- name: Upload APK
54+
uses: actions/upload-artifact@v7
55+
with:
56+
name: demo-apk
57+
path: examples/demo/android/app/build/outputs/apk/release/app-release.apk
58+
retention-days: 1
59+
compression-level: 0
60+
61+
build-ios:
62+
if: >-
63+
github.event_name == 'push' ||
64+
github.event.inputs.platform == 'ios' ||
65+
github.event.inputs.platform == 'both'
66+
runs-on: macos-latest
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v6
70+
71+
- name: Set up demo
72+
uses: ./.github/actions/setup-demo
73+
with:
74+
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
75+
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
76+
77+
- name: Cache Xcode DerivedData
78+
uses: actions/cache@v5
79+
with:
80+
path: examples/demo/ios/App/build
81+
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/ios/App/CapApp-SPM/Package.swift', 'examples/demo/ios/App/App.xcodeproj/project.pbxproj') }}
82+
restore-keys: deriveddata-${{ runner.os }}-
83+
84+
- name: Set up iOS codesigning
85+
uses: OneSignal/sdk-shared/.github/actions/setup-ios-demo-codesigning@main
86+
with:
87+
p12-base64: ${{ secrets.APPIUM_IOS_DEV_CERT_P12_BASE64 }}
88+
p12-password: ${{ secrets.APPIUM_IOS_DEV_CERT_PASSWORD }}
89+
asc-key-id: ${{ secrets.APPIUM_APP_STORE_CONNECT_KEY_ID }}
90+
asc-issuer-id: ${{ secrets.APPIUM_APP_STORE_CONNECT_ISSUER_ID }}
91+
asc-private-key: ${{ secrets.APPIUM_APP_STORE_CONNECT_PRIVATE_KEY }}
92+
93+
- name: Build signed IPA
94+
working-directory: examples/demo/ios/App
95+
run: |
96+
xcodebuild archive \
97+
-project App.xcodeproj \
98+
-scheme App \
99+
-configuration Release \
100+
-sdk iphoneos \
101+
-destination 'generic/platform=iOS' \
102+
-archivePath build/App.xcarchive \
103+
-derivedDataPath build \
104+
-quiet \
105+
-hideShellScriptEnvironment \
106+
CODE_SIGN_STYLE=Manual \
107+
COMPILER_INDEX_STORE_ENABLE=NO
108+
xcodebuild -exportArchive \
109+
-archivePath build/App.xcarchive \
110+
-exportOptionsPlist ExportOptions.plist \
111+
-exportPath build/ipa \
112+
-quiet
113+
114+
- name: Verify aps-environment in IPA
115+
working-directory: examples/demo/ios/App
116+
run: |
117+
IPA=$(ls build/ipa/*.ipa | head -n1)
118+
unzip -oq "$IPA" -d /tmp/ipa
119+
APP=$(ls -d /tmp/ipa/Payload/*.app | head -n1)
120+
codesign -d --entitlements - "$APP" 2>&1 | tee /tmp/entitlements.txt
121+
if ! grep -q 'aps-environment' /tmp/entitlements.txt; then
122+
echo "::error::Built IPA is missing aps-environment entitlement; push subscription will not work"
123+
exit 1
124+
fi
125+
126+
- name: Upload IPA
127+
uses: actions/upload-artifact@v7
128+
with:
129+
name: demo-ipa
130+
path: examples/demo/ios/App/build/ipa/App.ipa
131+
retention-days: 1
132+
compression-level: 0
133+
134+
e2e-android:
135+
needs: build-android
136+
uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main
137+
secrets: inherit
138+
with:
139+
platform: android
140+
app-artifact: demo-apk
141+
app-filename: app-release.apk
142+
sdk-type: capacitor
143+
build-name: capacitor-android-${{ github.ref_name }}-${{ github.run_number }}
144+
145+
e2e-ios:
146+
needs: build-ios
147+
uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main
148+
secrets: inherit
149+
with:
150+
platform: ios
151+
app-artifact: demo-ipa
152+
app-filename: App.ipa
153+
sdk-type: capacitor
154+
build-name: capacitor-ios-${{ github.ref_name }}-${{ github.run_number }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_modules
44
# Build & test output
55
dist/
66
coverage/
7+
.capacitor-sdk-source.stamp
78

89
# macOS
910
.DS_Store

Package.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ let package = Package(
2121
dependencies: [
2222
.product(name: "Capacitor", package: "capacitor-swift-pm"),
2323
.product(name: "Cordova", package: "capacitor-swift-pm"),
24-
.product(name: "OneSignalFramework", package: "OneSignal-XCFramework")
24+
// InAppMessages and Location are separate library products in
25+
// OneSignal-XCFramework and must be linked explicitly under SPM,
26+
// otherwise their xcframeworks aren't loaded and the namespaces
27+
// are silent no-ops at runtime.
28+
.product(name: "OneSignalFramework", package: "OneSignal-XCFramework"),
29+
.product(name: "OneSignalInAppMessages", package: "OneSignal-XCFramework"),
30+
.product(name: "OneSignalLocation", package: "OneSignal-XCFramework"),
31+
.product(name: "OneSignalExtension", package: "OneSignal-XCFramework")
2532
],
2633
path: "ios/Sources/OneSignalCapacitorPlugin"
2734
)

0 commit comments

Comments
 (0)