com.onesignal.unity.ios 5.1.16 → 5.2.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.
@@ -1,5 +1,5 @@
1
- <dependencies>
1
+ <dependencies>
2
2
  <iosPods>
3
- <iosPod name="OneSignalXCFramework" version="5.2.16" addToAllTargets="true" />
3
+ <iosPod name="OneSignalXCFramework" version="5.4.0" addToAllTargets="true" />
4
4
  </iosPods>
5
5
  </dependencies>
@@ -249,4 +249,16 @@ extern "C" {
249
249
  void _oneSignalUserAddStateChangedCallback(UserStateListenerDelegate callback) {
250
250
  [[OneSignalUserStateObserver sharedUserObserver] setUserStateDelegate:callback];
251
251
  }
252
- }
252
+
253
+ void _oneSignalUserTrackEvent(const char *name, const char *propertiesJson) {
254
+ NSString *eventName = TO_NSSTRING(name);
255
+
256
+ if (propertiesJson != NULL) {
257
+ NSDictionary *properties =
258
+ oneSignalDictionaryFromJsonString(propertiesJson);
259
+ [OneSignal.User trackEventWithName:eventName properties:properties];
260
+ } else {
261
+ [OneSignal.User trackEventWithName:eventName properties:nil];
262
+ }
263
+ }
264
+ }
@@ -97,7 +97,7 @@ static bool swizzled = false;
97
97
 
98
98
  - (BOOL)oneSignalApplication:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
99
99
  [OneSignalWrapper setSdkType:@"unity"];
100
- [OneSignalWrapper setSdkVersion:@"005116"];
100
+ [OneSignalWrapper setSdkVersion:@"050200"];
101
101
  [OneSignal initialize:nil withLaunchOptions:launchOptions];
102
102
 
103
103
  if ([self respondsToSelector:@selector(oneSignalApplication:didFinishLaunchingWithOptions:)])
@@ -91,6 +91,9 @@ namespace OneSignalSDK.iOS.User
91
91
  UserStateListenerDelegate callback
92
92
  );
93
93
 
94
+ [DllImport("__Internal")]
95
+ private static extern void _oneSignalUserTrackEvent(string name, string propertiesJson);
96
+
94
97
  public delegate void UserStateListenerDelegate(string current);
95
98
 
96
99
  public event EventHandler<UserStateChangedEventArgs> Changed;
@@ -163,6 +166,14 @@ namespace OneSignalSDK.iOS.User
163
166
 
164
167
  public void RemoveSms(string sms) => _oneSignalUserRemoveSms(sms);
165
168
 
169
+ public void TrackEvent(string name, Dictionary<string, object> properties = null)
170
+ {
171
+ if (properties != null)
172
+ _oneSignalUserTrackEvent(name, Json.Serialize(properties));
173
+ else
174
+ _oneSignalUserTrackEvent(name, null);
175
+ }
176
+
166
177
  public void Initialize()
167
178
  {
168
179
  _pushSubscription.Initialize();
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": "5.1.16",
4
+ "version": "5.2.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": "5.1.16"
8
+ "com.onesignal.unity.core": "5.2.0"
9
9
  },
10
10
  "keywords": [
11
11
  "push-notifications",