com.onesignal.unity.ios 3.0.0-beta.4 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Editor/BuildPostProcessor.cs +55 -73
- package/Editor/OneSignalIOSDependencies.xml +1 -1
- package/Editor/PBXProjectExtensions.cs +0 -6
- package/Runtime/OneSignalIOS.Callbacks.cs +15 -22
- package/Runtime/OneSignalIOS.Interface.cs +0 -3
- package/Runtime/OneSignalIOS.Mappings.cs +80 -0
- package/Runtime/OneSignalIOS.Mappings.cs.meta +3 -0
- package/Runtime/OneSignalIOS.cs +9 -50
- package/package.json +2 -2
|
@@ -52,12 +52,8 @@
|
|
|
52
52
|
#define ADD_APP_GROUP
|
|
53
53
|
|
|
54
54
|
using System.IO;
|
|
55
|
-
using System;
|
|
56
55
|
using UnityEditor;
|
|
57
56
|
using UnityEditor.iOS.Xcode;
|
|
58
|
-
using System.Collections.Generic;
|
|
59
|
-
using System.Diagnostics;
|
|
60
|
-
using System.Linq;
|
|
61
57
|
using System.Text.RegularExpressions;
|
|
62
58
|
using UnityEditor.Build;
|
|
63
59
|
using UnityEditor.Build.Reporting;
|
|
@@ -72,22 +68,15 @@ namespace OneSignalSDK {
|
|
|
72
68
|
public class BuildPostProcessor : IPostprocessBuildWithReport {
|
|
73
69
|
private const string ServiceExtensionTargetName = "OneSignalNotificationServiceExtension";
|
|
74
70
|
private const string ServiceExtensionFilename = "NotificationService.swift";
|
|
71
|
+
private const string DependenciesFilename = "OneSignalIOSDependencies.xml";
|
|
75
72
|
private const string PackageName = "com.onesignal.unity.ios";
|
|
76
73
|
|
|
74
|
+
private static readonly string EditorFilesPath = Path.Combine("Packages", PackageName, "Editor");
|
|
77
75
|
private static readonly string PluginLibrariesPath = Path.Combine(PackageName, "Runtime", "Plugins", "iOS");
|
|
78
76
|
private static readonly string PluginFilesPath = Path.Combine("Packages", PluginLibrariesPath);
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
ApsEnv = 1 << 0,
|
|
83
|
-
AppGroups = 1 << 1
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
private static readonly Dictionary<Entitlement, string> EntitlementKeys = new Dictionary<Entitlement, string> {
|
|
87
|
-
[Entitlement.ApsEnv] = "aps-environment",
|
|
88
|
-
[Entitlement.AppGroups] = "com.apple.security.application-groups"
|
|
89
|
-
};
|
|
90
|
-
|
|
78
|
+
private readonly string _appGroupName = $"group.{PlayerSettings.applicationIdentifier}.onesignal";
|
|
79
|
+
|
|
91
80
|
private string _outputPath;
|
|
92
81
|
private string _projectPath;
|
|
93
82
|
|
|
@@ -111,29 +100,19 @@ namespace OneSignalSDK {
|
|
|
111
100
|
_outputPath = report.summary.outputPath;
|
|
112
101
|
_projectPath = PBXProject.GetPBXProjectPath(_outputPath);
|
|
113
102
|
_project.ReadFromString(File.ReadAllText(_projectPath));
|
|
114
|
-
|
|
115
|
-
//
|
|
116
|
-
|
|
103
|
+
|
|
104
|
+
// Turn on capabilities required by OneSignal
|
|
105
|
+
AddProjectCapabilities();
|
|
117
106
|
|
|
118
107
|
// Add the service extension
|
|
119
108
|
AddNotificationServiceExtension();
|
|
120
109
|
|
|
121
|
-
// Reload file after changes from AddNotificationServiceExtension
|
|
122
|
-
_project.WriteToFile(_projectPath);
|
|
123
|
-
_project.ReadFromString(File.ReadAllText(_projectPath));
|
|
124
|
-
|
|
125
|
-
// Turn on push capabilities
|
|
126
|
-
AddPushCapability();
|
|
127
|
-
|
|
128
|
-
// Ensure the Pods target has been added to the extension
|
|
129
|
-
ExtensionAddPodsToTarget();
|
|
130
|
-
|
|
131
110
|
// Save the project back out
|
|
132
111
|
File.WriteAllText(_projectPath, _project.WriteToString());
|
|
133
112
|
}
|
|
134
113
|
|
|
135
114
|
/// <summary>
|
|
136
|
-
///
|
|
115
|
+
/// Get existing entitlements file if exists or creates a new file, adds it to the project, and returns the path
|
|
137
116
|
/// </summary>
|
|
138
117
|
private string GetEntitlementsPath(string targetGuid, string targetName) {
|
|
139
118
|
var relativePath = _project.GetBuildPropertyForAnyConfig(targetGuid, "CODE_SIGN_ENTITLEMENTS");
|
|
@@ -144,38 +123,12 @@ namespace OneSignalSDK {
|
|
|
144
123
|
if (File.Exists(fullPath))
|
|
145
124
|
return fullPath;
|
|
146
125
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/// <summary>
|
|
152
|
-
/// Add or update the values of necessary entitlements
|
|
153
|
-
/// </summary>
|
|
154
|
-
private void UpdateEntitlements(Entitlement entitlements, string targetGuid, string targetName) {
|
|
155
|
-
var entitlementsPath = GetEntitlementsPath(targetGuid, targetName);
|
|
126
|
+
|
|
127
|
+
var entitlementsPath = Path.Combine(_outputPath, targetName, $"{targetName}.entitlements");
|
|
128
|
+
|
|
129
|
+
// make new file
|
|
156
130
|
var entitlementsPlist = new PlistDocument();
|
|
157
|
-
|
|
158
|
-
var existingEntitlements = File.Exists(entitlementsPath);
|
|
159
|
-
|
|
160
|
-
if (existingEntitlements)
|
|
161
|
-
entitlementsPlist.ReadFromFile(entitlementsPath);
|
|
162
|
-
|
|
163
|
-
var groupsKey = EntitlementKeys[Entitlement.AppGroups];
|
|
164
|
-
|
|
165
|
-
if ((entitlements & Entitlement.AppGroups) != 0) {
|
|
166
|
-
var groups = entitlementsPlist.root[groupsKey] == null
|
|
167
|
-
? entitlementsPlist.root.CreateArray(groupsKey)
|
|
168
|
-
: entitlementsPlist.root[groupsKey].AsArray();
|
|
169
|
-
|
|
170
|
-
var group = $"group.{PlayerSettings.applicationIdentifier}.onesignal";
|
|
171
|
-
if (groups.values.All(elem => elem.AsString() != group))
|
|
172
|
-
groups.AddString(group);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
131
|
entitlementsPlist.WriteToFile(entitlementsPath);
|
|
176
|
-
|
|
177
|
-
if (existingEntitlements)
|
|
178
|
-
return;
|
|
179
132
|
|
|
180
133
|
// Copy the entitlement file to the xcode project
|
|
181
134
|
var entitlementFileName = Path.GetFileName(entitlementsPath);
|
|
@@ -184,25 +137,26 @@ namespace OneSignalSDK {
|
|
|
184
137
|
// Add the pbx configs to include the entitlements files on the project
|
|
185
138
|
_project.AddFile(relativeDestination, entitlementFileName);
|
|
186
139
|
_project.SetBuildProperty(targetGuid, "CODE_SIGN_ENTITLEMENTS", relativeDestination);
|
|
140
|
+
|
|
141
|
+
return entitlementsPath;
|
|
187
142
|
}
|
|
188
143
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
private void
|
|
193
|
-
_project.
|
|
194
|
-
_project.
|
|
144
|
+
/// <summary>
|
|
145
|
+
/// Add the required capabilities and entitlements for OneSignal
|
|
146
|
+
/// </summary>
|
|
147
|
+
private void AddProjectCapabilities() {
|
|
148
|
+
var targetGuid = _project.GetMainTargetGuid();
|
|
149
|
+
var targetName = _project.GetMainTargetName();
|
|
195
150
|
|
|
196
151
|
var entitlementsPath = GetEntitlementsPath(targetGuid, targetName);
|
|
197
|
-
|
|
198
|
-
// NOTE: ProjectCapabilityManager's 4th constructor param requires Unity 2019.3+
|
|
199
152
|
var projCapability = new ProjectCapabilityManager(_projectPath, entitlementsPath, targetName);
|
|
153
|
+
|
|
200
154
|
projCapability.AddBackgroundModes(BackgroundModesOptions.RemoteNotifications);
|
|
155
|
+
projCapability.AddPushNotifications(false);
|
|
156
|
+
projCapability.AddAppGroups(new[] { _appGroupName });
|
|
157
|
+
|
|
201
158
|
projCapability.WriteToFile();
|
|
202
159
|
}
|
|
203
|
-
|
|
204
|
-
private void AddPushCapability() =>
|
|
205
|
-
AddPushCapability(_project.GetMainTargetGuid(), _project.GetMainTargetName());
|
|
206
160
|
|
|
207
161
|
/// <summary>
|
|
208
162
|
/// Create and add the notification extension to the project
|
|
@@ -212,8 +166,10 @@ namespace OneSignalSDK {
|
|
|
212
166
|
// If file exists then the below has been completed before from another build
|
|
213
167
|
// The below will not be updated on Append builds
|
|
214
168
|
// Changes would most likely need to be made to support Append builds
|
|
215
|
-
if (ExtensionCreatePlist(_outputPath))
|
|
169
|
+
if (ExtensionCreatePlist(_outputPath)) {
|
|
170
|
+
ExtensionAddPodsToTarget();
|
|
216
171
|
return;
|
|
172
|
+
}
|
|
217
173
|
|
|
218
174
|
var extensionGuid = _project.AddAppExtension(_project.GetMainTargetGuid(),
|
|
219
175
|
ServiceExtensionTargetName,
|
|
@@ -235,7 +191,15 @@ namespace OneSignalSDK {
|
|
|
235
191
|
|
|
236
192
|
_project.WriteToFile(_projectPath);
|
|
237
193
|
|
|
238
|
-
|
|
194
|
+
// add capabilities + entitlements
|
|
195
|
+
var entitlementsPath = GetEntitlementsPath(extensionGuid, ServiceExtensionTargetName);
|
|
196
|
+
var projCapability = new ProjectCapabilityManager(_projectPath, entitlementsPath, ServiceExtensionTargetName);
|
|
197
|
+
|
|
198
|
+
projCapability.AddAppGroups(new[] { _appGroupName });
|
|
199
|
+
|
|
200
|
+
projCapability.WriteToFile();
|
|
201
|
+
|
|
202
|
+
ExtensionAddPodsToTarget();
|
|
239
203
|
#endif
|
|
240
204
|
}
|
|
241
205
|
|
|
@@ -290,7 +254,25 @@ namespace OneSignalSDK {
|
|
|
290
254
|
if (extensionEntryRegex.IsMatch(podfile))
|
|
291
255
|
return;
|
|
292
256
|
|
|
293
|
-
|
|
257
|
+
var versionRegex = new Regex("(?<=<iosPod name=\"OneSignalXCFramework\" version=\").+(?=\" addToAllTargets=\"true\" />)");
|
|
258
|
+
var dependenciesFilePath = Path.Combine(EditorFilesPath, DependenciesFilename);
|
|
259
|
+
|
|
260
|
+
if (!File.Exists(dependenciesFilePath)) {
|
|
261
|
+
Debug.LogError($"Could not find {DependenciesFilename}");
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var dependenciesFile = File.ReadAllText(dependenciesFilePath);
|
|
266
|
+
|
|
267
|
+
if (!versionRegex.IsMatch(dependenciesFile)) {
|
|
268
|
+
Debug.LogError($"Could not read current iOS framework dependency version from {DependenciesFilename}");
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
var version = versionRegex.Match(dependenciesFile)
|
|
273
|
+
.ToString();
|
|
274
|
+
|
|
275
|
+
podfile += $"target '{ServiceExtensionTargetName}' do\n pod 'OneSignalXCFramework', '{version}'\nend\n";
|
|
294
276
|
File.WriteAllText(podfilePath, podfile);
|
|
295
277
|
}
|
|
296
278
|
}
|
|
@@ -35,18 +35,12 @@ namespace OneSignalSDK {
|
|
|
35
35
|
|
|
36
36
|
public static string GetMainTargetGuid(this PBXProject project)
|
|
37
37
|
=> project.GetUnityMainTargetGuid();
|
|
38
|
-
|
|
39
|
-
public static string GetFrameworkGuid(this PBXProject project)
|
|
40
|
-
=> project.GetUnityFrameworkTargetGuid();
|
|
41
38
|
#else
|
|
42
39
|
public static string GetMainTargetName(this PBXProject project)
|
|
43
40
|
=> PBXProject.GetUnityTargetName();
|
|
44
41
|
|
|
45
42
|
public static string GetMainTargetGuid(this PBXProject project)
|
|
46
43
|
=> project.TargetGuidByName(PBXProject.GetUnityTargetName());
|
|
47
|
-
|
|
48
|
-
public static string GetFrameworkGuid(this PBXProject project)
|
|
49
|
-
=> GetPBXProjectTargetGuid(project);
|
|
50
44
|
#endif
|
|
51
45
|
}
|
|
52
46
|
}
|
|
@@ -48,20 +48,24 @@ namespace OneSignalSDK {
|
|
|
48
48
|
WaitingProxies[hashCode] = proxy;
|
|
49
49
|
return (proxy, hashCode);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
|
|
52
|
+
private static void ResolveCallbackProxy<TResponse>(int hashCode, TResponse response) {
|
|
53
|
+
if (!WaitingProxies.ContainsKey(hashCode))
|
|
54
|
+
return;
|
|
55
|
+
|
|
56
|
+
if (WaitingProxies[hashCode] is Later<TResponse> later)
|
|
55
57
|
later.Complete(response);
|
|
58
|
+
|
|
56
59
|
WaitingProxies.Remove(hashCode);
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
[AOT.MonoPInvokeCallback(typeof(BooleanResponseDelegate))]
|
|
63
|
+
private static void BooleanCallbackProxy(int hashCode, bool response)
|
|
64
|
+
=> ResolveCallbackProxy(hashCode, response);
|
|
65
|
+
|
|
59
66
|
[AOT.MonoPInvokeCallback(typeof(StringResponseDelegate))]
|
|
60
|
-
private static void StringCallbackProxy(int hashCode, string response)
|
|
61
|
-
|
|
62
|
-
later.Complete(response);
|
|
63
|
-
WaitingProxies.Remove(hashCode);
|
|
64
|
-
}
|
|
67
|
+
private static void StringCallbackProxy(int hashCode, string response)
|
|
68
|
+
=> ResolveCallbackProxy(hashCode, response);
|
|
65
69
|
|
|
66
70
|
/*
|
|
67
71
|
* Global Callbacks
|
|
@@ -134,19 +138,8 @@ namespace OneSignalSDK {
|
|
|
134
138
|
|
|
135
139
|
[AOT.MonoPInvokeCallback(typeof(StateListenerDelegate))]
|
|
136
140
|
private static void _onPermissionStateChanged(string current, string previous) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (!(Json.Deserialize(previous) is Dictionary<string, object> prevState)) {
|
|
143
|
-
SDKDebug.Error("Could not deserialize previous permission state");
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
var curr = (NotificationPermission)currState["status"];
|
|
148
|
-
var prev = (NotificationPermission)prevState["status"];
|
|
149
|
-
|
|
141
|
+
var curr = JsonUtility.FromJson<NotificationPermissionState>(current);
|
|
142
|
+
var prev = JsonUtility.FromJson<NotificationPermissionState>(previous);
|
|
150
143
|
_instance.NotificationPermissionChanged?.Invoke(curr, prev);
|
|
151
144
|
}
|
|
152
145
|
|
|
@@ -0,0 +1,80 @@
|
|
|
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 System;
|
|
29
|
+
|
|
30
|
+
namespace OneSignalSDK {
|
|
31
|
+
public sealed partial class OneSignalIOS : OneSignal {
|
|
32
|
+
[Serializable] private sealed class DeviceState {
|
|
33
|
+
public long notificationPermissionStatus;
|
|
34
|
+
|
|
35
|
+
public string userId;
|
|
36
|
+
public string pushToken;
|
|
37
|
+
public bool isSubscribed;
|
|
38
|
+
public bool isPushDisabled;
|
|
39
|
+
|
|
40
|
+
public string emailUserId;
|
|
41
|
+
public string emailAddress;
|
|
42
|
+
public bool isEmailSubscribed;
|
|
43
|
+
|
|
44
|
+
public string smsUserId;
|
|
45
|
+
public string smsNumber;
|
|
46
|
+
public bool isSMSSubscribed;
|
|
47
|
+
|
|
48
|
+
public static implicit operator PushSubscriptionState(DeviceState source)
|
|
49
|
+
=> new PushSubscriptionState {
|
|
50
|
+
userId = source.userId,
|
|
51
|
+
pushToken = source.pushToken,
|
|
52
|
+
isSubscribed = source.isSubscribed,
|
|
53
|
+
isPushDisabled = source.isPushDisabled,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
public static implicit operator EmailSubscriptionState(DeviceState source)
|
|
57
|
+
=> new EmailSubscriptionState {
|
|
58
|
+
emailUserId = source.emailUserId,
|
|
59
|
+
emailAddress = source.emailAddress,
|
|
60
|
+
isSubscribed = source.isEmailSubscribed,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
public static implicit operator SMSSubscriptionState(DeviceState source)
|
|
64
|
+
=> new SMSSubscriptionState {
|
|
65
|
+
smsUserId = source.smsUserId,
|
|
66
|
+
smsNumber = source.smsNumber,
|
|
67
|
+
isSubscribed = source.isSMSSubscribed,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[Serializable] private sealed class NotificationPermissionState {
|
|
72
|
+
public long status;
|
|
73
|
+
public bool provisional;
|
|
74
|
+
public bool hasPrompted;
|
|
75
|
+
|
|
76
|
+
public static implicit operator NotificationPermission(NotificationPermissionState source)
|
|
77
|
+
=> (NotificationPermission)source.status;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
package/Runtime/OneSignalIOS.cs
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
using System.Collections.Generic;
|
|
29
29
|
using System.Linq;
|
|
30
30
|
using System.Threading.Tasks;
|
|
31
|
+
using UnityEngine;
|
|
31
32
|
|
|
32
33
|
namespace OneSignalSDK {
|
|
33
34
|
public sealed partial class OneSignalIOS : OneSignal {
|
|
@@ -45,61 +46,19 @@ namespace OneSignalSDK {
|
|
|
45
46
|
|
|
46
47
|
public override NotificationPermission NotificationPermission {
|
|
47
48
|
get {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return (NotificationPermission) status;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
SDKDebug.Error("Could not deserialize device state for permissions");
|
|
54
|
-
return NotificationPermission.NotDetermined;
|
|
49
|
+
var deviceState = JsonUtility.FromJson<DeviceState>(_getDeviceState());
|
|
50
|
+
return (NotificationPermission)deviceState.notificationPermissionStatus;
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
public override PushSubscriptionState PushSubscriptionState
|
|
59
|
-
|
|
60
|
-
if (Json.Deserialize(_getDeviceState()) is Dictionary<string, object> deviceState) {
|
|
61
|
-
return new PushSubscriptionState {
|
|
62
|
-
userId = deviceState["userId"] as string,
|
|
63
|
-
pushToken = deviceState["pushToken"] as string,
|
|
64
|
-
isSubscribed = (bool) deviceState["isSubscribed"],
|
|
65
|
-
isPushDisabled = (bool) deviceState["isPushDisabled"],
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
SDKDebug.Error("Could not deserialize device state for push");
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
54
|
+
public override PushSubscriptionState PushSubscriptionState
|
|
55
|
+
=> JsonUtility.FromJson<DeviceState>(_getDeviceState());
|
|
73
56
|
|
|
74
|
-
public override EmailSubscriptionState EmailSubscriptionState
|
|
75
|
-
|
|
76
|
-
if (Json.Deserialize(_getDeviceState()) is Dictionary<string, object> deviceState) {
|
|
77
|
-
return new EmailSubscriptionState {
|
|
78
|
-
emailUserId = deviceState["emailUserId"] as string,
|
|
79
|
-
emailAddress = deviceState["emailAddress"] as string,
|
|
80
|
-
isSubscribed = (bool) deviceState["isEmailSubscribed"],
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
SDKDebug.Error("Could not deserialize device state for email");
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
57
|
+
public override EmailSubscriptionState EmailSubscriptionState
|
|
58
|
+
=> JsonUtility.FromJson<DeviceState>(_getDeviceState());
|
|
88
59
|
|
|
89
|
-
public override SMSSubscriptionState SMSSubscriptionState
|
|
90
|
-
|
|
91
|
-
if (Json.Deserialize(_getDeviceState()) is Dictionary<string, object> deviceState) {
|
|
92
|
-
return new SMSSubscriptionState {
|
|
93
|
-
smsUserId = deviceState["smsUserId"] as string,
|
|
94
|
-
smsNumber = deviceState["smsNumber"] as string,
|
|
95
|
-
isSubscribed = (bool) deviceState["isSMSSubscribed"],
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
SDKDebug.Error("Could not deserialize device state for sms");
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
60
|
+
public override SMSSubscriptionState SMSSubscriptionState
|
|
61
|
+
=> JsonUtility.FromJson<DeviceState>(_getDeviceState());
|
|
103
62
|
|
|
104
63
|
public override LogLevel LogLevel {
|
|
105
64
|
get => _logLevel;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.onesignal.unity.ios",
|
|
3
3
|
"displayName": "OneSignal Unity SDK - iOS",
|
|
4
|
-
"version": "3.0.0
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"unity": "2018.4",
|
|
6
6
|
"description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"com.onesignal.unity.core": "3.0.0
|
|
8
|
+
"com.onesignal.unity.core": "3.0.0"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"push-notifications",
|