Skip to content

Commit

Permalink
Merge pull request #375 from proyecto26/develop
Browse files Browse the repository at this point in the history
Release 3.7.0
  • Loading branch information
jdnichollsc committed Jul 30, 2022
2 parents fbf6e13 + 33e1738 commit c0f5257
Show file tree
Hide file tree
Showing 69 changed files with 11,438 additions and 2,863 deletions.
24 changes: 15 additions & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"extends": "@react-native-community",
"parser": "@babel/eslint-parser",
"extends": [
"@react-native-community",
"plugin:flowtype/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"flowtype"
],
"rules": {
"comma-dangle": ["error", "always-multiline", {
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "never"
}],
"prettier/prettier": ["error", { "singleQuote": true }]
"prettier/prettier": [
"error",
{
"singleQuote": true
}
]
}
}
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ patreon: proyecto26
open_collective: proyecto26
ko_fi: proyecto26
tidelift: npm/react-native-inappbrowser-reborn
liberapay: jdnichollsc
liberapay: proyecto26
custom: paypal.me/jdnichollsc
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ in case of vulnerabilities.

## [Unreleased]

## [3.7.0] - 2022-07-29

### Added
- Add custom size option to iOS formSheet Modal by [@ShaneMckenna23](https://github.com/ShaneMckenna23) ([#331](https://github.com/proyecto26/react-native-inappbrowser/pull/331)).
- 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)).
- 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)).

### Changed
- Export options types by [@rrebase](https://github.com/rrebase) ([#324](https://github.com/proyecto26/react-native-inappbrowser/pull/324)).
- 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)).
- 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)).

