Skip to content

Commit c0f5257

Browse files
authored
Merge pull request #375 from proyecto26/develop
Release 3.7.0
2 parents fbf6e13 + 33e1738 commit c0f5257

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+11438
-2863
lines changed

.eslintrc

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
{
2-
"extends": "@react-native-community",
2+
"parser": "@babel/eslint-parser",
3+
"extends": [
4+
"@react-native-community",
5+
"plugin:flowtype/recommended",
6+
"plugin:prettier/recommended"
7+
],
8+
"plugins": [
9+
"flowtype"
10+
],
311
"rules": {
4-
"comma-dangle": ["error", "always-multiline", {
5-
"arrays": "never",
6-
"objects": "never",
7-
"imports": "never",
8-
"exports": "never",
9-
"functions": "never"
10-
}],
11-
"prettier/prettier": ["error", { "singleQuote": true }]
12+
"prettier/prettier": [
13+
"error",
14+
{
15+
"singleQuote": true
16+
}
17+
]
1218
}
1319
}

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ patreon: proyecto26
55
open_collective: proyecto26
66
ko_fi: proyecto26
77
tidelift: npm/react-native-inappbrowser-reborn
8-
liberapay: jdnichollsc
8+
liberapay: proyecto26
99
custom: paypal.me/jdnichollsc

CHANGELOG.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,28 @@ in case of vulnerabilities.
2222

2323
## [Unreleased]
2424

