Skip to content

Commit 83cb08a

Browse files
Merge pull request #505 from OneSignal/release/3.0.2
Release 3.0.2
2 parents 9b70579 + be40d7f commit 83cb08a

File tree

12 files changed

+161
-42
lines changed

12 files changed

+161
-42
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!-- START -->
2+
# READ AND DELETE THIS SECTION BEFORE SUBMITTING PR
3+
* **Fill out each _REQUIRED_ section**
4+
* **Fill out _OPTIONAL_ sections, remove section if it doesn't apply to your PR**
5+
* **Read and fill out each of the checklists below**
6+
* **Remove this section after reading**
7+
<!-- END -->
8+
9+
# Description
10+
## One Line Summary
11+
**REQUIRED** - Very short description that summaries the changes in this PR.
12+
13+
## Details
14+
15+
### Motivation
16+
**REQUIRED -** Why is this code change being made? Or what is the goal of this PR? Examples: Fixes a specific bug, provides additional logging to debug future issues, feature to allow X.
17+
18+
### Scope
19+
**RECOMMEND - OPTIONAL -** What is intended to be effected. What is known not to change. Example: Notifications are grouped when parameter X is set, not enabled by default.
20+
21+
# Testing
22+
## Unit testing
23+
**OPTIONAL -** Explain unit tests added, if not clear in the code.
24+
25+
## Manual testing
26+
**RECOMMEND - OPTIONAL -** Explain what scenarios were tested and the environment.
27+
Example: Tested opening a notification while the app was foregrounded, app build with Android Studio 2020.3 with a fresh install of the OneSignal example app on a Pixel 6 with Android 12.
28+
29+
# Affected code checklist
30+
- [ ] Notifications
31+
- [ ] Display
32+
- [ ] Open
33+
- [ ] Push Processing
34+
- [ ] Confirm Deliveries
35+
- [ ] Outcomes
36+
- [ ] Sessions
37+
- [ ] In-App Messaging
38+
- [ ] REST API requests
39+
- [ ] Public API changes
40+
41+
# Checklist
42+
## Overview
43+
- [ ] I have filled out all **REQUIRED** sections above
44+
- [ ] PR does one thing
45+
- If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
46+
- [ ] Any Public API changes are explained in the PR details and conform to existing APIs
47+
48+
## Testing
49+
- [ ] I have included test coverage for these changes, or explained why they are not needed
50+
- [ ] All automated tests pass, or I explained why that is not possible
51+
- [ ] I have personally tested this on my device, or explained why that is not possible
52+
53+
## Final pass
54+
- [ ] Code is as readable as possible.
55+
- Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
56+
- [ ] I have reviewed this PR myself, ensuring it meets each checklist item
57+
- WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

