Skip to content

Commit 25edf64

Browse files
authored
Merge pull request #570 from OneSignal/release/3.0.8
Release 3.0.8
2 parents c7d0f17 + 3d63686 commit 25edf64

File tree

20 files changed

+170
-140
lines changed

20 files changed

+170
-140
lines changed

OneSignalExample/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
"OneSignal.Core"
66
],
77
"includePlatforms": [
8-
"Android",
9-
"Editor",
10-
"iOS"
8+
"Editor"
119
],
1210
"excludePlatforms": [],
1311
"allowUnsafeCode": false,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Modified MIT License
3+
*
4+
* Copyright 2022 OneSignal
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* 1. The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* 2. All copies of substantial portions of the Software may only be used in connection
17+
* with services provided by OneSignal.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
*/
27+
28+
using UnityEngine;
29+
using UnityEditor.VSAttribution.OneSignalSDK;
30+
31+
namespace OneSignalSDK
32+
{
33+
internal static class AttachToInit {
34+
#if ONE_SIGNAL_INSTALLED
35+
[RuntimeInitializeOnLoadMethod] public static void Init() {
36+
if (string.IsNullOrEmpty(OneSignal.AppId))
37+
OneSignal.OnInitialize += appId => VSAttribution.SendAttributionEvent("Login", "OneSignal", appId);
38+
else
39+
VSAttribution.SendAttributionEvent("Login", "OneSignal", OneSignal.AppId);
40+
}
41+
#endif
42+
}
43+
}

OneSignalExample/Assets/OneSignal/Attribution/OneSignalVSAttribution.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using UnityEngine.Analytics;
3+
4+
namespace UnityEditor.VSAttribution.OneSignalSDK
5+
{
6+
public static class VSAttribution
7+
{
8+
const int k_VersionId = 4;
9+
const int k_MaxEventsPerHour = 10;
10+
const int k_MaxNumberOfElements = 1000;
11+
12+
const string k_VendorKey = "unity.vsp-attribution";
13+
const string k_EventName = "vspAttribution";
14+
15+
static bool RegisterEvent()
16+
{
17+
AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour,
18+
k_MaxNumberOfElements, k_VendorKey, k_VersionId);
19+
20+
var isResultOk = result == AnalyticsResult.Ok;
21+
return isResultOk;
22+
}
23+
24+
[Serializable]
25+
struct VSAttributionData
26+
{
27+
public string actionName;
28+
public string partnerName;
29+
public string customerUid;
30+
public string extra;
31+
}
32+
33+
/// <summary>
34+
/// Registers and attempts to send a Verified Solutions Attribution event.
35+
/// </summary>
36+
/// <param name="actionName">Name of the action, identifying a place this event was called from.</param>
37+
/// <param name="partnerName">Identifiable Verified Solutions Partner's name.</param>
38+
/// <param name="customerUid">Unique identifier of the customer using Partner's Verified Solution.</param>
39+
public static AnalyticsResult SendAttributionEvent(string actionName, string partnerName, string customerUid)
40+
{
41+
try
42+
{
43+
// Are Editor Analytics enabled ? (Preferences)
44+
if (!EditorAnalytics.enabled)
45+
return AnalyticsResult.AnalyticsDisabled;
46+
47+
if (!RegisterEvent())
48+
return AnalyticsResult.InvalidData;
49+
50+
// Create an expected data object
51+
var eventData = new VSAttributionData
52+
{
53+
actionName = actionName,
54+
partnerName = partnerName,
55+
customerUid = customerUid,
56+
extra = "{}"
57+
};
58+
59+
return EditorAnalytics.SendEventWithLimit(k_EventName, eventData, k_VersionId);
60+
}
61+
catch
62+
{
63+
// Fail silently
64+
return AnalyticsResult.AnalyticsDisabled;
65+
}
66+
}
67+
}
68+
}

OneSignalExample/Assets/OneSignal/Attribution/VspAttribution.cs

-108
This file was deleted.