### Fixed
- Avoid stringifying null redirect url by [@rmartin48](https://github.com/rmartin48) ([#286](https://github.com/proyecto26/react-native-inappbrowser/pull/286)).
- Replaced **jCenter** with **Maven** by [@matteodanelli](https://github.com/matteodanelli) ([#320](https://github.com/proyecto26/react-native-inappbrowser/pull/320)).
- Fix **StatusBar** prop name in README example [@rrebase](https://github.com/rrebase) ([#322](https://github.com/proyecto26/react-native-inappbrowser/pull/322)).
- Fix redirection logic and update example project by [@jdnichollsc](https://github.com/jdnichollsc) ([#371](https://github.com/proyecto26/react-native-inappbrowser/pull/371)).

### Removed
- Remove deprecated `removeEventListener()` calls with backward compatibility by [@TheWirv](https://github.com/TheWirv) ([#297](https://github.com/proyecto26/react-native-inappbrowser/pull/297)).
- Remove `QUERY_ALL_PACKAGES` permission by [@androideveloper](https://github.com/androideveloper) ([#335](https://github.com/proyecto26/react-native-inappbrowser/pull/335)).

## [3.6.3] - 2021-07-05

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


[Unreleased]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.3...HEAD
[Unreleased]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.7.0...HEAD
[3.7.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.3...v3.7.0
[3.6.3]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.2...v3.6.3
[3.6.2]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.1...v3.6.2
[3.6.1]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.6.0...v3.6.1
Expand Down
55 changes: 45 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Do you want to see this package in action? Check these awesome projects, yay!
- [VibePay](https://vibepay.com) - A simple, smarter, better way to get paid.
- [Opinio](https://opinio.media) - Allows the population to be surveyed on social issues.
- [medpex: Online Apotheke](https://www.medpex.de) - Online pharmacy for medicines & cosmetics with over 5 million customers.
- [CONTACT Software](https://www.contact-software.com/) - Energizing your digital business.

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

Expand Down Expand Up @@ -81,10 +82,11 @@ Linking the package manually is not required anymore with [Autolinking](https://
```
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
// Remove 'supportLibVersion' property and put specific versions for AndroidX libraries
androidXAnnotation = "1.2.0"
androidXBrowser = "1.3.0"
Expand Down Expand Up @@ -158,6 +160,7 @@ Property | Description
`modalEnabled` (Boolean) | Present the **SafariViewController** modally or as push instead. [`true`/`false`]
`enableBarCollapsing` (Boolean) | Determines whether the browser's tool bars will collapse or not. [`true`/`false`]
`ephemeralWebSession` (Boolean) | Prevent re-use cookies of previous session (openAuth only) [`true`/`false`]
`formSheetPreferredContentSize` (Object) | Custom size for iPad `formSheet` modals [`{width: 400, height: 500}`]

### Android Options
Property | Description
Expand All @@ -175,6 +178,7 @@ Property | Description
`hasBackButton` (Boolean) | Sets a back arrow instead of the default `X` icon to close the custom tab. [`true`/`false`]
`browserPackage` (String) | Package name of a browser to be used to handle Custom Tabs.
`showInRecents` (Boolean) | Determining whether browsed website should be shown as separate entry in Android recents/multitasking view. [`true`/`false`]
`includeReferrer` (Boolean) | Determining whether to include your package name as referrer for the website to track. [`true`/`false`]

### Demo

Expand All @@ -183,9 +187,12 @@ import { Linking, Alert } from 'react-native'
import { InAppBrowser } from 'react-native-inappbrowser-reborn'

...
async sleep(timeout) {
return new Promise(resolve => setTimeout(resolve, timeout))
}
async openLink() {
try {
const url = 'https://www.proyecto26.com'
const url = 'https://github.com/proyecto26'
if (await InAppBrowser.isAvailable()) {
const result = await InAppBrowser.open(url, {
// iOS Properties
Expand Down Expand Up @@ -219,6 +226,7 @@ import { InAppBrowser } from 'react-native-inappbrowser-reborn'
'my-custom-header': 'my custom header value'
}
})
await this.sleep(800);
Alert.alert(JSON.stringify(result))
}
else Linking.openURL(url)
Expand All @@ -229,6 +237,33 @@ import { InAppBrowser } from 'react-native-inappbrowser-reborn'
...
```

### Android Optimizations

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`

```java
import com.proyecto26.inappbrowser.RNInAppBrowserModule;

public class MainActivity extends ReactActivity {

@Override
protected void onStart() {
super.onStart();
RNInAppBrowserModule.onStart(this);
}

}
```

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).

```javascript
// Do not call this every time the component render
useEffect(() => {
InAppBrowser.mayLaunchUrl("Url user has high chance to open", ["Other urls that user might open ordered by priority"]);
}, []);
```

### Authentication Flow using Deep Linking

In order to redirect back to your application from a web browser, you must specify a unique URI to your app. To do this,
Expand Down Expand Up @@ -268,7 +303,7 @@ define your app scheme and replace `my-scheme` and `my-host` with your info.
- utilities.js
```javascript
import { Platform } from 'react-native'
export const getDeepLink = (path = "") => {
export const getDeepLink = (path = '') => {
const scheme = 'my-scheme'
const prefix = Platform.OS == 'android' ? `${scheme}://my-host/` : `${scheme}://`
return prefix + path
Expand Down Expand Up @@ -314,7 +349,7 @@ import { InAppBrowser } from 'react-native-inappbrowser-reborn'
import { getDeepLink } from './utilities'
...
async onLogin() {
const deepLink = getDeepLink("callback")
const deepLink = getDeepLink('callback)
const url = `https://my-auth-login-page.com?redirect_uri=${deepLink}`
try {
if (await InAppBrowser.isAvailable()) {
Expand Down Expand Up @@ -390,7 +425,7 @@ Starting with React Native 0.59 onwards, there is a simpler way of handling this
```javascript
async openInBrowser(url) {
try {
const oldStyle = StatusBar.pushStackEntry({ barStyle: 'dark-content', animate: false });
const oldStyle = StatusBar.pushStackEntry({ barStyle: 'dark-content', animated: false });
await InAppBrowser.open(url)
StatusBar.popStackEntry(oldStyle);
} catch (error) {
Expand Down Expand Up @@ -450,8 +485,8 @@ Using in-app browser tabs (like SFAuthenticationSession/ASWebAuthenticationSessi
* **React Native Safari View:** [A React Native wrapper for Safari View Controller](https://github.com/naoufal/react-native-safari-view)
## Contributing ✨
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.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated** ❤️.
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.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated** ❤️.
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).
## Contributors ✨
Expand Down
10 changes: 5 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
if (project == rootProject) {
repositories {
maven { url "https://maven.google.com" }
jcenter()
mavenCentral()
google()
}

Expand All @@ -21,10 +21,10 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def DEFAULT_COMPILE_SDK_VERSION = 28
def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
def DEFAULT_COMPILE_SDK_VERSION = 31
def DEFAULT_BUILD_TOOLS_VERSION = "31.0.0"
def DEFAULT_MIN_SDK_VERSION = 16
def DEFAULT_TARGET_SDK_VERSION = 28
def DEFAULT_TARGET_SDK_VERSION = 31

android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
Expand All @@ -51,7 +51,7 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.react:react-native:+'
implementation 'org.greenrobot:eventbus:3.+'
implementation 'org.greenrobot:eventbus:3.1.0'
def supportLibVersion = safeExtGet('supportLibVersion', safeExtGet('supportVersion', null))
def androidXVersion = safeExtGet('androidXVersion', null)
if (supportLibVersion && androidXVersion == null) {
Expand Down
6 changes: 3 additions & 3 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
package="com.proyecto26.inappbrowser">

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

<application>
<activity
android:name=".ChromeTabsManagerActivity">
android:name=".ChromeTabsManagerActivity"
android:exported="false">
</activity>
</application>
<queries>
Expand All @@ -16,4 +16,4 @@
</intent>
</queries>
</manifest>


0 comments on commit c0f5257

Please sign in to comment.