com.onesignal.unity.ios 5.0.0-beta.2 → 5.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.
Files changed (33) hide show
  1. package/Editor/BuildPostProcessor.cs +1 -1
  2. package/Editor/OneSignaliOSDependencies.xml +1 -1
  3. package/Editor/PBXProjectExtensions.cs +1 -1
  4. package/LICENSE.md +1 -1
  5. package/Runtime/AssemblyInfo.cs +1 -1
  6. package/Runtime/OneSignaliOS.cs +26 -44
  7. package/Runtime/OneSignaliOSInit.cs +2 -2
  8. package/Runtime/Plugins/iOS/OneSignalBridgeUtil.h +4 -3
  9. package/Runtime/Plugins/iOS/OneSignalBridgeUtil.mm +20 -10
  10. package/Runtime/Plugins/iOS/OneSignalUnityBridge.mm +5 -32
  11. package/Runtime/Plugins/iOS/OneSignalUnityBridgeDebug.mm +1 -1
  12. package/Runtime/Plugins/iOS/OneSignalUnityBridgeInAppMessages.mm +26 -29
  13. package/Runtime/Plugins/iOS/OneSignalUnityBridgeLiveActivities.mm +58 -0
  14. package/Runtime/Plugins/iOS/OneSignalUnityBridgeLiveActivities.mm.meta +37 -0
  15. package/Runtime/Plugins/iOS/OneSignalUnityBridgeLocation.mm +1 -1
  16. package/Runtime/Plugins/iOS/OneSignalUnityBridgeNotifications.mm +62 -23
  17. package/Runtime/Plugins/iOS/OneSignalUnityBridgeSession.mm +1 -1
  18. package/Runtime/Plugins/iOS/OneSignalUnityBridgeUser.mm +8 -24
  19. package/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.h +1 -1
  20. package/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm +1 -1
  21. package/Runtime/Utilities/WaitingProxy.cs +1 -1
  22. package/Runtime/iOSDebugManager.cs +1 -1
  23. package/Runtime/iOSDisplayableNotification.cs +41 -0
  24. package/Runtime/iOSDisplayableNotification.cs.meta +11 -0
  25. package/Runtime/iOSInAppMessagesManager.cs +84 -27
  26. package/Runtime/iOSLiveActivitiesManager.cs +56 -0
  27. package/Runtime/iOSLiveActivitiesManager.cs.meta +11 -0
  28. package/Runtime/iOSLocationManager.cs +2 -2
  29. package/Runtime/iOSNotificationsManager.cs +77 -52
  30. package/Runtime/iOSPushSubscription.cs +15 -4
  31. package/Runtime/iOSSessionManager.cs +1 -1
  32. package/Runtime/iOSUserManager.cs +1 -1
  33. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
1
1
  <dependencies>
2
2
  <iosPods>
3
- <iosPod name="OneSignalXCFramework" version="5.0.0-beta-02" addToAllTargets="true" />
3
+ <iosPod name="OneSignalXCFramework" version="5.0.1" addToAllTargets="true" />
4
4
  </iosPods>
5
5
  </dependencies>
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Modified MIT License
2
2
 
3
- Copyright 2020 OneSignal
3
+ Copyright 2023 OneSignal
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -25,18 +25,11 @@
25
25
  * THE SOFTWARE.
26
26
  */
27
27
 
28
- using System.Collections.Generic;
28
+ using UnityEngine;
29
29
  using System.Linq;
30
30
  using System.Threading.Tasks;
31
- using UnityEngine;
31
+ using System.Collections.Generic;
32
32
  using System.Runtime.InteropServices;
33
- using OneSignalSDK.iOS.Notifications;
34
- using OneSignalSDK.iOS.InAppMessages;
35
- using OneSignalSDK.iOS.Debug;
36
- using OneSignalSDK.iOS.Location;
37
- using OneSignalSDK.iOS.Session;
38
- using OneSignalSDK.iOS.User;
39
- using OneSignalSDK.iOS.Utilities;
40
33
  using OneSignalSDK.Notifications;
