Skip to content

Commit c4ae2d3

Browse files
committed
Simplified delegate check and updated unitypackage
1 parent 8e2daaf commit c4ae2d3

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

OneSignalExample/Assets/OneSignal/src/OneSignal.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#define ONESIGNAL_PLATFORM
3030
#endif
3131

32+
#define ONESIGNAL_PLATFORM
33+
3234
#if !UNITY_EDITOR && UNITY_ANDROID
3335
#define ANDROID_ONLY
3436
#endif
@@ -1193,17 +1195,12 @@ private bool isValidDelegate(Dictionary<string, object> jsonObject) {
11931195

11941196
// Some functions have a 'success' and 'failure' delegates, so this validates nothing is missing the json response
11951197
private bool isValidSuccessFailureDelegate(Dictionary<string, object> jsonObject) {
1196-
// Make sure 'delegate_id' 'success' and 'failure' exist
1197-
if (!jsonObject.ContainsKey("delegate_id")) {
1198+
if (!isValidDelegate(jsonObject))
11981199
return false;
1199-
} else {
1200-
var delegateId = Json.Deserialize(jsonObject["delegate_id"] as string) as Dictionary<string, object>;
1201-
if (!delegateId.ContainsKey("success") || !delegateId.ContainsKey("failure"))
1202-
return false;
1203-
}
12041200

1205-
// Make sure 'response' exists
1206-
if (!jsonObject.ContainsKey("response") || jsonObject["response"] == null)
1201+
// Make sure success and failure delegate exist
1202+
var delegateId = Json.Deserialize(jsonObject["delegate_id"] as string) as Dictionary<string, object>;
1203+
if (!delegateId.ContainsKey("success") || !delegateId.ContainsKey("failure"))
12071204
return false;
12081205

12091206
return true;

OneSignalSDK.unitypackage

-101 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)