25+
## [3.7.0] - 2022-07-29
26+
27+
### Added
28+
- Add custom size option to iOS formSheet Modal by [@ShaneMckenna23](https://github.com/ShaneMckenna23) ([#331](https://github.com/proyecto26/react-native-inappbrowser/pull/331)).
29+
- Add `warmup` and `mayLaunchUrl` functions for optimizati on in Android by [@vincent-paing](https://github.com/vincent-paing) ([#341](https://github.com/proyecto26/react-native-inappbrowser/pull/341)).
30+
- Add `includeReferrer` to allow adding android package name as referrer for website to track by [@vincent-paing](https://github.com/vincent-paing) ([#342](https://github.com/proyecto26/react-native-inappbrowser/pull/342)).
31+
32+
### Changed
33+
- Export options types by [@rrebase](https://github.com/rrebase) ([#324](https://github.com/proyecto26/react-native-inappbrowser/pull/324)).
34+
- Upgrade build configuration to use sdk 31 instead by [@vincent-paing](https://github.com/vincent-paing) ([#340](https://github.com/proyecto26/react-native-inappbrowser/pull/340)).
35+
- Upgraded dependency `org.greenrobot:eventbus` to 3.1.0 due to build issue by [@chrismerino](https://github.com/chrismerino) ([#347](https://github.com/proyecto26/react-native-inappbrowser/pull/347)).
36+
37+
### Fixed
38+
- Avoid stringifying null redirect url by [@rmartin48](https://github.com/rmartin48) ([#286](https://github.com/proyecto26/react-native-inappbrowser/pull/286)).
39+
- Replaced **jCenter** with **Maven** by [@matteodanelli](https://github.com/matteodanelli) ([#320](https://github.com/proyecto26/react-native-inappbrowser/pull/320)).
40+
- Fix **StatusBar** prop name in README example [@rrebase](https://github.com/rrebase) ([#322](https://github.com/proyecto26/react-native-inappbrowser/pull/322)).
41+
- Fix redirection logic and update example project by [@jdnichollsc](https://github.com/jdnichollsc) ([#371](https://github.com/proyecto26/react-native-inappbrowser/pull/371)).
42+
43+
### Removed
44+
- Remove deprecated `removeEventListener()` calls with backward compatibility by [@TheWirv](https://github.com/TheWirv) ([#297](https://github.com/proyecto26/react-native-inappbrowser/pull/297)).
45+
- Remove `QUERY_ALL_PACKAGES` permission by [@androideveloper](https://github.com/androideveloper) ([#335](https://github.com/proyecto26/react-native-inappbrowser/pull/335)).
46+
2547
## [3.6.3] - 2021-07-05
2648

2749
### Fixed
@@ -202,7 +224,8 @@ Missing tags for previous versions 🤷‍♂
202224
- Fix `EventBusException` on **Android** by [@Almouro](https://github.com/Almouro) ([9cf4cbb](https://github.com/proyecto26/react-native-inappbrowser/commit/9cf4cbb58d55c8b534dabac6791e6a2a5428253f)).
203225

204226

205-
[Unreleased]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.3...HEAD
227+
[Unreleased]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.7.0...HEAD
228+
[3.7.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.3...v3.7.0
206229
[3.6.3]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.2...v3.6.3
207230
[3.6.2]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.1...v3.6.2
208231
[3.6.1]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.0...v3.6.1

README.md

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Do you want to see this package in action? Check these awesome projects, yay!
4242
- [VibePay](https://vibepay.com) - A simple, smarter, better way to get paid.
4343
- [Opinio](https://opinio.media) - Allows the population to be surveyed on social issues.
4444
- [medpex: Online Apotheke](https://www.medpex.de) - Online pharmacy for medicines & cosmetics with over 5 million customers.
45+
- [CONTACT Software](https://www.contact-software.com/) - Energizing your digital business.
4546

4647
Share your awesome project [here](https://github.com/proyecto26/react-native-inappbrowser/issues/164)! ❤️
4748

@@ -81,10 +82,11 @@ Linking the package manually is not required anymore with [Autolinking](https://
8182
```
8283
buildscript {
8384
ext {
84-
buildToolsVersion = "28.0.3"
85-
minSdkVersion = 16
86-
compileSdkVersion = 28
87-
targetSdkVersion = 28
85+
buildToolsVersion = "30.0.2"
86+
minSdkVersion = 21
87+
compileSdkVersion = 30
88+
targetSdkVersion = 30
89+
ndkVersion = "21.4.7075529"
8890
// Remove 'supportLibVersion' property and put specific versions for AndroidX libraries
8991
androidXAnnotation = "1.2.0"
9092
androidXBrowser = "1.3.0"
@@ -158,6 +160,7 @@ Property | Description
158160
`modalEnabled` (Boolean) | Present the **SafariViewController** modally or as push instead. [`true`/`false`]
159161
`enableBarCollapsing` (Boolean) | Determines whether the browser's tool bars will collapse or not. [`true`/`false`]
160162
`ephemeralWebSession` (Boolean) | Prevent re-use cookies of previous session (openAuth only) [`true`/`false`]
163+
`formSheetPreferredContentSize` (Object) | Custom size for iPad `formSheet` modals [`{width: 400, height: 500}`]
161164
162165
### Android Options
163166
Property | Description
@@ -175,6 +178,7 @@ Property | Description
175178
`hasBackButton` (Boolean) | Sets a back arrow instead of the default `X` icon to close the custom tab. [`true`/`false`]
176179
`browserPackage` (String) | Package name of a browser to be used to handle Custom Tabs.
177180
`showInRecents` (Boolean) | Determining whether browsed website should be shown as separate entry in Android recents/multitasking view. [`true`/`false`]
181+
`includeReferrer` (Boolean) | Determining whether to include your package name as referrer for the website to track. [`true`/`false`]
178182
179183
### Demo
180184
@@ -183,9 +187,12 @@ import { Linking, Alert } from 'react-native'
183187
import { InAppBrowser } from 'react-native-inappbrowser-reborn'
184188
185189
...
190+
async sleep(timeout) {
191+
return new Promise(resolve => setTimeout(resolve, timeout))
192+
}
186193
async openLink() {
187194
try {
188-
const url = 'https://www.proyecto26.com'
195+
const url = 'https://github.com/proyecto26'
189196
if (await InAppBrowser.isAvailable()) {
190197
const result = await InAppBrowser.open(url, {
191198
// iOS Properties
@@ -219,6 +226,7 @@ import { InAppBrowser } from 'react-native-inappbrowser-reborn'
219226
'my-custom-header': 'my custom header value'
220227
}
221228
})
229+
await this.sleep(800);
222230
Alert.alert(JSON.stringify(result))
223231
}
224232
else Linking.openURL(url)
@@ -229,6 +237,33 @@ import { InAppBrowser } from 'react-native-inappbrowser-reborn'
229237
...
230238
```
231239

240+
### Android Optimizations
241+
242+
On Android, you can warmup the in app browser client to make it launch siginificantly faster. To do so, add the following to your `MainActivity`
243+
244+
```java
245+
import com.proyecto26.inappbrowser.RNInAppBrowserModule;
246+
247+
public class MainActivity extends ReactActivity {
248+
249+
@Override
250+
protected void onStart() {
251+
super.onStart();
252+
RNInAppBrowserModule.onStart(this);
253+
}
254+
255+
}
256+
```
257+
258+
You can further optimize performance and pre-render pages [by providing the urls that the user is likely to open](https://developer.chrome.com/docs/android/custom-tabs/best-practices/#pre-render-content).
259+
260+
```javascript
261+
// Do not call this every time the component render
262+
useEffect(() => {
263+
InAppBrowser.mayLaunchUrl("Url user has high chance to open", ["Other urls that user might open ordered by priority"]);
264+
}, []);
265+
```
266+
232267
### Authentication Flow using Deep Linking
233268

234269
In order to redirect back to your application from a web browser, you must specify a unique URI to your app. To do this,
@@ -268,7 +303,7 @@ define your app scheme and replace `my-scheme` and `my-host` with your info.
268303
- utilities.js
269304
```javascript
270305
import { Platform } from 'react-native'
271-
export const getDeepLink = (path = "") => {
306+
export const getDeepLink = (path = '') => {
272307
const scheme = 'my-scheme'
273308
const prefix = Platform.OS == 'android' ? `${scheme}://my-host/` : `${scheme}://`
274309
return prefix + path
@@ -314,7 +349,7 @@ import { InAppBrowser } from 'react-native-inappbrowser-reborn'
314349
import { getDeepLink } from './utilities'
315350
...
316351
async onLogin() {
317-
const deepLink = getDeepLink("callback")
352+
const deepLink = getDeepLink('callback)
318353
const url = `https://my-auth-login-page.com?redirect_uri=${deepLink}`
319354
try {
320355
if (await InAppBrowser.isAvailable()) {
@@ -390,7 +425,7 @@ Starting with React Native 0.59 onwards, there is a simpler way of handling this
390425
```javascript
391426
async openInBrowser(url) {
392427
try {
393-
const oldStyle = StatusBar.pushStackEntry({ barStyle: 'dark-content', animate: false });
428+
const oldStyle = StatusBar.pushStackEntry({ barStyle: 'dark-content', animated: false });
394429
await InAppBrowser.open(url)
395430
StatusBar.popStackEntry(oldStyle);
396431
} catch (error) {
@@ -450,8 +485,8 @@ Using in-app browser tabs (like SFAuthenticationSession/ASWebAuthenticationSessi
450485
* **React Native Safari View:** [A React Native wrapper for Safari View Controller](https://github.com/naoufal/react-native-safari-view)
451486
452487
## Contributing ✨
453-
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
454-
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated** ❤️.
488+
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
489+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated** ❤️.
455490
You can learn more about how you can contribute to this project in the [contribution guide](https://github.com/proyecto26/react-native-inappbrowser/blob/develop/CONTRIBUTING.md).
456491
457492
## Contributors ✨

android/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
if (project == rootProject) {
88
repositories {
99
maven { url "https://maven.google.com" }
10-
jcenter()
10+
mavenCentral()
1111
google()
1212
}
1313

@@ -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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
package="com.proyecto26.inappbrowser">
44

55
<uses-permission android:name="android.permission.INTERNET" />
6-
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
76

87
<application>
98
<activity
10-
android:name=".ChromeTabsManagerActivity">
9+
android:name=".ChromeTabsManagerActivity"
10+
android:exported="false">
1111
</activity>
1212
</application>
1313
<queries>
@@ -16,4 +16,4 @@
1616
</intent>
1717
</queries>
1818
</manifest>
19-
19+

0 commit comments

Comments
 (0)