Skip to content

Commit

Permalink
Merge pull request #362 from AppsFlyerSDK/dev/RD-71646/fix-DeepLinkRe…
Browse files Browse the repository at this point in the history
…sult-inconsistencies-between-platforms

align Android UDL with iOS UDL
  • Loading branch information
amit-kremer93 authored Jan 24, 2022
2 parents 8bec4f7 + 9e6f00b commit 0a43555
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,25 @@ private DeepLinkListener registerDeepLinkListener() {
return new DeepLinkListener() {
@Override
public void onDeepLinking(@NonNull DeepLinkResult deepLinkResult) {
DeepLinkResult.Error dlError = deepLinkResult.getError();
if (dlError != null) {
sendEvent(reactContext, afOnDeepLinking, dlError.toString());
}
JSONObject deepLinkObj = new JSONObject();
DeepLinkResult.Error dlError = deepLinkResult.getError();
try {
deepLinkObj.put("status", afSuccess);
deepLinkObj.put("deepLinkStatus", deepLinkResult.getStatus());
deepLinkObj.put("status", afSuccess);
deepLinkObj.put("type", afOnDeepLinking);
if (deepLinkResult.getStatus() == DeepLinkResult.Status.FOUND) {

if (dlError != null && deepLinkResult.getStatus() == DeepLinkResult.Status.ERROR) {
deepLinkObj.put("status", afFailure);
deepLinkObj.put("data", dlError.toString());
deepLinkObj.put("isDeferred", false);
} else if (deepLinkResult.getStatus() == DeepLinkResult.Status.FOUND) {
deepLinkObj.put("data", deepLinkResult.getDeepLink().getClickEvent());
deepLinkObj.put("isDeferred", deepLinkResult.getDeepLink().isDeferred());
}else{
deepLinkObj.put("data", "");
deepLinkObj.put("isDeferred", "");
} else {
deepLinkObj.put("data", "deep link not found");
deepLinkObj.put("isDeferred", false);
}

} catch (JSONException e) {
e.printStackTrace();
}
Expand Down
6 changes: 3 additions & 3 deletions ios/RNAppsFlyer.m
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,17 @@ - (void)didResolveDeepLink:(AppsFlyerDeepLinkResult* _Nonnull) result {
deepLinkStatus = @"NOT_FOUND";
break;
case AFSDKDeepLinkResultStatusFailure:
deepLinkStatus = @"Error";
deepLinkStatus = @"ERROR";
break;
default:
[NSException raise:NSGenericException format:@"Unexpected FormatType."];
}
NSMutableDictionary* message = [[NSMutableDictionary alloc] initWithCapacity:5];
message[@"status"] = ([deepLinkStatus isEqual:@"Error"] || [deepLinkStatus isEqual:@"NOT_FOUND"]) ? afFailure : afSuccess;
message[@"status"] = ([deepLinkStatus isEqual:@"ERROR"] || [deepLinkStatus isEqual:@"NOT_FOUND"]) ? afFailure : afSuccess;
message[@"deepLinkStatus"] = deepLinkStatus;
message[@"type"] = afOnDeepLinking;
message[@"isDeferred"] = result.deepLink.isDeferred ? @YES : @NO;
if([deepLinkStatus isEqual: @"Error"]){
if([deepLinkStatus isEqual: @"ERROR"]){
message[@"data"] = result.error.localizedDescription;
}else if([deepLinkStatus isEqual: @"NOT_FOUND"]){
message[@"data"] = @"deep link not found";
Expand Down

0 comments on commit 0a43555

Please sign in to comment.