Skip to content

Commit 97ec481

Browse files
Support Unity 2022.3 across SDK and demo (#886)
Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Fadi George <fadi-george@users.noreply.github.com>
1 parent 66686bb commit 97ec481

17 files changed

Lines changed: 95 additions & 24 deletions

File tree

‎.github/workflows/e2e.yml‎

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ jobs:
4242
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
4343
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
4444

45+
- name: Enable E2E accessibility
46+
run: |
47+
python3 - <<'PY'
48+
import json
49+
from pathlib import Path
50+
51+
path = Path("examples/demo/Packages/manifest.json")
52+
manifest = json.loads(path.read_text())
53+
manifest["dependencies"]["com.unity.modules.accessibility"] = "1.0.0"
54+
path.write_text(json.dumps(manifest, indent=2) + "\n")
55+
PY
56+
printf '%s\n' '-define:ONESIGNAL_E2E_ACCESSIBILITY' > examples/demo/Assets/csc.rsp
57+
4558
- name: Resolve OneSignal Android SDK version
4659
id: android-sdk-version
4760
run: |
@@ -61,7 +74,7 @@ jobs:
6174
uses: actions/cache@v5
6275
with:
6376
path: examples/demo/Library
64-
key: unity-library-android-${{ hashFiles('examples/demo/Packages/manifest.json', 'examples/demo/ProjectSettings/ProjectVersion.txt') }}
77+
key: unity-library-android-${{ hashFiles('examples/demo/Packages/manifest.json', 'examples/demo/Assets/csc.rsp', 'examples/demo/ProjectSettings/ProjectVersion.txt') }}
6578
restore-keys: unity-library-android-
6679

6780
- name: Build APK
@@ -72,7 +85,7 @@ jobs:
7285
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
7386
with:
7487
projectPath: examples/demo
75-
unityVersion: auto
88+
unityVersion: 6000.4.11f1
7689
targetPlatform: Android
7790
buildMethod: BuildScript.BuildAndroidEmulator
7891
allowDirtyBuild: true
@@ -108,11 +121,24 @@ jobs:
108121
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
109122
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
110123

124+
- name: Enable E2E accessibility
125+
run: |
126+
python3 - <<'PY'
127+
import json
128+
from pathlib import Path
129+
130+
path = Path("examples/demo/Packages/manifest.json")
131+
manifest = json.loads(path.read_text())
132+
manifest["dependencies"]["com.unity.modules.accessibility"] = "1.0.0"
133+
path.write_text(json.dumps(manifest, indent=2) + "\n")
134+
PY
135+
printf '%s\n' '-define:ONESIGNAL_E2E_ACCESSIBILITY' > examples/demo/Assets/csc.rsp
136+
111137
- name: Cache Unity Library
112138
uses: actions/cache@v5
113139
with:
114140
path: examples/demo/Library
115-
key: unity-library-ios-${{ hashFiles('examples/demo/Packages/manifest.json', 'examples/demo/ProjectSettings/ProjectVersion.txt') }}
141+
key: unity-library-ios-${{ hashFiles('examples/demo/Packages/manifest.json', 'examples/demo/Assets/csc.rsp', 'examples/demo/ProjectSettings/ProjectVersion.txt') }}
116142
restore-keys: unity-library-ios-
117143

118144
- name: Cache Xcode DerivedData
@@ -123,7 +149,7 @@ jobs:
123149
uses: actions/cache@v5
124150
with:
125151
path: examples/demo/Build/iOS-DerivedData
126-
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/Packages/manifest.json', 'examples/demo/ProjectSettings/ProjectVersion.txt', 'examples/demo/ProjectSettings/ProjectSettings.asset', 'com.onesignal.unity.ios/Editor/**', 'com.onesignal.unity.core/Editor/**', 'examples/demo/iOS/ExportOptions.plist') }}
152+
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/Packages/manifest.json', 'examples/demo/Assets/csc.rsp', 'examples/demo/ProjectSettings/ProjectVersion.txt', 'examples/demo/ProjectSettings/ProjectSettings.asset', 'com.onesignal.unity.ios/Editor/**', 'com.onesignal.unity.core/Editor/**', 'examples/demo/iOS/ExportOptions.plist') }}
127153
restore-keys: deriveddata-${{ runner.os }}-
128154

129155
- name: Export Xcode project from Unity
@@ -134,7 +160,7 @@ jobs:
134160
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
135161
with:
136162
projectPath: examples/demo
137-
unityVersion: auto
163+
unityVersion: 6000.4.11f1
138164
targetPlatform: iOS
139165
buildMethod: BuildScript.BuildiOSDevice
140166
allowDirtyBuild: true

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ And via many additional platforms. [Check them all out](https://documentation.on
4747
## Requirements
4848
- A [OneSignal Account](https://app.onesignal.com/signup) if you do not already have one
4949
- Your OneSignal App ID which you can find under **Settings > Keys & IDs**
50-
- Unity 2021.3 or newer
50+
- Unity 2022.3 or newer
5151
- Android Builds: Target API Level 33 or higher
5252
- iOS Builds: CocoaPods 1.11.3 or newer
5353
- In order to test push notifications you will need

‎com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ internal static class OneSignalAndroidDependencies
3737
{
3838
static OneSignalAndroidDependencies()
3939
{
40+
if (AssetDatabase.IsAssetImportWorkerProcess())
41+
return;
42+
4043
OneSignalSDKSettings.Changed += WriteDependencies;
4144
WriteDependencies();
4245
}

‎com.onesignal.unity.android/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.onesignal.unity.android",
33
"displayName": "OneSignal Unity SDK - Android",
44
"version": "5.3.0",
5-
"unity": "2021.3",
5+
"unity": "2022.3",
66
"description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
77
"dependencies": {
88
"com.onesignal.unity.core": "5.3.0"

‎com.onesignal.unity.core/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.onesignal.unity.core",
33
"displayName": "OneSignal Unity SDK - Core",
44
"version": "5.3.0",
5-
"unity": "2021.3",
5+
"unity": "2022.3",
66
"description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
77
"dependencies": {
88
},

‎com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ internal static class OneSignaliOSDependencies
3737
{
3838
static OneSignaliOSDependencies()
3939
{
40+
if (AssetDatabase.IsAssetImportWorkerProcess())
41+
return;
42+
4043
OneSignalSDK.OneSignalSDKSettings.Changed += WriteDependencies;
4144
WriteDependencies();
4245
}

‎com.onesignal.unity.ios/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.onesignal.unity.ios",
33
"displayName": "OneSignal Unity SDK - iOS",
44
"version": "5.3.0",
5-
"unity": "2021.3",
5+
"unity": "2022.3",
66
"description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
77
"dependencies": {
88
"com.onesignal.unity.core": "5.3.0"

‎examples/demo/Assets/OneSignal/Editor/OneSignalFileInventory.cs‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ internal sealed class OneSignalFileInventory : ScriptableObject
4747
public static string[] GetCurrentPaths() =>
4848
ConvertPathsToUnix(
4949
Directory.GetFiles(PackageAssetsPath, "*", SearchOption.AllDirectories)
50-
);
50+
)
51+
.Except(GeneratedDependencyPaths)
52+
.ToArray();
5153

5254
/// <summary>
5355
/// Makes sure <see cref="paths"/> are using forward slash to be Unix compatible.
@@ -75,5 +77,22 @@ public static string[] ConvertPathsToUnix(string[] paths)
7577
"Resources"
7678
);
7779
public static readonly string AssetPath = Path.Combine(EditorResourcesPath, AssetName);
80+
private static readonly string[] GeneratedDependencyPaths = ConvertPathsToUnix(
81+
new[]
82+
{
83+
Path.Combine(
84+
PackageAssetsPath,
85+
"Editor",
86+
"OneSignalAndroidDependencies.xml"
87+
),
88+
Path.Combine(
89+
PackageAssetsPath,
90+
"Editor",
91+
"OneSignalAndroidDependencies.xml.meta"
92+
),
93+
Path.Combine(PackageAssetsPath, "Editor", "OneSignaliOSDependencies.xml"),
94+
Path.Combine(PackageAssetsPath, "Editor", "OneSignaliOSDependencies.xml.meta"),
95+
}
96+
);
7897
}
7998
}

‎examples/demo/Assets/OneSignal/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ And via many additional platforms. [Check them all out](https://documentation.on
3232
## Requirements
3333
- A [OneSignal Account](https://app.onesignal.com/signup) if you do not already have one
3434
- Your OneSignal App ID which you can find under **Settings > Keys & IDs**
35-
- Unity 2021.3 or newer
35+
- Unity 2022.3 or newer
3636
- Android Builds: Target API Level 33 or higher
3737
- iOS Builds: CocoaPods 1.11.3 or newer
3838
- In order to test push notifications you will need

‎examples/demo/Assets/Scripts/Services/AccessibilityBridge.cs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
using System.Globalization;
55
using System.Reflection;
66
using UnityEngine;
7+
#if UNITY_2023_2_OR_NEWER && ONESIGNAL_E2E_ACCESSIBILITY
78
using UnityEngine.Accessibility;
9+
#endif
810
using UnityEngine.UIElements;
911

1012
namespace OneSignalDemo.Services
@@ -15,6 +17,7 @@ namespace OneSignalDemo.Services
1517
/// </summary>
1618
public class AccessibilityBridge : MonoBehaviour
1719
{
20+
#if UNITY_2023_2_OR_NEWER && ONESIGNAL_E2E_ACCESSIBILITY
1821
// GeometryChangedEvent is the hot path; this tick catches drift from sources that
1922
// don't raise it (animation curves, opacity tweens, value mutations).
2023
private const float FrameRefreshIntervalSeconds = 0.05f;
@@ -912,6 +915,19 @@ public IosInfoTap(Func<bool> isEnabled, Action action)
912915
Action = action;
913916
}
914917
}
918+
#endif
919+
#else
920+
public static void EnableForE2E(VisualElement root) { }
921+
922+
public static void RegisterE2ETapTarget(
923+
VisualElement target,
924+
Func<bool> isEnabled,
925+
Action action
926+
) { }
927+
928+
public static void RequestResync() { }
929+
930+
public static void RequestImmediateResync() { }
915931
#endif
916932
}
917933
}

0 commit comments

Comments
 (0)