41
34
  using OneSignalSDK.InAppMessages;
42
35
  using OneSignalSDK.Debug;
@@ -44,22 +37,23 @@ using OneSignalSDK.Debug.Utilities;
44
37
  using OneSignalSDK.Location;
45
38
  using OneSignalSDK.Session;
46
39
  using OneSignalSDK.User;
40
+ using OneSignalSDK.LiveActivities;
41
+ using OneSignalSDK.iOS.Notifications;
42
+ using OneSignalSDK.iOS.InAppMessages;
43
+ using OneSignalSDK.iOS.Debug;
44
+ using OneSignalSDK.iOS.Location;
45
+ using OneSignalSDK.iOS.Session;
46
+ using OneSignalSDK.iOS.User;
47
+ using OneSignalSDK.iOS.LiveActivities;
47
48
 
48
49
  namespace OneSignalSDK.iOS {
49
- public sealed partial class OneSignaliOS : OneSignal {
50
- [DllImport("__Internal")] private static extern bool _getPrivacyConsent();
51
- [DllImport("__Internal")] private static extern void _setPrivacyConsent(bool consent);
52
- [DllImport("__Internal")] private static extern bool _getRequiresPrivacyConsent();
53
- [DllImport("__Internal")] private static extern void _setRequiresPrivacyConsent(bool required);
54
- [DllImport("__Internal")] private static extern void _setLaunchURLsInApp(bool launchInApp);
50
+ public sealed partial class OneSignaliOS : OneSignalPlatform {
51
+ [DllImport("__Internal")] private static extern void _setConsentGiven(bool consent);
52
+ [DllImport("__Internal")] private static extern void _setConsentRequired(bool required);
55
53
  [DllImport("__Internal")] private static extern void _initialize(string appId);
56
54
  [DllImport("__Internal")] private static extern void _login(string externalId);
57
55
  [DllImport("__Internal")] private static extern void _loginWithJwtBearerToken(string externalId, string jwtBearerToken);
58
56
  [DllImport("__Internal")] private static extern void _logout();
59
- [DllImport("__Internal")] private static extern void _enterLiveActivity(string activityId, string token, int hashCode, BooleanResponseDelegate callback);
60
- [DllImport("__Internal")] private static extern void _exitLiveActivity(string activityId, int hashCode, BooleanResponseDelegate callback);
61
-
62
- private delegate void BooleanResponseDelegate(int hashCode, bool response);
63
57
 
64
58
  private iOSUserManager _user;
65
59
  private iOSSessionManager _session;
@@ -67,6 +61,7 @@ namespace OneSignalSDK.iOS {
67
61
  private iOSLocationManager _location;
68
62
  private iOSInAppMessagesManager _inAppMessages;
69
63
  private iOSDebugManager _debug;
64
+ private iOSLiveActivitiesManager _liveActivities;
70
65
 
71
66
  private static OneSignaliOS _instance;
72
67
 
@@ -105,18 +100,17 @@ namespace OneSignalSDK.iOS {
105
100
  get => _debug;
106
101
  }
107
102
 
108
- public override bool PrivacyConsent {
109
- get => _getPrivacyConsent();
110
- set => _setPrivacyConsent(value);
103
+ public override ILiveActivitiesManager LiveActivities {
104
+ get => _liveActivities;
111
105
  }
112
106
 
113
- public override bool RequiresPrivacyConsent {
114
- get => _getRequiresPrivacyConsent();
115
- set => _setRequiresPrivacyConsent(value);
107
+ public override bool ConsentGiven {
108
+ set => _setConsentGiven(value);
116
109
  }
117
110
 
118
- public override void SetLaunchURLsInApp(bool launchInApp)
119
- => _setLaunchURLsInApp(launchInApp);
111
+ public override bool ConsentRequired {
112
+ set => _setConsentRequired(value);
113
+ }
120
114
 
121
115
  public override void Initialize(string appId) {
122
116
  _initialize(appId);
@@ -144,6 +138,10 @@ namespace OneSignalSDK.iOS {
144
138
  _session = new iOSSessionManager();
145
139
  }
146
140
 
141
+ if (_liveActivities == null) {
142
+ _liveActivities = new iOSLiveActivitiesManager();
143
+ }
144
+
147
145
  _completedInit(appId);
148
146
  }
149
147
 
@@ -158,21 +156,5 @@ namespace OneSignalSDK.iOS {
158
156
  public override void Logout() {
159
157
  _logout();
160
158
  }
161
-
162
- public override async Task<bool> EnterLiveActivity(string activityId, string token) {
163
- var (proxy, hashCode) = WaitingProxy._setupProxy<bool>();
164
- _enterLiveActivity(activityId, token, hashCode, BooleanCallbackProxy);
165
- return await proxy;
166
- }
167
-
168
- public override async Task<bool> ExitLiveActivity(string activityId) {
169
- var (proxy, hashCode) = WaitingProxy._setupProxy<bool>();
170
- _exitLiveActivity(activityId, hashCode, BooleanCallbackProxy);
171
- return await proxy;
172
- }
173
-
174
- [AOT.MonoPInvokeCallback(typeof(BooleanResponseDelegate))]
175
- private static void BooleanCallbackProxy(int hashCode, bool response)
176
- => WaitingProxy.ResolveCallbackProxy(hashCode, response);
177
159
  }
178
160
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -34,7 +34,7 @@ namespace OneSignalSDK.iOS {
34
34
  /// </summary>
35
35
  internal static class OneSignaliOSInit {
36
36
  [RuntimeInitializeOnLoadMethod] public static void Init() {
37
- if (!OneSignal.DidInitialize)
37
+ if (!OneSignalPlatform.DidInitialize)
38
38
  OneSignal.Default = new OneSignaliOS();
39
39
  }
40
40
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -27,9 +27,10 @@
27
27
 
28
28
  #import <UIKit/UIKit.h>
29
29
 
30
- @interface OneSignalBridgeUtil
30
+ @interface OneSignalBridgeUtil : NSObject
31
31
 
32
32
  const char* jsonStringFromDictionary(NSDictionary *dictionary);
33
- // TObj objFromJsonString(const char* jsonString);
33
+ NSDictionary* dictionaryFromJsonString(const char* jsonString);
34
+ NSArray* arrayFromJsonString(const char* jsonString);
34
35
 
35
36
  @end
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -28,6 +28,7 @@
28
28
  #import "OneSignalBridgeUtil.h"
29
29
 
30
30
  @implementation OneSignalBridgeUtil
31
+
31
32
  const char* jsonStringFromDictionary(NSDictionary *dictionary) {
32
33
  NSError *error;
33
34
  NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:&error];
@@ -35,15 +36,24 @@ const char* jsonStringFromDictionary(NSDictionary *dictionary) {
35
36
  return [jsonString UTF8String];
36
37
  }
37
38
 
38
- // template <typename TObj>
39
- // TObj objFromJsonString(const char* jsonString) {
40
- // NSData* jsonData = [[NSString stringWithUTF8String:jsonString] dataUsingEncoding:NSUTF8StringEncoding];
41
- // NSError* error = nil;
42
- // TObj arr = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
39
+ template <typename TObj>
40
+ TObj objFromJsonString(const char* jsonString) {
41
+ NSData* jsonData = [[NSString stringWithUTF8String:jsonString] dataUsingEncoding:NSUTF8StringEncoding];
42
+ NSError* error = nil;
43
+ TObj arr = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
44
+
45
+ if (error != nil)
46
+ return nil;
47
+
48
+ return arr;
49
+ }
43
50
 
44
- // if (error != nil)
45
- // return nil;
51
+ NSDictionary* dictionaryFromJsonString(const char* jsonString) {
52
+ return objFromJsonString<NSDictionary*>(jsonString);
53
+ }
54
+
55
+ NSArray* arrayFromJsonString(const char* jsonString) {
56
+ return objFromJsonString<NSArray*>(jsonString);
57
+ }
46
58
 
47
- // return arr;
48
- // }
49
59
  @end
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,6 @@
29
29
  #import <OneSignalUser/OneSignalUser-Swift.h>
30
30
  #import <OneSignalFramework/OneSignalFramework.h>
31
31
 
32
- typedef void (*BooleanResponseDelegate)(int hashCode, bool response);
33
-
34
32
  /*
35
33
  * Helpers
36
34
  */
@@ -59,36 +57,11 @@ extern "C" {
59
57
  [OneSignal logout];
60
58
  }
61
59
 
62
- bool _getPrivacyConsent() {
63
- return OneSignal.getPrivacyConsent;
64
- }
65
-
66
- void _setPrivacyConsent(bool consent) {
67
- [OneSignal setPrivacyConsent:consent];
68
- }
69
-
70
- bool _getRequiresPrivacyConsent() {
71
- return [OneSignal requiresPrivacyConsent];
72
- }
73
-
74
- void _setRequiresPrivacyConsent(bool required) {
75
- [OneSignal setRequiresPrivacyConsent:required];
76
- }
77
-
78
- void _setLaunchURLsInApp(bool launchInApp) {
79
- [OneSignal setLaunchURLsInApp:launchInApp];
80
- }
81
-
82
- void _enterLiveActivity(const char* activityId, const char* token, int hashCode, BooleanResponseDelegate callback) {
83
- [OneSignal enterLiveActivity:TO_NSSTRING(activityId)
84
- withToken:TO_NSSTRING(token)
85
- withSuccess:^(NSDictionary *result) { CALLBACK(YES); }
86
- withFailure:^(NSError *error) { CALLBACK(NO); }];
60
+ void _setConsentGiven(bool consent) {
61
+ [OneSignal setConsentGiven:consent];
87
62
  }
88
63
 
89
- void _exitLiveActivity(const char* activityId, int hashCode, BooleanResponseDelegate callback) {
90
- [OneSignal exitLiveActivity:TO_NSSTRING(activityId)
91
- withSuccess:^(NSDictionary *result) { CALLBACK(YES); }
92
- withFailure:^(NSError *error) { CALLBACK(NO); }];
64
+ void _setConsentRequired(bool required) {
65
+ [OneSignal setConsentRequired:required];
93
66
  }
94
67
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -31,6 +31,7 @@
31
31
  #import "OneSignalBridgeUtil.h"
32
32
 
33
33
  typedef void (*StringListenerDelegate)(const char* response);
34
+ typedef void (*ClickListenerDelegate)(const char* message, const char* result, int urlType);
34
35
 
35
36
  /*
36
37
  * Helpers
@@ -39,29 +40,18 @@ typedef void (*StringListenerDelegate)(const char* response);
39
40
  #define CALLBACK(value) callback(hashCode, value)
40
41
  #define TO_NSSTRING(cstr) cstr ? [NSString stringWithUTF8String:cstr] : nil
41
42
 
42
- template <typename TObj>
43
- TObj objFromJsonString(const char* jsonString) {
44
- NSData* jsonData = [[NSString stringWithUTF8String:jsonString] dataUsingEncoding:NSUTF8StringEncoding];
45
- NSError* error = nil;
46
- TObj arr = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
47
-
48
- if (error != nil)
49
- return nil;
50
-
51
- return arr;
52
- }
53
-
54
43
  /*
55
44
  * Observer singleton for global callbacks
56
45
  */
57
46
 
58
- @interface OneSignalInAppMessagesObserver : NSObject <OSInAppMessageLifecycleHandler>
47
+ @interface OneSignalInAppMessagesObserver : NSObject <OSInAppMessageLifecycleListener, OSInAppMessageClickListener>
59
48
 
60
49
  + (instancetype) sharedInAppMessagesObserver;
61
50
  @property StringListenerDelegate willDisplayDelegate;
62
51
  @property StringListenerDelegate didDisplayDelegate;
63
52
  @property StringListenerDelegate willDismissDelegate;
64
53
  @property StringListenerDelegate didDismissDelegate;
54
+ @property ClickListenerDelegate clickDelegate;
65
55
 
66
56
  @end
67
57
 
@@ -78,30 +68,39 @@ TObj objFromJsonString(const char* jsonString) {
78
68
 
79
69
  - (instancetype) init {
80
70
  if (self = [super init]) {
81
- [OneSignal.InAppMessages setLifecycleHandler:self];
71
+ [OneSignal.InAppMessages addLifecycleListener:self];
72
+ [OneSignal.InAppMessages addClickListener:self];
82
73
  }
83
74
 
84
75
  return self;
85
76
  }
86
77
 
87
- - (void)onWillDisplayInAppMessage:(OSInAppMessage *)message {
78
+ - (void)onWillDisplayInAppMessage:(OSInAppMessageWillDisplayEvent *)event {
88
79
  if (_willDisplayDelegate != nil)
89
- _willDisplayDelegate([message.messageId UTF8String]);
80
+ _willDisplayDelegate([event.message.messageId UTF8String]);
90
81
  }
91
82
 
92
- - (void)onDidDisplayInAppMessage:(OSInAppMessage *)message {
83
+ - (void)onDidDisplayInAppMessage:(OSInAppMessageDidDisplayEvent *)event {
93
84
  if (_didDisplayDelegate != nil)
94
- _didDisplayDelegate([message.messageId UTF8String]);
85
+ _didDisplayDelegate([event.message.messageId UTF8String]);
95
86
  }
96
87
 
97
- - (void)onWillDismissInAppMessage:(OSInAppMessage *)message {
88
+ - (void)onWillDismissInAppMessage:(OSInAppMessageWillDismissEvent *)event {
98
89
  if (_willDismissDelegate != nil)
99
- _willDismissDelegate([message.messageId UTF8String]);
90
+ _willDismissDelegate([event.message.messageId UTF8String]);
100
91
  }
101
92
 
102
- - (void)onDidDismissInAppMessage:(OSInAppMessage *)message {
93
+ - (void)onDidDismissInAppMessage:(OSInAppMessageDidDismissEvent *)event {
103
94
  if (_didDismissDelegate != nil)
104
- _didDismissDelegate([message.messageId UTF8String]);
95
+ _didDismissDelegate([event.message.messageId UTF8String]);
96
+ }
97
+
98
+ - (void)onClickInAppMessage:(OSInAppMessageClickEvent * _Nonnull)event {
99
+ if (_clickDelegate != nil) {
100
+ auto message = jsonStringFromDictionary([[event message] jsonRepresentation]);
101
+ auto result = jsonStringFromDictionary([[event result] jsonRepresentation]);
102
+ _clickDelegate(message, result, event.result.urlTarget);
103
+ }
105
104
  }
106
105
 
107
106
  @end
@@ -127,10 +126,8 @@ extern "C" {
127
126
  [[OneSignalInAppMessagesObserver sharedInAppMessagesObserver] setDidDismissDelegate:callback];
128
127
  }
129
128
 
130
- void _inAppMessagesSetClickedCallback(StringListenerDelegate callback) {
131
- [OneSignal.InAppMessages setClickHandler:^(OSInAppMessageAction * _Nonnull action) {
132
- callback(jsonStringFromDictionary([action jsonRepresentation]));
133
- }];
129
+ void _inAppMessagesSetClickCallback(ClickListenerDelegate callback) {
130
+ [[OneSignalInAppMessagesObserver sharedInAppMessagesObserver] setClickDelegate:callback];
134
131
  }
135
132
 
136
133
  void _inAppMessagesSetPaused(bool paused) {
@@ -146,7 +143,7 @@ extern "C" {
146
143
  }
147
144
 
148
145
  void _inAppMessagesAddTriggers(const char* triggersJson) {
149
- NSDictionary *triggers = objFromJsonString<NSDictionary*>(triggersJson);
146
+ NSDictionary *triggers = dictionaryFromJsonString(triggersJson);
150
147
 
151
148
  [OneSignal.InAppMessages addTriggers:triggers];
152
149
  }
@@ -156,7 +153,7 @@ extern "C" {
156
153
  }
157
154
 
158
155
  void _inAppMessagesRemoveTriggers(const char* triggersJson) {
159
- NSArray *triggers = objFromJsonString<NSArray*>(triggersJson);
156
+ NSArray *triggers = arrayFromJsonString(triggersJson);
160
157
 
161
158
  [OneSignal.InAppMessages removeTriggers:triggers];
162
159
  }
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Modified MIT License
3
+ *
4
+ * Copyright 2023 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
+ #import <OneSignalNotifications/OneSignalNotifications.h>
29
+ #import <OneSignalUser/OneSignalUser-Swift.h>
30
+ #import <OneSignalFramework/OneSignalFramework.h>
31
+
32
+ typedef void (*BooleanResponseDelegate)(int hashCode, bool response);
33
+
34
+ /*
35
+ * Helpers
36
+ */
37
+
38
+ #define CALLBACK(value) callback(hashCode, value)
39
+ #define TO_NSSTRING(cstr) cstr ? [NSString stringWithUTF8String:cstr] : nil
40
+
41
+ /*
42
+ * Bridge methods
43
+ */
44
+
45
+ extern "C" {
46
+ void _enterLiveActivity(const char* activityId, const char* token, int hashCode, BooleanResponseDelegate callback) {
47
+ [OneSignal.LiveActivities enter:TO_NSSTRING(activityId)
48
+ withToken:TO_NSSTRING(token)
49
+ withSuccess:^(NSDictionary *result) { CALLBACK(YES); }
50
+ withFailure:^(NSError *error) { CALLBACK(NO); }];
51
+ }
52
+
53
+ void _exitLiveActivity(const char* activityId, int hashCode, BooleanResponseDelegate callback) {
54
+ [OneSignal.LiveActivities exit:TO_NSSTRING(activityId)
55
+ withSuccess:^(NSDictionary *result) { CALLBACK(YES); }
56
+ withFailure:^(NSError *error) { CALLBACK(NO); }];
57
+ }
58
+ }
@@ -0,0 +1,37 @@
1
+ fileFormatVersion: 2
2
+ guid: af87776925bf8438bba2006c390b5306
3
+ PluginImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ iconMap: {}
7
+ executionOrder: {}
8
+ defineConstraints: []
9
+ isPreloaded: 0
10
+ isOverridable: 1
11
+ isExplicitlyReferenced: 0
12
+ validateReferences: 1
13
+ platformData:
14
+ - first:
15
+ Any:
16
+ second:
17
+ enabled: 0
18
+ settings: {}
19
+ - first:
20
+ Editor: Editor
21
+ second:
22
+ enabled: 0
23
+ settings:
24
+ DefaultValueInitialized: true
25
+ - first:
26
+ iPhone: iOS
27
+ second:
28
+ enabled: 1
29
+ settings: {}
30
+ - first:
31
+ tvOS: tvOS
32
+ second:
33
+ enabled: 1
34
+ settings: {}
35
+ userData:
36
+ assetBundleName:
37
+ assetBundleVariant:
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Modified MIT License
3
3
  *
4
- * Copyright 2022 OneSignal
4
+ * Copyright 2023 OneSignal
5
5
  *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal