Skip to content

Commit

Permalink
Merge pull request #570 from OneSignal/release/3.0.8
Browse files Browse the repository at this point in the history
Release 3.0.8
  • Loading branch information
shepherd-l authored Dec 14, 2022
2 parents c7d0f17 + 3d63686 commit 25edf64
Show file tree
Hide file tree
Showing 20 changed files with 170 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"OneSignal.Core"
],
"includePlatforms": [
"Android",
"Editor",
"iOS"
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Modified MIT License
*
* Copyright 2022 OneSignal
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* 1. The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 2. All copies of substantial portions of the Software may only be used in connection
* with services provided by OneSignal.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

using UnityEngine;
using UnityEditor.VSAttribution.OneSignalSDK;

namespace OneSignalSDK
{
internal static class AttachToInit {
#if ONE_SIGNAL_INSTALLED
[RuntimeInitializeOnLoadMethod] public static void Init() {
if (string.IsNullOrEmpty(OneSignal.AppId))
OneSignal.OnInitialize += appId => VSAttribution.SendAttributionEvent("Login", "OneSignal", appId);
else
VSAttribution.SendAttributionEvent("Login", "OneSignal", OneSignal.AppId);
}
#endif
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions OneSignalExample/Assets/OneSignal/Attribution/VSAttribution.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using UnityEngine.Analytics;

namespace UnityEditor.VSAttribution.OneSignalSDK
{
public static class VSAttribution
{
const int k_VersionId = 4;
const int k_MaxEventsPerHour = 10;
const int k_MaxNumberOfElements = 1000;

const string k_VendorKey = "unity.vsp-attribution";
const string k_EventName = "vspAttribution";

static bool RegisterEvent()
{
AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour,
k_MaxNumberOfElements, k_VendorKey, k_VersionId);

var isResultOk = result == AnalyticsResult.Ok;
return isResultOk;
}

[Serializable]
struct VSAttributionData
{
public string actionName;
public string partnerName;
public string customerUid;
public string extra;
}

/// <summary>
/// Registers and attempts to send a Verified Solutions Attribution event.
/// </summary>
/// <param name="actionName">Name of the action, identifying a place this event was called from.</param>
/// <param name="partnerName">Identifiable Verified Solutions Partner's name.</param>
/// <param name="customerUid">Unique identifier of the customer using Partner's Verified Solution.</param>
public static AnalyticsResult SendAttributionEvent(string actionName, string partnerName, string customerUid)
{
try
{
// Are Editor Analytics enabled ? (Preferences)
if (!EditorAnalytics.enabled)
return AnalyticsResult.AnalyticsDisabled;

if (!RegisterEvent())
return AnalyticsResult.InvalidData;

// Create an expected data object
var eventData = new VSAttributionData
{
actionName = actionName,
partnerName = partnerName,
customerUid = customerUid,
extra = "{}"
};

return EditorAnalytics.SendEventWithLimit(k_EventName, eventData, k_VersionId);
}
catch
{
// Fail silently
return AnalyticsResult.AnalyticsDisabled;
}
}
}
}
108 changes: 0 additions & 108 deletions OneSignalExample/Assets/OneSignal/Attribution/VspAttribution.cs

This file was deleted.

10 changes: 9 additions & 1 deletion OneSignalExample/Assets/OneSignal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [3.0.8]
### Changed
- Renamed `enterLiveActivity` to `EnterLiveActivity` and `exitLiveActivity` to `ExitLiveActivity`
- Updated Unity Verified Solutions Attribution script from VspAttribution to VSAttribution
### Fixed
- Resolved serialization depth limit 10 exceeded warning log

## [3.0.7]
### Changed
- Updated included iOS SDK to [3.12.3](https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/3.12.3)
Expand Down Expand Up @@ -175,7 +182,8 @@ If you run into any problems, please don’t hesitate to [open an issue](https:/
- If you are updating from a previous version of the OneSignal Unity SDK please follow the Unity Asset Store instructions in
the [README](https://github.com/OneSignal/OneSignal-Unity-SDK/README.md#unity-asset-store) to ensure a smooth transition.

[Unreleased]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.7...HEAD
[Unreleased]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.8...HEAD
[3.0.8]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.7...3.0.8
[3.0.7]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.6...3.0.7
[3.0.6]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.5...3.0.6
[3.0.5]: https://github.com/OneSignal/OneSignal-Unity-SDK/compare/3.0.4...3.0.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ MonoBehaviour:
- Assets/OneSignal/link.xml.meta
- Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef
- Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef.meta
- Assets/OneSignal/Attribution/VspAttribution.cs
- Assets/OneSignal/Attribution/VspAttribution.cs.meta
- Assets/OneSignal/Attribution/VSAttribution.cs
- Assets/OneSignal/Attribution/VSAttribution.cs.meta
- Assets/OneSignal/Attribution/OneSignalVSAttribution.cs
- Assets/OneSignal/Attribution/OneSignalVSAttribution.cs.meta
- Assets/OneSignal/Documentation~/asset_listing.png
- Assets/OneSignal/Documentation~/ios_auto_sign.png
- Assets/OneSignal/Documentation~/ios_extension_sign_and_groups.png
Expand Down
2 changes: 1 addition & 1 deletion OneSignalExample/Assets/OneSignal/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.7
3.0.8
4 changes: 2 additions & 2 deletions OneSignalExample/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"depth": 0,
"source": "local",
"dependencies": {
"com.onesignal.unity.core": "3.0.7"
"com.onesignal.unity.core": "3.0.8"
}
},
"com.onesignal.unity.core": {
Expand All @@ -19,7 +19,7 @@
"depth": 0,
"source": "local",
"dependencies": {
"com.onesignal.unity.core": "3.0.7"
"com.onesignal.unity.core": "3.0.8"
}
},
"com.unity.ext.nunit": {
Expand Down
2 changes: 1 addition & 1 deletion OneSignalExample/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 3.0.7
bundleVersion: 3.0.8
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,19 @@ private static NotificationPermission _stateNotificationPermission(AndroidJavaOb

private static Notification _getNotification(AndroidJavaObject notifJO) {
var notification = notifJO.ToSerializable<Notification>();

var dataJson = notifJO.Call<AndroidJavaObject>("getAdditionalData");
if (dataJson != null) {
var dataJsonStr = dataJson.Call<string>("toString");
notification.additionalData = Json.Deserialize(dataJsonStr) as Dictionary<string, object>;
}

var groupedNotificationsJson = notifJO.Call<AndroidJavaObject>("getGroupedNotifications");
if (groupedNotificationsJson != null) {
var groupedNotificationsStr = groupedNotificationsJson.Call<string>("toString");
notification.groupedNotifications = Json.Deserialize(groupedNotificationsStr) as List<NotificationBase>;
}

return notification;
}

Expand Down
4 changes: 2 additions & 2 deletions com.onesignal.unity.android/Runtime/OneSignalAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ public override async Task<bool> SendOutcomeWithValue(string name, float value)
return await proxy;
}

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

public override Task<bool> exitLiveActivity(string activityId) {
public override Task<bool> ExitLiveActivity(string activityId) {
SDKDebug.Warn("This feature is only available for iOS.");
return Task.FromResult(false);
}
Expand Down
4 changes: 2 additions & 2 deletions com.onesignal.unity.android/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "com.onesignal.unity.android",
"displayName": "OneSignal Unity SDK - Android",
"version": "3.0.7",
"version": "3.0.8",
"unity": "2018.4",
"description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
"dependencies": {
"com.onesignal.unity.core": "3.0.7"
"com.onesignal.unity.core": "3.0.8"
},
"keywords": [
"push-notifications",
Expand Down
4 changes: 2 additions & 2 deletions com.onesignal.unity.core/Editor/Platform/OneSignalNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ public override Task<bool> SendOutcomeWithValue(string name, float value) {
return Task.FromResult(false);
}

public override Task<bool> enterLiveActivity(string activityId, string token) {
public override Task<bool> EnterLiveActivity(string activityId, string token) {
return Task.FromResult(false);
}

public override Task<bool> exitLiveActivity(string activityId) {
public override Task<bool> ExitLiveActivity(string activityId) {
return Task.FromResult(false);
}
}
Expand Down
Loading

0 comments on commit 25edf64

Please sign in to comment.