Skip to content

Commit 953fd79

Browse files
authored
Merge pull request #122 from proyecto26/release/v3.3.2
Release v3.3.2
2 parents 0454d51 + 257c4c8 commit 953fd79

File tree

7 files changed

+347
-253
lines changed

7 files changed

+347
-253
lines changed

.github/issue_template.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
### Make sure to check the demo app(s) for sample usage
2+
3+
### Make sure to check the existing issues in this repository
4+
5+
### If the demo apps cannot help and there is no issue for your problem, tell us about it
6+
Please, ensure your title is less than 63 characters long and starts with a capital
7+
letter.
8+
9+
### Which platform(s) does your issue occur on?
10+
- iOS/Android/Both
11+
- iOS/Android versions
12+
- emulator or device. What type of device?
13+
14+
### Please, provide the following version numbers that your issue occurs with:
15+
16+
- CLI: (run `react-native --version` to fetch it)
17+
- Plugin(s): (look for the version numbers in the `package.json` file of your
18+
project and paste your dependencies and devDependencies here)
19+
20+
### Please, tell us how to recreate the issue in as much detail as possible.
21+
Describe the steps to reproduce it.
22+
23+
### Is there any code involved?
24+
- provide a code example to recreate the problem
25+
- (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.

.github/pull_request_template.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!--
2+
We, the rest of the React Native community, thank you for your
3+
contribution!
4+
To help the rest of the community review your change, please follow the instructions in the template.
5+
-->
6+
7+
<!-- PULL REQUEST TEMPLATE -->
8+
<!-- (Update "[ ]" to "[x]" to check a box) -->
9+
10+
## PR Checklist
11+
12+
- [ ] The PR title follows our guidelines: https://github.com/proyecto26/react-native-inappbrowser/blob/master/CONTRIBUTING.md#pull-request-process.
13+
- [ ] There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
14+
- [ ] All existing tests are passing
15+
- [ ] Tests for the changes are included
16+
17+
## What is the current behavior?
18+
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
19+
20+
## What is the new behavior?
21+
<!-- Describe the changes. -->
22+
23+
Fixes/Implements/Closes #[Issue Number].
24+
25+
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
26+
27+
<!--
28+
BREAKING CHANGES:
29+
30+
31+
[Describe the impact of the changes here.]
32+
33+
Migration steps:
34+
[Provide a migration path for existing applications.]
35+
-->
36+

CHANGELOG.md

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

2323
## [Unreleased]
2424

25+
## [3.3.2] - 2019-11-15
26+
27+
### Fixed
28+
- Validate if the **type** of the auth result is different to `cancel` before to check the url of the last redirection from **Android**.
29+
- Fixed issue getting the result of the auth redirection by using `AppState` to detect **Android** Activity `OnResume` event once.
30+
2531
## [3.3.1] - 2019-11-13
2632

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

131137

132-
[Unreleased]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.1...HEAD
138+
[Unreleased]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.2...HEAD
139+
[3.3.2]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.1...v3.3.2
133140
[3.3.1]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.0...v3.3.1
134141
[3.3.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.2.0...v3.3.0
135142
[3.2.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.1.0...v3.2.0

example/yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,9 +2859,9 @@ growly@^1.3.0:
28592859
integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=
28602860

28612861
handlebars@^4.1.2:
2862-
version "4.5.1"
2863-
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.1.tgz#8a01c382c180272260d07f2d1aa3ae745715c7ba"
2864-
integrity sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==
2862+
version "4.5.2"
2863+
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.2.tgz#5a4eb92ab5962ca3415ac188c86dc7f784f76a0f"
2864+
integrity sha512-29Zxv/cynYB7mkT1rVWQnV7mGX6v7H/miQ6dbEpYTKq5eJBN7PsRB+ViYJlcT6JINTSu4dVB9kOqEun78h6Exg==
28652865
dependencies:
28662866
neo-async "^2.6.0"
28672867
optimist "^0.6.1"
@@ -5182,12 +5182,12 @@ react-devtools-core@^3.6.0:
51825182
ws "^3.3.1"
51835183

51845184
react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6:
5185-
version "16.11.0"
5186-
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa"
5187-
integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==
5185+
version "16.12.0"
5186+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c"
5187+
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==
51885188

51895189
"react-native-inappbrowser-reborn@file:..":
5190-
version "3.3.0"
5190+
version "3.3.2"
51915191
dependencies:
51925192
invariant "^2.2.4"
51935193
opencollective-postinstall "^2.0.2"

index.js

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
// @flow
22

33
import invariant from 'invariant';
4-
import { Linking, NativeModules, Platform, processColor } from 'react-native';
4+
import {
5+
Linking,
6+
NativeModules,
7+
Platform,
8+
processColor,
9+
AppState
10+
} from 'react-native';
511

612
const { RNInAppBrowser } = NativeModules;
713

@@ -66,28 +72,21 @@ async function open(
6672
url: string,
6773
options: InAppBrowserOptions = {}
6874
): Promise<BrowserResult> {
69-
const {
70-
animated,
71-
readerMode,
72-
modalEnabled,
73-
dismissButtonStyle,
74-
enableBarCollapsing,
75-
preferredBarTintColor,
76-
preferredControlTintColor,
77-
...optionalOptions
78-
} = options;
7975
const inAppBrowserOptions = {
80-
...optionalOptions,
76+
...options,
8177
url,
82-
dismissButtonStyle: dismissButtonStyle || 'close',
83-
readerMode: !!readerMode,
84-
animated: animated !== undefined ? animated : true,
85-
modalEnabled: modalEnabled !== undefined ? modalEnabled : true,
86-
enableBarCollapsing: !!enableBarCollapsing,
78+
dismissButtonStyle: options.dismissButtonStyle || 'close',
79+
readerMode: !!options.readerMode,
80+
animated: options.animated !== undefined ? options.animated : true,
81+
modalEnabled:
82+
options.modalEnabled !== undefined ? options.modalEnabled : true,
83+
enableBarCollapsing: !!options.enableBarCollapsing,
8784
preferredBarTintColor:
88-
preferredBarTintColor && processColor(preferredBarTintColor),
85+
options.preferredBarTintColor &&
86+
processColor(options.preferredBarTintColor),
8987
preferredControlTintColor:
90-
preferredControlTintColor && processColor(preferredControlTintColor)
88+
options.preferredControlTintColor &&
89+
processColor(options.preferredControlTintColor)
9190
};
9291
return RNInAppBrowser.open(inAppBrowserOptions);
9392
}
@@ -169,20 +168,32 @@ function _waitForRedirectAsync(returnUrl: string): Promise<RedirectResult> {
169168

170169
function _checkResultAndReturnUrl(
171170
returnUrl: string,
172-
result: RedirectResult
173-
): Promise<RedirectResult> {
171+
result: AuthSessionResult
172+
): Promise<AuthSessionResult> {
174173
return new Promise(function(resolve) {
175-
Linking.getInitialURL()
176-
.then(function(url) {
177-
if (url && url.startsWith(returnUrl)) {
178-
resolve({ url: url, type: 'success' });
179-
} else {
180-
resolve(result);
174+
if (Platform.OS === 'android' && result.type !== 'cancel') {
175+
/**
176+
* Detect Android Activity OnResume event once
177+
*/
178+
const _handleAppStateChange = async nextAppState => {
179+
if (nextAppState === 'active') {
180+
try {
181+
const url = await Linking.getInitialURL();
182+
if (url && url.startsWith(returnUrl)) {
183+
resolve({ url, type: 'success' });
184+
} else {
185+
resolve(result);
186+
}
187+
} catch (error) {
188+
resolve(result);
189+
}
190+
AppState.removeEventListener('change', _handleAppStateChange);
181191
}
182-
})
183-
.catch(function() {
184-
resolve(result);
185-
});
192+
};
193+
AppState.addEventListener('change', _handleAppStateChange);
194+
} else {
195+
resolve(result);
196+
}
186197
});
187198
}
188199

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-inappbrowser-reborn",
3-
"version": "3.3.1",
3+
"version": "3.3.2",
44
"description": "InAppBrowser for React Native",
55
"main": "index.js",
66
"files": [
@@ -56,8 +56,7 @@
5656
"babel-core": "^6.26.3",
5757
"eslint": "^6.6.0",
5858
"flow-bin": "^0.98.0",
59-
"react": "^16.8.6",
60-
"react-native": "^0.60.0"
59+
"react-native": ">=0.56"
6160
},
6261
"collective": {
6362
"type": "opencollective",

0 commit comments

Comments
 (0)