From 8415830f7e4b827649cbc9ac48a276340e453106 Mon Sep 17 00:00:00 2001 From: dmitry ovchinikov Date: Mon, 4 Apr 2022 14:46:44 +0300 Subject: [PATCH] UserInvite iOS fix & initSDKWithCall OneLinkID fix - Added NSNull checks inside the generateInviteLink to avoid sending parameters. - Added an NSNull check to appInviteOneLink inside initSDKWithCall to avoid adding a value. - Aligned the parameter name of the user invite URL to userInviteURL instead of userInviteUrl on the Android side. --- .../appsflyersdk/AppsflyerSdkPlugin.java | 2 +- ios/Classes/AppsflyerSdkPlugin.m | 26 +++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/appsflyer/appsflyersdk/AppsflyerSdkPlugin.java b/android/src/main/java/com/appsflyer/appsflyersdk/AppsflyerSdkPlugin.java index b03eb7a..ee72286 100644 --- a/android/src/main/java/com/appsflyer/appsflyersdk/AppsflyerSdkPlugin.java +++ b/android/src/main/java/com/appsflyer/appsflyersdk/AppsflyerSdkPlugin.java @@ -466,7 +466,7 @@ private void generateInviteLink(MethodCall call, Result rawResult) { public void onResponse(final String oneLinkUrl) { if (mCallbacks.containsKey("generateInviteLinkSuccess")) { try { - obj.put("userInviteUrl", oneLinkUrl); + obj.put("userInviteURL", oneLinkUrl); runOnUIThread(obj, "generateInviteLinkSuccess", AF_SUCCESS); } catch (JSONException e) { e.printStackTrace(); diff --git a/ios/Classes/AppsflyerSdkPlugin.m b/ios/Classes/AppsflyerSdkPlugin.m index 2c2b0d3..2eb41f4 100644 --- a/ios/Classes/AppsflyerSdkPlugin.m +++ b/ios/Classes/AppsflyerSdkPlugin.m @@ -256,8 +256,30 @@ - (void)generateInviteLink:(FlutterMethodCall*)call result:(FlutterResult)result NSString* referrerName = call.arguments[@"referrerName"]; NSString* channel = call.arguments[@"channel"]; NSString* campaign = call.arguments[@"campaign"]; - NSDictionary* customParams = call.arguments[@"customParams"]; + + //Explicitly setting the values of the parameters to be nil in case they are initially received as . + if (customerID == [NSNull null]) { + customerID = nil; + } + if (referrerImageUrl == [NSNull null]) { + referrerImageUrl = nil; + } + if (brandDomain == [NSNull null]) { + brandDomain = nil; + } + if (baseDeeplink == [NSNull null]) { + baseDeeplink = nil; + } + if (referrerName == [NSNull null]) { + referrerName = nil; + } + if (channel == [NSNull null]) { + channel = nil; + } + if (campaign == [NSNull null]) { + campaign = nil; + } if(customParams == [NSNull null]){ customParams = nil; }; @@ -511,7 +533,7 @@ - (void)initSdkWithCall:(FlutterMethodCall*)call result:(FlutterResult)result{ } appInviteOneLink = call.arguments[afInviteOneLink]; - if(appInviteOneLink != nil){ + if (appInviteOneLink != nil && appInviteOneLink != [NSNull null]) { [AppsFlyerLib shared].appInviteOneLinkID = appInviteOneLink; }