Skip to content

Commit c1dab7e

Browse files
authored
Merge pull request #26 from MikkoA/develop
add option to enable forceReloadOnRedirection
2 parents 630f54c + b1d3628 commit c1dab7e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

android/src/main/java/com/github/droibit/android/reactnative/customtabs/CustomTabsModule.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.Activity;
44
import android.content.Context;
55
import android.graphics.Color;
6+
import android.content.Intent;
67
import android.os.Bundle;
78
import android.provider.Browser;
89
import android.support.customtabs.CustomTabsIntent;
@@ -43,6 +44,8 @@ public class CustomTabsModule extends ReactContextBaseJavaModule {
4344
/* package */ static final String KEY_ANIMATIONS = "animations";
4445
@VisibleForTesting
4546
/* package */ static final String KEY_HEADERS = "headers";
47+
@VisibleForTesting
48+
/* package */ static final String FORCE_CLOSE_ON_REDIRECTION = "forceCloseOnRedirection";
4649

4750
private static final Map<String, Object> CONSTANTS;
4851

@@ -177,6 +180,12 @@ public void openURL(String url, ReadableMap option, Promise promise) {
177180
}
178181
}
179182

183+
if (option.hasKey(FORCE_CLOSE_ON_REDIRECTION) &&
184+
option.getBoolean(FORCE_CLOSE_ON_REDIRECTION)) {
185+
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
186+
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
187+
}
188+
180189
return customTabsIntent;
181190
}
182191

0 commit comments

Comments
 (0)