com.onesignal.unity.ios 5.1.14 → 5.1.16
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 +129 -57
- package/Editor/OneSignaliOSDependencies.xml +4 -4
- package/Editor/PBXProjectExtensions.cs +16 -15
- package/Runtime/AssemblyInfo.cs +1 -1
- package/Runtime/OneSignaliOS.cs +82 -43
- package/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm +1 -1
- package/Runtime/Utilities/Later.cs +19 -11
- package/Runtime/Utilities/WaitingProxy.cs +15 -10
- package/Runtime/iOSDebugManager.cs +21 -12
- package/Runtime/iOSDisplayableNotification.cs +9 -7
- package/Runtime/iOSInAppMessagesManager.cs +84 -39
- package/Runtime/iOSLiveActivitiesManager.cs +60 -23
- package/Runtime/iOSLocationManager.cs +19 -10
- package/Runtime/iOSNotificationsManager.cs +111 -46
- package/Runtime/iOSPushSubscription.cs +40 -22
- package/Runtime/iOSSessionManager.cs +19 -14
- package/Runtime/iOSUserManager.cs +96 -58
- package/package.json +2 -2
|
@@ -2,26 +2,32 @@ using System;
|
|
|
2
2
|
using System.Runtime.CompilerServices;
|
|
3
3
|
using System.Threading.Tasks;
|
|
4
4
|
|
|
5
|
-
namespace Laters
|
|
5
|
+
namespace Laters
|
|
6
|
+
{
|
|
6
7
|
/// <summary>For referencing <see cref="ILater{TResult}"/> generically</summary>
|
|
7
|
-
public interface ILater {}
|
|
8
|
-
|
|
8
|
+
public interface ILater { }
|
|
9
|
+
|
|
9
10
|
/// <summary>Read-only interface for a standard <see cref="Later{TResult}"/></summary>
|
|
10
|
-
public interface ILater<TResult> : ILater
|
|
11
|
+
public interface ILater<TResult> : ILater
|
|
12
|
+
{
|
|
11
13
|
event Action<TResult> OnComplete;
|
|
12
14
|
TaskAwaiter<TResult> GetAwaiter();
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
/// <summary>Basic Later for passing a single type to callbacks and awaiters</summary>
|
|
16
|
-
public class Later<TResult> : BaseLater<TResult>
|
|
18
|
+
public class Later<TResult> : BaseLater<TResult>
|
|
19
|
+
{
|
|
17
20
|
public void Complete(TResult result) => _complete(result);
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
/// <summary>Separated implementation so the derivations can offer different methods for completion</summary>
|
|
21
|
-
public abstract class BaseLater<TResult> : ILater<TResult>
|
|
22
|
-
|
|
24
|
+
public abstract class BaseLater<TResult> : ILater<TResult>
|
|
25
|
+
{
|
|
26
|
+
public event Action<TResult> OnComplete
|
|
27
|
+
{
|
|
23
28
|
remove => _onComplete -= value;
|
|
24
|
-
add
|
|
29
|
+
add
|
|
30
|
+
{
|
|
25
31
|
if (_isComplete)
|
|
26
32
|
_onComplete += value;
|
|
27
33
|
else if (value != null)
|
|
@@ -29,7 +35,8 @@ namespace Laters {
|
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
public TaskAwaiter<TResult> GetAwaiter()
|
|
38
|
+
public TaskAwaiter<TResult> GetAwaiter()
|
|
39
|
+
{
|
|
33
40
|
if (_completionSource != null)
|
|
34
41
|
return _completionSource.Task.GetAwaiter();
|
|
35
42
|
|
|
@@ -43,7 +50,8 @@ namespace Laters {
|
|
|
43
50
|
return _completionSource.Task.GetAwaiter();
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
protected void _complete(TResult result)
|
|
53
|
+
protected void _complete(TResult result)
|
|
54
|
+
{
|
|
47
55
|
if (_isComplete)
|
|
48
56
|
return;
|
|
49
57
|
|
|
@@ -61,4 +69,4 @@ namespace Laters {
|
|
|
61
69
|
private bool _isComplete = false;
|
|
62
70
|
private TResult _result;
|
|
63
71
|
}
|
|
64
|
-
}
|
|
72
|
+
}
|
|
@@ -25,28 +25,33 @@
|
|
|
25
25
|
* THE SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
using Laters;
|
|
29
28
|
using System.Collections.Generic;
|
|
29
|
+
using Laters;
|
|
30
30
|
|
|
31
|
-
namespace OneSignalSDK.iOS.Utilities
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
namespace OneSignalSDK.iOS.Utilities
|
|
32
|
+
{
|
|
33
|
+
internal static class WaitingProxy
|
|
34
|
+
{
|
|
35
|
+
private static readonly Dictionary<int, ILater> WaitingProxies =
|
|
36
|
+
new Dictionary<int, ILater>();
|
|
34
37
|
|
|
35
|
-
public static (Later<TResult> proxy, int hashCode) _setupProxy<TResult>()
|
|
36
|
-
|
|
38
|
+
public static (Later<TResult> proxy, int hashCode) _setupProxy<TResult>()
|
|
39
|
+
{
|
|
40
|
+
var proxy = new Later<TResult>();
|
|
37
41
|
var hashCode = proxy.GetHashCode();
|
|
38
42
|
WaitingProxies[hashCode] = proxy;
|
|
39
43
|
return (proxy, hashCode);
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
public static void ResolveCallbackProxy<TResponse>(int hashCode, TResponse response)
|
|
46
|
+
public static void ResolveCallbackProxy<TResponse>(int hashCode, TResponse response)
|
|
47
|
+
{
|
|
43
48
|
if (!WaitingProxies.ContainsKey(hashCode))
|
|
44
49
|
return;
|
|
45
|
-
|
|
50
|
+
|
|
46
51
|
if (WaitingProxies[hashCode] is Later<TResponse> later)
|
|
47
52
|
later.Complete(response);
|
|
48
|
-
|
|
53
|
+
|
|
49
54
|
WaitingProxies.Remove(hashCode);
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
|
-
}
|
|
57
|
+
}
|
|
@@ -25,33 +25,42 @@
|
|
|
25
25
|
* THE SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
using UnityEngine;
|
|
29
28
|
using System.Runtime.InteropServices;
|
|
30
29
|
using OneSignalSDK.Debug;
|
|
31
30
|
using OneSignalSDK.Debug.Models;
|
|
31
|
+
using UnityEngine;
|
|
32
|
+
|
|
33
|
+
namespace OneSignalSDK.iOS.Debug
|
|
34
|
+
{
|
|
35
|
+
internal sealed class iOSDebugManager : IDebugManager
|
|
36
|
+
{
|
|
37
|
+
[DllImport("__Internal")]
|
|
38
|
+
private static extern void _oneSignalDebugSetLogLevel(int logLevel);
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[DllImport("__Internal")] private static extern void _oneSignalDebugSetLogLevel(int logLevel);
|
|
36
|
-
[DllImport("__Internal")] private static extern void _oneSignalDebugSetAlertLevel(int alertlLevel);
|
|
40
|
+
[DllImport("__Internal")]
|
|
41
|
+
private static extern void _oneSignalDebugSetAlertLevel(int alertlLevel);
|
|
37
42
|
|
|
38
43
|
private LogLevel _logLevel = LogLevel.Warn;
|
|
39
44
|
private LogLevel _alertLevel = LogLevel.None;
|
|
40
45
|
|
|
41
|
-
public LogLevel LogLevel
|
|
46
|
+
public LogLevel LogLevel
|
|
47
|
+
{
|
|
42
48
|
get => _logLevel;
|
|
43
|
-
set
|
|
49
|
+
set
|
|
50
|
+
{
|
|
44
51
|
_logLevel = value;
|
|
45
|
-
_oneSignalDebugSetLogLevel((int)
|
|
52
|
+
_oneSignalDebugSetLogLevel((int)value);
|
|
46
53
|
}
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
public LogLevel AlertLevel
|
|
56
|
+
public LogLevel AlertLevel
|
|
57
|
+
{
|
|
50
58
|
get => _alertLevel;
|
|
51
|
-
set
|
|
59
|
+
set
|
|
60
|
+
{
|
|
52
61
|
_alertLevel = value;
|
|
53
|
-
_oneSignalDebugSetAlertLevel((int)
|
|
62
|
+
_oneSignalDebugSetAlertLevel((int)value);
|
|
54
63
|
}
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
|
-
}
|
|
66
|
+
}
|
|
@@ -26,16 +26,18 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
using System;
|
|
29
|
-
using UnityEngine;
|
|
30
29
|
using System.Runtime.InteropServices;
|
|
31
30
|
using OneSignalSDK.Notifications.Internal;
|
|
32
31
|
using OneSignalSDK.Notifications.Models;
|
|
32
|
+
using UnityEngine;
|
|
33
33
|
|
|
34
|
-
namespace OneSignalSDK.iOS.Notifications.Models
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
namespace OneSignalSDK.iOS.Notifications.Models
|
|
35
|
+
{
|
|
36
|
+
public sealed class iOSDisplayableNotification : Notification, IDisplayableNotification
|
|
37
|
+
{
|
|
38
|
+
[DllImport("__Internal")]
|
|
39
|
+
private static extern void _oneSignalNotificationsDisplay(string notificationId);
|
|
37
40
|
|
|
38
|
-
public void Display()
|
|
39
|
-
=> _oneSignalNotificationsDisplay(this.NotificationId);
|
|
41
|
+
public void Display() => _oneSignalNotificationsDisplay(this.NotificationId);
|
|
40
42
|
}
|
|
41
|
-
}
|
|
43
|
+
}
|
|
@@ -25,30 +25,63 @@
|
|
|
25
25
|
* THE SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
using UnityEngine;
|
|
30
28
|
using System;
|
|
31
29
|
using System.Collections.Generic;
|
|
32
30
|
using System.Runtime.InteropServices;
|
|
33
31
|
using OneSignalSDK.InAppMessages;
|
|
34
|
-
using OneSignalSDK.InAppMessages.Models;
|
|
35
32
|
using OneSignalSDK.InAppMessages.Internal;
|
|
33
|
+
using OneSignalSDK.InAppMessages.Models;
|
|
34
|
+
using UnityEngine;
|
|
35
|
+
|
|
36
|
+
namespace OneSignalSDK.iOS.InAppMessages
|
|
37
|
+
{
|
|
38
|
+
internal sealed class iOSInAppMessagesManager : IInAppMessagesManager
|
|
39
|
+
{
|
|
40
|
+
[DllImport("__Internal")]
|
|
41
|
+
private static extern void _oneSignalInAppMessagesSetWillDisplayCallback(
|
|
42
|
+
StringListenerDelegate callback
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
[DllImport("__Internal")]
|
|
46
|
+
private static extern void _oneSignalInAppMessagesSetDidDisplayCallback(
|
|
47
|
+
StringListenerDelegate callback
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
[DllImport("__Internal")]
|
|
51
|
+
private static extern void _oneSignalInAppMessagesSetWillDismissCallback(
|
|
52
|
+
StringListenerDelegate callback
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
[DllImport("__Internal")]
|
|
56
|
+
private static extern void _oneSignalInAppMessagesSetDidDismissCallback(
|
|
57
|
+
StringListenerDelegate callback
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
[DllImport("__Internal")]
|
|
61
|
+
private static extern void _oneSignalInAppMessagesSetClickCallback(
|
|
62
|
+
ClickListenerDelegate callback
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
[DllImport("__Internal")]
|
|
66
|
+
private static extern void _oneSignalInAppMessagesSetPaused(bool paused);
|
|
67
|
+
|
|
68
|
+
[DllImport("__Internal")]
|
|
69
|
+
private static extern bool _oneSignalInAppMessagesGetPaused();
|
|
70
|
+
|
|
71
|
+
[DllImport("__Internal")]
|
|
72
|
+
private static extern void _oneSignalInAppMessagesAddTrigger(string key, string value);
|
|
73
|
+
|
|
74
|
+
[DllImport("__Internal")]
|
|
75
|
+
private static extern void _oneSignalInAppMessagesAddTriggers(string triggersJson);
|
|
76
|
+
|
|
77
|
+
[DllImport("__Internal")]
|
|
78
|
+
private static extern void _oneSignalInAppMessagesRemoveTrigger(string key);
|
|
79
|
+
|
|
80
|
+
[DllImport("__Internal")]
|
|
81
|
+
private static extern void _oneSignalInAppMessagesRemoveTriggers(string triggersJson);
|
|
36
82
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesSetWillDisplayCallback(StringListenerDelegate callback);
|
|
40
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesSetDidDisplayCallback(StringListenerDelegate callback);
|
|
41
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesSetWillDismissCallback(StringListenerDelegate callback);
|
|
42
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesSetDidDismissCallback(StringListenerDelegate callback);
|
|
43
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesSetClickCallback(ClickListenerDelegate callback);
|
|
44
|
-
|
|
45
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesSetPaused(bool paused);
|
|
46
|
-
[DllImport("__Internal")] private static extern bool _oneSignalInAppMessagesGetPaused();
|
|
47
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesAddTrigger(string key, string value);
|
|
48
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesAddTriggers(string triggersJson);
|
|
49
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesRemoveTrigger(string key);
|
|
50
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesRemoveTriggers(string triggersJson);
|
|
51
|
-
[DllImport("__Internal")] private static extern void _oneSignalInAppMessagesClearTriggers();
|
|
83
|
+
[DllImport("__Internal")]
|
|
84
|
+
private static extern void _oneSignalInAppMessagesClearTriggers();
|
|
52
85
|
|
|
53
86
|
private delegate void StringListenerDelegate(string response);
|
|
54
87
|
private delegate void ClickListenerDelegate(string message, string result, int urlType);
|
|
@@ -61,31 +94,32 @@ namespace OneSignalSDK.iOS.InAppMessages {
|
|
|
61
94
|
|
|
62
95
|
private static iOSInAppMessagesManager _instance;
|
|
63
96
|
|
|
64
|
-
public iOSInAppMessagesManager()
|
|
97
|
+
public iOSInAppMessagesManager()
|
|
98
|
+
{
|
|
65
99
|
_instance = this;
|
|
66
100
|
}
|
|
67
101
|
|
|
68
|
-
public bool Paused
|
|
102
|
+
public bool Paused
|
|
103
|
+
{
|
|
69
104
|
get => _oneSignalInAppMessagesGetPaused();
|
|
70
105
|
set => _oneSignalInAppMessagesSetPaused(value);
|
|
71
106
|
}
|
|
72
107
|
|
|
73
|
-
public void AddTrigger(string key, string value)
|
|
74
|
-
|
|
108
|
+
public void AddTrigger(string key, string value) =>
|
|
109
|
+
_oneSignalInAppMessagesAddTrigger(key, value.ToString());
|
|
75
110
|
|
|
76
|
-
public void AddTriggers(Dictionary<string, string> triggers)
|
|
77
|
-
|
|
111
|
+
public void AddTriggers(Dictionary<string, string> triggers) =>
|
|
112
|
+
_oneSignalInAppMessagesAddTriggers(Json.Serialize(triggers));
|
|
78
113
|
|
|
79
|
-
public void RemoveTrigger(string key)
|
|
80
|
-
=> _oneSignalInAppMessagesRemoveTrigger(key);
|
|
114
|
+
public void RemoveTrigger(string key) => _oneSignalInAppMessagesRemoveTrigger(key);
|
|
81
115
|
|
|
82
|
-
public void RemoveTriggers(params string[] keys)
|
|
83
|
-
|
|
116
|
+
public void RemoveTriggers(params string[] keys) =>
|
|
117
|
+
_oneSignalInAppMessagesRemoveTriggers(Json.Serialize(keys));
|
|
84
118
|
|
|
85
|
-
public void ClearTriggers()
|
|
86
|
-
=> _oneSignalInAppMessagesClearTriggers();
|
|
119
|
+
public void ClearTriggers() => _oneSignalInAppMessagesClearTriggers();
|
|
87
120
|
|
|
88
|
-
public void Initialize()
|
|
121
|
+
public void Initialize()
|
|
122
|
+
{
|
|
89
123
|
_oneSignalInAppMessagesSetWillDisplayCallback(_onWillDisplay);
|
|
90
124
|
_oneSignalInAppMessagesSetDidDisplayCallback(_onDidDisplay);
|
|
91
125
|
_oneSignalInAppMessagesSetWillDismissCallback(_onWillDismiss);
|
|
@@ -94,7 +128,8 @@ namespace OneSignalSDK.iOS.InAppMessages {
|
|
|
94
128
|
}
|
|
95
129
|
|
|
96
130
|
[AOT.MonoPInvokeCallback(typeof(StringListenerDelegate))]
|
|
97
|
-
private static void _onWillDisplay(string response)
|
|
131
|
+
private static void _onWillDisplay(string response)
|
|
132
|
+
{
|
|
98
133
|
var message = new InAppMessage(response);
|
|
99
134
|
InAppMessageWillDisplayEventArgs args = new InAppMessageWillDisplayEventArgs(message);
|
|
100
135
|
|
|
@@ -106,7 +141,8 @@ namespace OneSignalSDK.iOS.InAppMessages {
|
|
|
106
141
|
}
|
|
107
142
|
|
|
108
143
|
[AOT.MonoPInvokeCallback(typeof(StringListenerDelegate))]
|
|
109
|
-
private static void _onDidDisplay(string response)
|
|
144
|
+
private static void _onDidDisplay(string response)
|
|
145
|
+
{
|
|
110
146
|
var message = new InAppMessage(response);
|
|
111
147
|
InAppMessageDidDisplayEventArgs args = new InAppMessageDidDisplayEventArgs(message);
|
|
112
148
|
|
|
@@ -118,7 +154,8 @@ namespace OneSignalSDK.iOS.InAppMessages {
|
|
|
118
154
|
}
|
|
119
155
|
|
|
120
156
|
[AOT.MonoPInvokeCallback(typeof(StringListenerDelegate))]
|
|
121
|
-
private static void _onWillDismiss(string response)
|
|
157
|
+
private static void _onWillDismiss(string response)
|
|
158
|
+
{
|
|
122
159
|
var message = new InAppMessage(response);
|
|
123
160
|
InAppMessageWillDismissEventArgs args = new InAppMessageWillDismissEventArgs(message);
|
|
124
161
|
|
|
@@ -130,7 +167,8 @@ namespace OneSignalSDK.iOS.InAppMessages {
|
|
|
130
167
|
}
|
|
131
168
|
|
|
132
169
|
[AOT.MonoPInvokeCallback(typeof(StringListenerDelegate))]
|
|
133
|
-
private static void _onDidDismiss(string response)
|
|
170
|
+
private static void _onDidDismiss(string response)
|
|
171
|
+
{
|
|
134
172
|
var message = new InAppMessage(response);
|
|
135
173
|
InAppMessageDidDismissEventArgs args = new InAppMessageDidDismissEventArgs(message);
|
|
136
174
|
|
|
@@ -142,12 +180,18 @@ namespace OneSignalSDK.iOS.InAppMessages {
|
|
|
142
180
|
}
|
|
143
181
|
|
|
144
182
|
[AOT.MonoPInvokeCallback(typeof(ClickListenerDelegate))]
|
|
145
|
-
private static void _onClicked(string message, string result, int urlType)
|
|
183
|
+
private static void _onClicked(string message, string result, int urlType)
|
|
184
|
+
{
|
|
146
185
|
var mes = JsonUtility.FromJson<InAppMessage>(message);
|
|
147
186
|
var res = JsonUtility.FromJson<InAppMessageClickResult>(result);
|
|
148
187
|
|
|
149
188
|
var urlTarget = IntToInAppMessageActionUrlType(urlType);
|
|
150
|
-
var clickRes = new InAppMessageClickResult(
|
|
189
|
+
var clickRes = new InAppMessageClickResult(
|
|
190
|
+
res.ActionId,
|
|
191
|
+
urlTarget,
|
|
192
|
+
res.Url,
|
|
193
|
+
res.ClosingMessage
|
|
194
|
+
);
|
|
151
195
|
|
|
152
196
|
InAppMessageClickEventArgs args = new InAppMessageClickEventArgs(mes, clickRes);
|
|
153
197
|
|
|
@@ -158,7 +202,8 @@ namespace OneSignalSDK.iOS.InAppMessages {
|
|
|
158
202
|
}
|
|
159
203
|
}
|
|
160
204
|
|
|
161
|
-
public static InAppMessageActionUrlType IntToInAppMessageActionUrlType(int urlType)
|
|
205
|
+
public static InAppMessageActionUrlType IntToInAppMessageActionUrlType(int urlType)
|
|
206
|
+
{
|
|
162
207
|
switch (urlType)
|
|
163
208
|
{
|
|
164
209
|
case 0:
|
|
@@ -172,4 +217,4 @@ namespace OneSignalSDK.iOS.InAppMessages {
|
|
|
172
217
|
}
|
|
173
218
|
}
|
|
174
219
|
}
|
|
175
|
-
}
|
|
220
|
+
}
|
|
@@ -26,30 +26,57 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
using System.Collections.Generic;
|
|
29
|
-
using System.Threading.Tasks;
|
|
30
29
|
using System.Runtime.InteropServices;
|
|
31
|
-
using
|
|
30
|
+
using System.Threading.Tasks;
|
|
32
31
|
using OneSignalSDK.iOS.Utilities;
|
|
32
|
+
using OneSignalSDK.LiveActivities;
|
|
33
|
+
|
|
34
|
+
namespace OneSignalSDK.iOS.LiveActivities
|
|
35
|
+
{
|
|
36
|
+
internal sealed class iOSLiveActivitiesManager : ILiveActivitiesManager
|
|
37
|
+
{
|
|
38
|
+
[DllImport("__Internal")]
|
|
39
|
+
private static extern void _oneSignalSetupDefaultLiveActivity(string optionsJson);
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
[DllImport("__Internal")]
|
|
42
|
+
private static extern void _oneSignalStartDefaultLiveActivity(
|
|
43
|
+
string activityId,
|
|
44
|
+
string attributesJson,
|
|
45
|
+
string contentJson
|
|
46
|
+
);
|
|
40
47
|
|
|
41
|
-
[DllImport("__Internal")]
|
|
42
|
-
|
|
48
|
+
[DllImport("__Internal")]
|
|
49
|
+
private static extern void _oneSignalEnterLiveActivity(
|
|
50
|
+
string activityId,
|
|
51
|
+
string token,
|
|
52
|
+
int hashCode,
|
|
53
|
+
BooleanResponseDelegate callback
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
[DllImport("__Internal")]
|
|
57
|
+
private static extern void _oneSignalExitLiveActivity(
|
|
58
|
+
string activityId,
|
|
59
|
+
int hashCode,
|
|
60
|
+
BooleanResponseDelegate callback
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
[DllImport("__Internal")]
|
|
64
|
+
private static extern void _oneSignalSetPushToStartToken(string activityType, string token);
|
|
65
|
+
|
|
66
|
+
[DllImport("__Internal")]
|
|
67
|
+
private static extern void _oneSignalRemovePushToStartToken(string activityType);
|
|
43
68
|
|
|
44
69
|
private delegate void BooleanResponseDelegate(int hashCode, bool response);
|
|
45
70
|
|
|
46
|
-
public async Task<bool> EnterAsync(string activityId, string token)
|
|
71
|
+
public async Task<bool> EnterAsync(string activityId, string token)
|
|
72
|
+
{
|
|
47
73
|
var (proxy, hashCode) = WaitingProxy._setupProxy<bool>();
|
|
48
74
|
_oneSignalEnterLiveActivity(activityId, token, hashCode, BooleanCallbackProxy);
|
|
49
75
|
return await proxy;
|
|
50
76
|
}
|
|
51
77
|
|
|
52
|
-
public async Task<bool> ExitAsync(string activityId)
|
|
78
|
+
public async Task<bool> ExitAsync(string activityId)
|
|
79
|
+
{
|
|
53
80
|
var (proxy, hashCode) = WaitingProxy._setupProxy<bool>();
|
|
54
81
|
_oneSignalExitLiveActivity(activityId, hashCode, BooleanCallbackProxy);
|
|
55
82
|
return await proxy;
|
|
@@ -57,7 +84,7 @@ namespace OneSignalSDK.iOS.LiveActivities {
|
|
|
57
84
|
|
|
58
85
|
public void RemovePushToStartToken(string activityType)
|
|
59
86
|
{
|
|
60
|
-
|
|
87
|
+
_oneSignalRemovePushToStartToken(activityType);
|
|
61
88
|
}
|
|
62
89
|
|
|
63
90
|
public void SetPushToStartToken(string activityType, string token)
|
|
@@ -70,23 +97,33 @@ namespace OneSignalSDK.iOS.LiveActivities {
|
|
|
70
97
|
string optionsJson = null;
|
|
71
98
|
if (options != null)
|
|
72
99
|
{
|
|
73
|
-
optionsJson = Json.Serialize(
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
optionsJson = Json.Serialize(
|
|
101
|
+
new Dictionary<string, object>
|
|
102
|
+
{
|
|
103
|
+
{ "enablePushToStart", options.EnablePushToStart },
|
|
104
|
+
{ "enablePushToUpdate", options.EnablePushToUpdate },
|
|
105
|
+
}
|
|
106
|
+
);
|
|
78
107
|
}
|
|
79
108
|
|
|
80
109
|
_oneSignalSetupDefaultLiveActivity(optionsJson);
|
|
81
110
|
}
|
|
82
111
|
|
|
83
|
-
public void StartDefault(
|
|
112
|
+
public void StartDefault(
|
|
113
|
+
string activityId,
|
|
114
|
+
IDictionary<string, object> attributes,
|
|
115
|
+
IDictionary<string, object> content
|
|
116
|
+
)
|
|
84
117
|
{
|
|
85
|
-
_oneSignalStartDefaultLiveActivity(
|
|
118
|
+
_oneSignalStartDefaultLiveActivity(
|
|
119
|
+
activityId,
|
|
120
|
+
Json.Serialize(attributes),
|
|
121
|
+
Json.Serialize(content)
|
|
122
|
+
);
|
|
86
123
|
}
|
|
87
124
|
|
|
88
125
|
[AOT.MonoPInvokeCallback(typeof(BooleanResponseDelegate))]
|
|
89
|
-
private static void BooleanCallbackProxy(int hashCode, bool response)
|
|
90
|
-
|
|
126
|
+
private static void BooleanCallbackProxy(int hashCode, bool response) =>
|
|
127
|
+
WaitingProxy.ResolveCallbackProxy(hashCode, response);
|
|
91
128
|
}
|
|
92
|
-
}
|
|
129
|
+
}
|
|
@@ -25,24 +25,33 @@
|
|
|
25
25
|
* THE SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
using
|
|
28
|
+
using System.Runtime.InteropServices;
|
|
29
29
|
using System.Threading.Tasks;
|
|
30
30
|
using OneSignalSDK.Location;
|
|
31
|
-
using
|
|
31
|
+
using UnityEngine;
|
|
32
|
+
|
|
33
|
+
namespace OneSignalSDK.iOS.Location
|
|
34
|
+
{
|
|
35
|
+
internal sealed class iOSLocationManager : ILocationManager
|
|
36
|
+
{
|
|
37
|
+
[DllImport("__Internal")]
|
|
38
|
+
private static extern bool _oneSignalLocationGetIsShared();
|
|
39
|
+
|
|
40
|
+
[DllImport("__Internal")]
|
|
41
|
+
private static extern void _oneSignalLocationSetIsShared(bool shared);
|
|
32
42
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[DllImport("__Internal")] private static extern bool _oneSignalLocationGetIsShared();
|
|
36
|
-
[DllImport("__Internal")] private static extern void _oneSignalLocationSetIsShared(bool shared);
|
|
37
|
-
[DllImport("__Internal")] private static extern void _oneSignalLocationRequestPermission();
|
|
43
|
+
[DllImport("__Internal")]
|
|
44
|
+
private static extern void _oneSignalLocationRequestPermission();
|
|
38
45
|
|
|
39
|
-
public bool IsShared
|
|
46
|
+
public bool IsShared
|
|
47
|
+
{
|
|
40
48
|
get => _oneSignalLocationGetIsShared();
|
|
41
49
|
set => _oneSignalLocationSetIsShared(value);
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
public void RequestPermission()
|
|
52
|
+
public void RequestPermission()
|
|
53
|
+
{
|
|
45
54
|
_oneSignalLocationRequestPermission();
|
|
46
55
|
}
|
|
47
56
|
}
|
|
48
|
-
}
|
|
57
|
+
}
|