Skip to content

Commit 3db57a3

Browse files
authored
Merge branch 'develop' into rework/custom_tab
2 parents 83bf3e1 + 0b942ba commit 3db57a3

File tree

14 files changed

+76
-18
lines changed

14 files changed

+76
-18
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ in case of vulnerabilities.
2222

2323
## [Unreleased]
2424

25+
## [3.7.0] - 2022-03-01
26+
27+
### Added
28+
- iOS: Add formSheetPreferredContentSize prop to allow for custom sized formSheet modals by [@ShaneMckenna23](https://github.com/ShaneMckenna23) ([#331](https://github.com/proyecto26/react-native-inappbrowser/pull/331)).
29+
2530
## [3.6.3] - 2021-07-05
2631

2732
### Fixed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Property | Description
159159
`modalEnabled` (Boolean) | Present the **SafariViewController** modally or as push instead. [`true`/`false`]
160160
`enableBarCollapsing` (Boolean) | Determines whether the browser's tool bars will collapse or not. [`true`/`false`]
161161
`ephemeralWebSession` (Boolean) | Prevent re-use cookies of previous session (openAuth only) [`true`/`false`]
162+
`formSheetPreferredContentSize` (Object) | Custom size for iPad `formSheet` modals [`{width: 400, height: 500}`]
162163
163164
### Android Options
164165
Property | Description
@@ -176,6 +177,7 @@ Property | Description
176177
`hasBackButton` (Boolean) | Sets a back arrow instead of the default `X` icon to close the custom tab. [`true`/`false`]
177178
`browserPackage` (String) | Package name of a browser to be used to handle Custom Tabs.
178179
`showInRecents` (Boolean) | Determining whether browsed website should be shown as separate entry in Android recents/multitasking view. [`true`/`false`]
180+
`includeReferrer` (Boolean) | Determining whether to include your package name as referrer for the website to track. [`true`/`false`]
179181
180182
### Demo
181183

android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ def safeExtGet(prop, fallback) {
2121
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
2222
}
2323

24-
def DEFAULT_COMPILE_SDK_VERSION = 28
25-
def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
24+
def DEFAULT_COMPILE_SDK_VERSION = 31
25+
def DEFAULT_BUILD_TOOLS_VERSION = "31.0.0"
2626
def DEFAULT_MIN_SDK_VERSION = 16
27-
def DEFAULT_TARGET_SDK_VERSION = 28
27+
def DEFAULT_TARGET_SDK_VERSION = 31
2828

2929
android {
3030
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
@@ -51,7 +51,7 @@ repositories {
5151
dependencies {
5252
implementation fileTree(dir: 'libs', include: ['*.jar'])
5353
implementation 'com.facebook.react:react-native:+'
54-
implementation 'org.greenrobot:eventbus:3.+'
54+
implementation 'org.greenrobot:eventbus:3.1.0'
5555
def supportLibVersion = safeExtGet('supportLibVersion', safeExtGet('supportVersion', null))
5656
def androidXVersion = safeExtGet('androidXVersion', null)
5757
if (supportLibVersion && androidXVersion == null) {

android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
<application>
88
<activity
9-
android:name=".ChromeTabsManagerActivity">
9+
android:name=".ChromeTabsManagerActivity"
10+
android:exported="false">
1011
</activity>
1112
</application>
1213
<queries>

android/src/main/java/com/proyecto26/inappbrowser/RNInAppBrowser.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class RNInAppBrowser {
5959
private static final String KEY_HAS_BACK_BUTTON = "hasBackButton";
6060
private static final String KEY_BROWSER_PACKAGE = "browserPackage";
6161
private static final String KEY_SHOW_IN_RECENTS = "showInRecents";
62+
private static final String KEY_INCLUDE_REFERRER = "includeReferrer";
6263

6364
private static final String ACTION_CUSTOM_TABS_CONNECTION = "android.support.customtabs.action.CustomTabsService";
6465
private static final String CHROME_PACKAGE_STABLE = "com.android.chrome";
@@ -201,7 +202,7 @@ public void open(Context context, final ReadableMap options, final Promise promi
201202
}
202203

203204
registerEventBus();
204-
205+
205206
intent.setData(Uri.parse(url));
206207
if (options.hasKey(KEY_SHOW_PAGE_TITLE)) {
207208
builder.setShowTitle(options.getBoolean(KEY_SHOW_PAGE_TITLE));
@@ -210,6 +211,12 @@ public void open(Context context, final ReadableMap options, final Promise promi
210211
intent.putExtra(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE, CustomTabsIntent.NO_TITLE);
211212
}
212213

214+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && options.hasKey(KEY_INCLUDE_REFERRER)
215+
&& options.getBoolean(KEY_INCLUDE_REFERRER)) {
216+
intent.putExtra(Intent.EXTRA_REFERRER,
217+
Uri.parse("android-app://" + context.getApplicationContext().getPackageName()));
218+
}
219+
213220
currentActivity.startActivity(
214221
ChromeTabsManagerActivity.createStartIntent(currentActivity, intent),
215222
customTabsIntent.startAnimationBundle);

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
android:label="@string/app_name"
1717
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
1818
android:launchMode="singleTask"
19+
android:exported="true"
1920
android:windowSoftInputMode="adjustResize">
2021
<intent-filter>
2122
<action android:name="android.intent.action.MAIN" />

example/android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "30.0.2"
5+
buildToolsVersion = "31.0.0"
66
minSdkVersion = 21
7-
compileSdkVersion = 30
8-
targetSdkVersion = 30
7+
compileSdkVersion = 31
8+
targetSdkVersion = 31
99
ndkVersion = "21.4.7075529"
1010
androidXAnnotation = "1.2.0"
1111
androidXBrowser = "1.3.0"
@@ -15,7 +15,7 @@ buildscript {
1515
mavenCentral()
1616
}
1717
dependencies {
18-
classpath("com.android.tools.build:gradle:4.2.2")
18+
classpath("com.android.tools.build:gradle:7.0.0")
1919
// NOTE: Do not place your application dependencies here; they belong
2020
// in the individual module build.gradle files
2121
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

example/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const openLink = async (url, statusBarStyle, animated = true) => {
4343
hasBackButton: true,
4444
browserPackage: null,
4545
showInRecents: false,
46+
includeReferrer: true,
4647
});
4748
// A delay to show an alert when the browser is closed
4849
await sleep(800);

index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ declare module 'react-native-inappbrowser-reborn' {
3636
| 'partialCurl',
3737
modalEnabled?: boolean,
3838
enableBarCollapsing?: boolean,
39-
ephemeralWebSession?: boolean
39+
ephemeralWebSession?: boolean,
40+
formSheetPreferredContentSize?: { width: number, height: number },
4041
}
4142

4243
export type InAppBrowserAndroidOptions = {
@@ -58,6 +59,7 @@ declare module 'react-native-inappbrowser-reborn' {
5859
hasBackButton?: boolean,
5960
browserPackage?: string,
6061
showInRecents?: boolean
62+
includeReferrer?: boolean,
6163
}
6264

6365
export type InAppBrowserOptions = InAppBrowserAndroidOptions | InAppBrowseriOSOptions;

0 commit comments

Comments
 (0)