OneSignalExample/Assets/OneSignal/CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ 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.8]
9+
### Changed
10+
- Renamed `enterLiveActivity` to `EnterLiveActivity` and `exitLiveActivity` to `ExitLiveActivity`
11+
- Updated Unity Verified Solutions Attribution script from VspAttribution to VSAttribution
12+
### Fixed
13+
- Resolved serialization depth limit 10 exceeded warning log
14+
815
## [3.0.7]
916
### Changed
1017
- Updated included iOS SDK to [3.12.3](https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/3.12.3)
@@ -175,7 +182,8 @@ If you run into any problems, please don’t hesitate to [open an issue](https:/
175182
- If you are updating from a previous version of the OneSignal Unity SDK please follow the Unity Asset Store instructions in
176183
the [README](https://github.com/OneSignal/OneSignal-Unity-SDK/README.md#unity-asset-store) to ensure a smooth transition.
177184

178-
[Unreleased]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.7...HEAD
185+
[Unreleased]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.8...HEAD
186+
[3.0.8]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.7...3.0.8
179187
[3.0.7]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.6...3.0.7
180188
[3.0.6]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.5...3.0.6
181189
[3.0.5]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.4...3.0.5

OneSignalExample/Assets/OneSignal/Editor/Resources/OneSignalFileInventory.asset

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ MonoBehaviour:
3030
- Assets/OneSignal/link.xml.meta
3131
- Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef
3232
- Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef.meta
33-
- Assets/OneSignal/Attribution/VspAttribution.cs
34-
- Assets/OneSignal/Attribution/VspAttribution.cs.meta
33+
- Assets/OneSignal/Attribution/VSAttribution.cs
34+
- Assets/OneSignal/Attribution/VSAttribution.cs.meta
35+
- Assets/OneSignal/Attribution/OneSignalVSAttribution.cs
36+
- Assets/OneSignal/Attribution/OneSignalVSAttribution.cs.meta
3537
- Assets/OneSignal/Documentation~/asset_listing.png
3638
- Assets/OneSignal/Documentation~/ios_auto_sign.png
3739
- Assets/OneSignal/Documentation~/ios_extension_sign_and_groups.png
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.7
1+
3.0.8

OneSignalExample/Packages/packages-lock.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"depth": 0,
66
"source": "local",
77
"dependencies": {
8-
"com.onesignal.unity.core": "3.0.7"
8+
"com.onesignal.unity.core": "3.0.8"
99
}
1010
},
1111
"com.onesignal.unity.core": {
@@ -19,7 +19,7 @@
1919
"depth": 0,
2020
"source": "local",
2121
"dependencies": {
22-
"com.onesignal.unity.core": "3.0.7"
22+
"com.onesignal.unity.core": "3.0.8"
2323
}
2424
},
2525
"com.unity.ext.nunit": {

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.7
137+
bundleVersion: 3.0.8
138138
preloadedAssets: []
139139
metroInputSource: 0
140140
wsaTransparentSwapchain: 0

com.onesignal.unity.android/Runtime/OneSignalAndroid.Mappings.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,19 @@ private static NotificationPermission _stateNotificationPermission(AndroidJavaOb
5858

5959
private static Notification _getNotification(AndroidJavaObject notifJO) {
6060
var notification = notifJO.ToSerializable<Notification>();
61-
61+
6262
var dataJson = notifJO.Call<AndroidJavaObject>("getAdditionalData");
6363
if (dataJson != null) {
6464
var dataJsonStr = dataJson.Call<string>("toString");
6565
notification.additionalData = Json.Deserialize(dataJsonStr) as Dictionary<string, object>;
6666
}
6767

68+
var groupedNotificationsJson = notifJO.Call<AndroidJavaObject>("getGroupedNotifications");
69+
if (groupedNotificationsJson != null) {
70+
var groupedNotificationsStr = groupedNotificationsJson.Call<string>("toString");
71+
notification.groupedNotifications = Json.Deserialize(groupedNotificationsStr) as List<NotificationBase>;
72+
}
73+
6874
return notification;
6975
}
7076

com.onesignal.unity.android/Runtime/OneSignalAndroid.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ public override async Task<bool> SendOutcomeWithValue(string name, float value)
282282
return await proxy;
283283
}
284284

285-
public override Task<bool> enterLiveActivity(string activityId, string token) {
285+
public override Task<bool> EnterLiveActivity(string activityId, string token) {
286286
SDKDebug.Warn("This feature is only available for iOS.");
287287
return Task.FromResult(false);
288288
}
289289

290-
public override Task<bool> exitLiveActivity(string activityId) {
290+
public override Task<bool> ExitLiveActivity(string activityId) {
291291
SDKDebug.Warn("This feature is only available for iOS.");
292292
return Task.FromResult(false);
293293
}

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.7",
4+
"version": "3.0.8",
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.7"
8+
"com.onesignal.unity.core": "3.0.8"
99
},
1010
"keywords": [
1111
"push-notifications",

com.onesignal.unity.core/Editor/Platform/OneSignalNative.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ public override Task<bool> SendOutcomeWithValue(string name, float value) {
175175
return Task.FromResult(false);
176176
}
177177

178-
public override Task<bool> enterLiveActivity(string activityId, string token) {
178+
public override Task<bool> EnterLiveActivity(string activityId, string token) {
179179
return Task.FromResult(false);
180180
}
181181

182-
public override Task<bool> exitLiveActivity(string activityId) {
182+
public override Task<bool> ExitLiveActivity(string activityId) {
183183
return Task.FromResult(false);
184184
}
185185
}

0 commit comments

Comments
 (0)