OneSignalExample/Assets/OneSignal/CHANGELOG.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
## [3.0.2]
9+
### Changed
10+
- Updated included Android SDK to [4.7.1](https://github.com/OneSignal/OneSignal-Android-SDK/releases/tag/4.7.1)
11+
- Explicitly check for a diff and handle overwrites for the `AndroidManifest.xml` between the project's and package's `OneSignalConfig.plugin`
12+
- `InstallEdm4uStep` checks for version number to determine if step is completed
13+
### Fixed
14+
- iOS build post processor checks for complete presence of extension
15+
- iOS publishing error 90206 when uploading app to Apple.
16+
- iOS builds on Unity on Windows failing on Entitlements file path. Fixes [#491](https://github.com/OneSignal/OneSignal-Unity-SDK/issues/442)
17+
- `OneSignalXCFramework` pod version of `OneSignalNotificationServiceExtension` target in Podfile of iOS builds will be upgraded if target is present during post processing
18+
819
## [3.0.1]
920
### Added
1021
- [Migration guide](../../../MIGRATION.md) for updating from 2.x.x to 3.x.x
@@ -124,7 +135,7 @@ If you run into any problems, please don’t hesitate to [open an issue](https:/
124135

125136
## [2.14.1]
126137
### Fixed
127-
- Corrected directory separators in post processor when building for iOS in a
138+
- Corrected directory separators in post processor when building for iOS in a
128139
Windows environment. From PR [#376](https://github.com/OneSignal/OneSignal-Unity-SDK/pull/376)
129140
by [@SplenectomY](https://github.com/SplenectomY). Fixes [#375](https://github.com/OneSignal/OneSignal-Unity-SDK/issues/375), [#377](https://github.com/OneSignal/OneSignal-Unity-SDK/issues/377), [#380](https://github.com/OneSignal/OneSignal-Unity-SDK/issues/380)
130141

@@ -136,7 +147,8 @@ If you run into any problems, please don’t hesitate to [open an issue](https:/
136147
- If you are updating from a previous version of the OneSignal Unity SDK please follow the Unity Asset Store instructions in
137148
the [README](https://github.com/OneSignal/OneSignal-Unity-SDK/README.md#unity-asset-store) to ensure a smooth transition.
138149

139-
[Unreleased]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.1...HEAD
150+
[Unreleased]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.2...HEAD
151+
[3.0.2]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.1...3.0.2
140152
[3.0.1]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.0...3.0.1
141153
[3.0.0]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.0-beta.6...3.0.0
142154
[3.0.0-beta.6]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.0-beta.5...3.0.0-beta.6
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.1
1+
3.0.2

OneSignalExample/ProjectSettings/ProjectSettings.asset

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ PlayerSettings:
134134
16:10: 1
135135
16:9: 1
136136
Others: 1
137-
bundleVersion: 3.0.1
137+
bundleVersion: 3.0.2
138138
preloadedAssets: []
139139
metroInputSource: 0
140140
wsaTransparentSwapchain: 0

com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<repositories>
44
<repository>https://repo.maven.apache.org/maven2</repository>
55
</repositories>
6-
<androidPackage spec="com.onesignal:OneSignal:4.6.5" />
6+
<androidPackage spec="com.onesignal:OneSignal:4.7.1" />
77
</androidPackages>
88
</dependencies>

com.onesignal.unity.android/Editor/SetupSteps/ExportAndroidResourcesStep.cs

+15-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ protected override bool _getIsStepCompleted() {
5656

5757
var fileDiff = packagePaths.Except(exportPaths);
5858

59-
return !fileDiff.Any();
59+
if (fileDiff.Any())
60+
return false;
61+
62+
var pluginManifest = File.ReadAllText(_manifestPackagePath);
63+
var projectManifest = File.ReadAllText(_manifestExportPath);
64+
65+
return pluginManifest == projectManifest;
6066
}
6167

6268
protected override void _runStep() {
@@ -76,8 +82,10 @@ protected override void _runStep() {
7682

7783
if (!Directory.Exists(containingPath))
7884
Directory.CreateDirectory(containingPath);
79-
80-
if (!File.Exists(fileExportPath))
85+
86+
if (!fileExportPath.Contains(".png")) // always refresh non-pngs
87+
File.Copy(file, fileExportPath, true);
88+
else if (!File.Exists(fileExportPath)) // don't copy over existing png files
8189
File.Copy(file, fileExportPath);
8290
}
8391

@@ -87,7 +95,11 @@ protected override void _runStep() {
8795
private const string _pluginName = "OneSignalConfig.plugin";
8896
private static readonly string _packagePath = Path.Combine("Packages", "com.onesignal.unity.android", "Editor");
8997
private static readonly string _androidPluginsPath = Path.Combine("Assets", "Plugins", "Android");
98+
9099
private static readonly string _pluginPackagePath = Path.Combine(_packagePath, _pluginName);
91100
private static readonly string _pluginExportPath = Path.Combine(_androidPluginsPath, _pluginName);
101+
102+
private static readonly string _manifestPackagePath = Path.Combine(_pluginPackagePath, "AndroidManifest.xml");
103+
private static readonly string _manifestExportPath = Path.Combine(_pluginExportPath, "AndroidManifest.xml");
92104
}
93105
}

com.onesignal.unity.android/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "com.onesignal.unity.android",
33
"displayName": "OneSignal Unity SDK - Android",
4-
"version": "3.0.1",
4+
"version": "3.0.2",
55
"unity": "2018.4",
66
"description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
77
"dependencies": {
8-
"com.onesignal.unity.core": "3.0.1"
8+
"com.onesignal.unity.core": "3.0.2"
99
},
1010
"keywords": [
1111
"push-notifications",

com.onesignal.unity.core/Editor/SetupSteps/InstallEdm4uStep.cs

+37-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
using System.Linq;
2929
using UnityEditor.Compilation;
30+
using System;
31+
using System.IO;
32+
using System.Text.RegularExpressions;
3033

3134
namespace OneSignalSDK {
3235
/// <summary>
@@ -43,10 +46,42 @@ public override string Details
4346
public override bool IsRequired
4447
=> true;
4548

46-
protected override bool _getIsStepCompleted()
47-
=> CompilationPipeline.GetPrecompiledAssemblyNames()
49+
protected override bool _getIsStepCompleted() {
50+
var isInstalled = CompilationPipeline.GetPrecompiledAssemblyNames()
4851
.Any(assemblyName => assemblyName.StartsWith("Google.VersionHandler"));
4952

53+
if (!isInstalled)
54+
return false;
55+
56+
var path = "Assets/ExternalDependencyManager/Editor";
57+
var directoryInfo = new DirectoryInfo(path);
58+
59+
if (!directoryInfo.Exists)
60+
return false;
61+
62+
FileInfo[] files;
63+
64+
try {
65+
files = directoryInfo.GetFiles("external-dependency-manager_version-*_manifest.txt");
66+
} catch (Exception) {
67+
return false;
68+
}
69+
70+
if (files.Length != 1) {
71+
SDKDebug.Warn("EDM4U version number could not be determined.");
72+
return false;
73+
}
74+
75+
var file = files[0];
76+
var pattern = @"external-dependency-manager_version-(.+)_manifest\.txt";
77+
var match = Regex.Match(file.Name, pattern);
78+
var version = new Version(match.Groups[1].Value);
79+
80+
var expectedVersion = new Version(_edm4UVersion);
81+
82+
return version >= expectedVersion;
83+
}
84+
5085
protected override void _runStep() {
5186
const string msg = "Downloading Google External Dependency Manager";
5287
UnityPackageInstaller.DownloadAndInstall(_edm4UPackageDownloadUrl, msg, result => {

com.onesignal.unity.core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.onesignal.unity.core",
33
"displayName": "OneSignal Unity SDK - Core",
4-
"version": "3.0.1",
4+
"version": "3.0.2",
55
"unity": "2018.4",
66
"description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
77
"dependencies": {

com.onesignal.unity.ios/Editor/BuildPostProcessor.cs

+24-21
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private string GetEntitlementsPath(string targetGuid, string targetName) {
138138
_project.AddFile(relativeDestination, entitlementFileName);
139139
_project.SetBuildProperty(targetGuid, "CODE_SIGN_ENTITLEMENTS", relativeDestination);
140140

141-
return entitlementsPath;
141+
return relativeDestination;
142142
}
143143

144144
/// <summary>
@@ -163,15 +163,17 @@ private void AddProjectCapabilities() {
163163
/// </summary>
164164
private void AddNotificationServiceExtension() {
165165
#if !UNITY_CLOUD_BUILD
166-
// If file exists then the below has been completed before from another build
167-
// The below will not be updated on Append builds
168-
// Changes would most likely need to be made to support Append builds
169-
if (ExtensionCreatePlist(_outputPath)) {
170-
ExtensionAddPodsToTarget();
166+
// refresh plist and podfile on appends
167+
ExtensionCreatePlist(_outputPath);
168+
ExtensionAddPodsToTarget();
169+
170+
var extensionGuid = _project.TargetGuidByName(ServiceExtensionTargetName);
171+
172+
// skip target setup if already present
173+
if (!string.IsNullOrEmpty(extensionGuid))
171174
return;
172-
}
173175

174-
var extensionGuid = _project.AddAppExtension(_project.GetMainTargetGuid(),
176+
extensionGuid = _project.AddAppExtension(_project.GetMainTargetGuid(),
175177
ServiceExtensionTargetName,
176178
PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.iOS) + "." + ServiceExtensionTargetName,
177179
ServiceExtensionTargetName + "/" + "Info.plist" // Unix path as it's used by Xcode
@@ -198,8 +200,6 @@ private void AddNotificationServiceExtension() {
198200
projCapability.AddAppGroups(new[] { _appGroupName });
199201

200202
projCapability.WriteToFile();
201-
202-
ExtensionAddPodsToTarget();
203203
#endif
204204
}
205205

@@ -248,13 +248,6 @@ private void ExtensionAddPodsToTarget() {
248248
return;
249249
}
250250

251-
var podfile = File.ReadAllText(podfilePath);
252-
253-
var extensionEntryRegex = new Regex($@"target '{ServiceExtensionTargetName}' do\n(.+)\nend");
254-
if (extensionEntryRegex.IsMatch(podfile))
255-
return;
256-
257-
var versionRegex = new Regex("(?<=<iosPod name=\"OneSignalXCFramework\" version=\").+(?=\" addToAllTargets=\"true\" />)");
258251
var dependenciesFilePath = Path.Combine(EditorFilesPath, DependenciesFilename);
259252

260253
if (!File.Exists(dependenciesFilePath)) {
@@ -263,16 +256,26 @@ private void ExtensionAddPodsToTarget() {
263256
}
264257

265258
var dependenciesFile = File.ReadAllText(dependenciesFilePath);
259+
var dependenciesRegex = new Regex("(?<=<iosPod name=\"OneSignalXCFramework\" version=\").+(?=\" addToAllTargets=\"true\" />)");
266260

267-
if (!versionRegex.IsMatch(dependenciesFile)) {
261+
if (!dependenciesRegex.IsMatch(dependenciesFile)) {
268262
Debug.LogError($"Could not read current iOS framework dependency version from {DependenciesFilename}");
269263
return;
270264
}
271265

272-
var version = versionRegex.Match(dependenciesFile)
273-
.ToString();
266+
var podfile = File.ReadAllText(podfilePath);
267+
var podfileRegex = new Regex($@"target '{ServiceExtensionTargetName}' do\n pod 'OneSignalXCFramework', '(.+)'\nend\n");
268+
269+
var requiredVersion = dependenciesRegex.Match(dependenciesFile).ToString();
270+
var requiredTarget = $"target '{ServiceExtensionTargetName}' do\n pod 'OneSignalXCFramework', '{requiredVersion}'\nend\n";
271+
272+
if (!podfileRegex.IsMatch(podfile))
273+
podfile += requiredTarget;
274+
else {
275+
var podfileTarget = podfileRegex.Match(podfile).ToString();
276+
podfile = podfile.Replace(podfileTarget, requiredTarget);
277+
}
274278

275-
podfile += $"target '{ServiceExtensionTargetName}' do\n pod 'OneSignalXCFramework', '{version}'\nend\n";
276279
File.WriteAllText(podfilePath, podfile);
277280
}
278281
}

com.onesignal.unity.ios/Runtime/Plugins/iOS/NotificationService.swift.meta

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

com.onesignal.unity.ios/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "com.onesignal.unity.ios",
33
"displayName": "OneSignal Unity SDK - iOS",
4-
"version": "3.0.1",
4+
"version": "3.0.2",
55
"unity": "2018.4",
66
"description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
77
"dependencies": {
8-
"com.onesignal.unity.core": "3.0.1"
8+
"com.onesignal.unity.core": "3.0.2"
99
},
1010
"keywords": [
1111
"push-notifications",

0 commit comments

Comments
 (0)