Compare commits

...

156 Commits

Author SHA1 Message Date
Juan David Nicholls Cardona
6ebc3e7e16
Merge pull request #109 from aitorct/hasBackButton
hasBackButton property
2020-06-25 00:50:30 -05:00
Juan David Nicholls Cardona
2dea12a114
Merge pull request #108 from aitorct/android_isAvailable
Android isAvailable method checks Custom Tab support
2020-06-25 00:46:27 -05:00
Juan David Nicholls Cardona
b175ce068b
Merge pull request #161 from Thomazella/fix/readme
fix(readme): update modalPresentationStyle to 'fullscreen'
2020-06-25 00:42:36 -05:00
Raphael Thomazella
48e8abbfe8
fix(readme): update modalPresentationStyle to 'fullscreen' to fix use case of pasting code from readme and seeing native crash 2020-06-24 18:27:44 -03:00
Aitor Cubeles Torres
030a39d8de Merge remote-tracking branch 'upstream/master' into android_isAvailable 2020-06-24 20:24:10 +02:00
Juan David Nicholls Cardona
7f91796c26
Merge pull request #160 from ssuchanowski/patch-1 2020-06-24 10:12:02 -05:00
Sebastian Suchanowski
676d9b5e08
fix: add a null check in safariViewControllerDidFinish 2020-06-17 14:40:49 +02:00
Juan David Nicholls Cardona
4f09637996
Update README.md 2020-04-22 22:58:09 -05:00
Juan David Nicholls Cardona
60e53cd637
Add Tidelift support 2020-04-22 22:57:32 -05:00
Juan David Nicholls Cardona
54ab29283b Update changelog 2020-04-08 04:18:09 -05:00
Juan David Nicholls Cardona
d1be233924
Merge pull request #147 from proyecto26/dependabot/npm_and_yarn/acorn-7.1.1
Bump acorn from 7.1.0 to 7.1.1
2020-04-08 04:13:19 -05:00
Juan David Nicholls Cardona
ec289edff6
Merge pull request #94 from janicduplessis/patch-1
Add `@ReactModule` annotation
2020-04-08 04:11:13 -05:00
Juan David Nicholls Cardona
b511cb3e7b Add version to changelog 2020-04-08 04:03:47 -05:00
dependabot[bot]
2802bff906
Bump acorn from 7.1.0 to 7.1.1
Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/7.1.0...7.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-04-08 09:00:48 +00:00
Juan David Nicholls Cardona
d2035186f5 Update version to 3.4.0 2020-04-08 03:59:47 -05:00
Juan David Nicholls Cardona
4c0ed7c2c1
Merge pull request #141 from avenner/patch-1
Supports ephemeralWebBrowserSession on iOS 13
2020-02-19 13:54:38 -05:00
avenner
372500494c Add ephemeralWebSession in options object declaration 2020-02-19 19:49:19 +01:00
Alexis Venner
510a178938
Update index.js
Fix property name
2020-02-19 14:53:03 +01:00
Alexis Venner
724e76f2df Add ephemeralWebSession as an option to openAuth 2020-02-11 19:31:38 +01:00
Alexis Venner
f0c28d06ae Supports ephemeralWebBrowserSession on iOS 13
Hello, 

Actually, on iOS 12+, when you login, the cookie is kept until the app is killed. 

Since iOS 13 it's possible to make session ephemeral. 
With this option prefersEphemeralWebBrowserSession, the cookie is killed when tab browser is closed. 

Pros : 
- no need to logout manualy users (for account switch for example) 
Cons : 
- user should reconnect each time the tab is presented.

It fix https://github.com/proyecto26/react-native-inappbrowser/issues/76 , on iOS 13.

TODO : Improvement : make this parameter as an option 

Best Regards
2020-02-11 19:31:38 +01:00
Juan David Nicholls Cardona
283e943502
Merge pull request #137 from proyecto26/release/v3.3.4
Release v3.3.4
2020-01-07 14:37:39 -05:00
Juan David Nicholls Cardona
9b75760cd2 Release v3.3.4 2020-01-07 14:35:39 -05:00
Juan David Nicholls Cardona
fb8f617eec
Merge pull request #134 from frankyjuang/master
Disable swipe to dismiss gesture for modal
2020-01-07 14:01:11 -05:00
Juang, Yi-Lin
ce0f8bed3e Fix 2020-01-02 03:19:03 +08:00
Juang, Yi-Lin
f76b64330d Disable swipe to dismiss gesture for modal 2020-01-02 03:04:09 +08:00
Juan David Nicholls Cardona
ce42ee7319
Update README.md 2019-12-16 15:54:56 -05:00
Juan David Nicholls Cardona
544f839eae
Merge pull request #129 from proyecto26/hotfix/ios13-build-issues
Hotfix iOS 13 build issues
2019-11-25 22:20:21 -05:00
Juan David Nicholls Cardona
78ab34fcbc Fix validation defining interface for previous iOS versions 2019-11-25 17:13:34 -05:00
Juan David Nicholls Cardona
37c0b9afd6 Update Changelog 2019-11-25 17:02:18 -05:00
Juan David Nicholls Cardona
3b7fd9617a Remove build warnings with iOS 13 using Pragmas 2019-11-25 16:27:05 -05:00
Juan David Nicholls Cardona
c51cff4694
Merge pull request #127 from proyecto26/develop
Code review
2019-11-21 09:38:43 -05:00
Juan David Nicholls Cardona
63a365e18c
Enable deep linking and Add Callback component 2019-11-20 12:18:31 -05:00
Juan David Nicholls Cardona
ed4ce3319b
Add Authentication section 2019-11-20 11:19:24 -05:00
Juan David Nicholls Cardona
ad14a22113 Code Review to detect Android Activity OnResume event once 2019-11-15 12:18:59 -05:00
Juan David Nicholls Cardona
953fd7961e
Merge pull request #122 from proyecto26/release/v3.3.2
Release v3.3.2
2019-11-15 03:05:26 -05:00
Juan David Nicholls Cardona
298f6f3e16
Merge pull request #123 from proyecto26/release/v3.3.2
Release v3.3.2
2019-11-15 03:04:01 -05:00
Juan David Nicholls Cardona
257c4c81ea Release 3.3.2 2019-11-15 03:01:52 -05:00
Juan David Nicholls Cardona
881607f167
Merge pull request #121 from proyecto26/feature/openauth-cancel-type
Fixed issue getting the result of the auth redirection from Android
2019-11-15 02:52:40 -05:00
Juan David Nicholls Cardona
5de7fb3070 Fixed issue getting the result of the auth redirection from Android 2019-11-15 02:51:44 -05:00
Juan David Nicholls Cardona
c54f3dbdf9 Merge branch 'master' into develop 2019-11-14 23:45:37 -05:00
Juan David Nicholls Cardona
0454d5137e
Update README.md 2019-11-14 16:32:34 -05:00
Juan David Nicholls Cardona
19788d314b
Add OAuth flow info from README 2019-11-14 16:30:25 -05:00
Juan David Nicholls Cardona
a7e49313c1
Merge pull request #120 from proyecto26/release/v3.3.1
Fix wrong indentation from package.json
2019-11-14 00:19:02 -05:00
Juan David Nicholls Cardona
5d3eb8ad6d
Merge pull request #118 from proyecto26/release/v3.3.1
Release v3.3.1
2019-11-14 00:18:37 -05:00
Juan David Nicholls Cardona
db8c07dd19 Fix wrong indentation from package.json 2019-11-14 00:18:05 -05:00
Juan David Nicholls Cardona
260767cb79
Merge pull request #119 from proyecto26/release/v3.3.1
Fix CHANGELOG and update package version to 3.3.1
2019-11-14 00:16:53 -05:00
Juan David Nicholls Cardona
e42aec8549 Fix CHANGELOG and update package version to 3.3.1 2019-11-14 00:15:46 -05:00
Juan David Nicholls Cardona
2d1076f546 Update dev dependencies 2019-11-13 23:54:16 -05:00
Juan David Nicholls Cardona
9b4a7a58cb
Merge pull request #117 from friederbluemle/update-dev-deps
Update dev deps
2019-11-13 23:48:41 -05:00
Frieder Bluemle
2639062f15
Update eslint to 6.6.0 2019-11-13 15:35:57 -08:00
Frieder Bluemle
915e7302d3
Align flow-bin depdendency 2019-11-13 15:35:27 -08:00
Frieder Bluemle
5ba59cd92c
Add missing dev dependencies 2019-11-13 15:06:43 -08:00
Juan David Nicholls Cardona
67d6939758
Merge pull request #116 from friederbluemle/use-yarn-lock
Convert package-lock to yarn.lock
2019-11-13 17:01:54 -05:00
Frieder Bluemle
9de35381fb
Add example/yarn.lock 2019-11-13 13:45:24 -08:00
Frieder Bluemle
d0d4f351c2
Convert package-lock to yarn.lock 2019-11-13 13:44:57 -08:00
Juan David Nicholls Cardona
b614dfe06f
Merge pull request #115 from friederbluemle/update-project
Update .gitignore
2019-11-13 16:25:37 -05:00
Frieder Bluemle
e0931ea0ca
Update .gitignore 2019-11-13 11:57:33 -08:00
Frieder Bluemle
903983b776
Remove unnecessary files 2019-11-13 11:52:55 -08:00
Juan David Nicholls Cardona
bd5282e34f
Merge pull request #114 from SaeedZhiany/patch-1
Exclude unnecessary file and folders from release distribution
2019-11-13 14:15:36 -05:00
SaeedZhiany
9332b910db Exclude unnecessary file and folders 2019-11-13 10:19:15 +03:30
Juan David Nicholls Cardona
a58eac650f Update CHANGELOG with new version 3.3.0 2019-11-12 01:31:05 -05:00
Juan David Nicholls Cardona
0ab9b47be3 Update package version to 3.3.0 2019-11-12 01:28:27 -05:00
Juan David Nicholls Cardona
c8c14c17e2 Fixed issues when browser don't close on Android and getting the response of auth redirection 2019-11-12 01:26:14 -05:00
Juan David Nicholls Cardona
95eac0af69
Update CHANGELOG.md 2019-11-10 02:59:24 -05:00
Juan David Nicholls Cardona
1d547b5b30 Fixing issue with changes to ASWebAuthenticationSession, add support for automatic modal presentation style and add option to enable bar collapsing 2019-11-10 02:37:36 -05:00
Juan David Nicholls Cardona
e5d2892a4d
Merge pull request #111 from SaeedZhiany/patch-1
Update build.gradle
2019-10-24 12:59:49 -05:00
SaeedZhiany
af2e762bb5
Update gradle-wrapper.properties
Upgraded Gradle wrapper version to the latest
2019-10-21 09:29:43 +03:30
SaeedZhiany
298aa325ec
Update build.gradle
Load Android Gradle Plugin conditionally
2019-10-21 09:28:02 +03:30
Aitor Cubeles Torres
1004bda73b Update README file to include hasBackButton Android property 2019-10-05 15:13:05 +02:00
Aitor Cubeles Torres
8aaa9b6ff0 hasBackButton feature on Android browser 2019-10-05 15:05:55 +02:00
Aitor Cubeles Torres
243029f2e5 Android isAvailable method checks Custom Tab support 2019-10-05 00:48:28 +02:00
Juan David Nicholls Cardona
ef70ac33ca
Update README.md 2019-09-08 16:49:25 -05:00
Juan David Nicholls Cardona
7c83b893ff
Add Tidelift badge to the README 2019-09-08 16:41:14 -05:00
Juan David Nicholls Cardona
0b782897e3
Update CHANGELOG.md 2019-09-08 14:55:01 -05:00
Juan David Nicholls Cardona
3cf3b0c8d7
Merge pull request #103 from proyecto26/develop
Add waitForRedirectDelay option from Android to wait the redirection
2019-09-03 16:35:11 -05:00
Juan David Nicholls Cardona
7391422878 Update example 2019-09-03 16:34:47 -05:00
Juan David Nicholls Cardona
2f94a061a6 Update version to 3.1.0 2019-09-03 16:24:38 -05:00
Juan David Nicholls Cardona
408b72291b Fix npm vulnerabilities 2019-09-03 16:19:14 -05:00
Juan David Nicholls Cardona
817f6ece14 fix: Add waitForRedirectDelay option to fix issues redirecting from Android when the browser is closed 2019-09-03 16:10:36 -05:00
Juan David Nicholls Cardona
458cc7143f
Merge pull request #102 from corintho/master
Update StatusBar documentation on README for RN 0.59+
2019-09-03 00:09:47 -05:00
Corintho Assunção
83039117bd
Update StatusBar for RN 0.59+ 2019-09-02 14:52:26 +02:00
Juan David Nicholls Cardona
ff36dfe0be
Update README.md 2019-08-16 14:35:28 -05:00
Juan David Nicholls Cardona
b6aaba614d
Merge pull request #97 from proyecto26/develop
Add gradle backward-compatibility with AndroidX support
2019-08-16 14:19:56 -05:00
Juan David Nicholls Cardona
3dde945633 Update version to 3.0.1 2019-08-16 14:16:41 -05:00
Juan David Nicholls Cardona
c74345df04 Update README 2019-08-16 13:56:35 -05:00
Juan David Nicholls Cardona
ef6fa8b4ff Update Installation steps for AndroidX with backward-compatibility 2019-08-16 13:55:47 -05:00
Juan David Nicholls Cardona
eb3cd2ea4e Fix wrong default AndroidX version 2019-08-16 01:48:04 -05:00
Juan David Nicholls Cardona
1ae02946d1 Prevent empty version using AndroidX 2019-08-15 17:06:40 -05:00
Juan David Nicholls Cardona
21c82a0f5e Check if AndroidX will be used 2019-08-15 16:07:02 -05:00
Juan David Nicholls Cardona
6833237ddf New AndroidX gradle configuration 2019-08-15 15:53:30 -05:00
Juan David Nicholls Cardona
ccc2fdcd00 Code review 😅 2019-08-12 22:52:14 -05:00
Juan David Nicholls Cardona
06bb283327 Using androidXVersion flag for AndroidX with backward compatibility 2019-08-12 22:37:57 -05:00
Juan David Nicholls Cardona
9bcaf78926 Add gradle backward-compatibility for Android Support using Jetifier 2019-08-12 21:41:17 -05:00
Juan David Nicholls Cardona
2b502dabee
Update CHANGELOG.md 2019-08-12 15:27:41 -05:00
Janic Duplessis
0e6521cfc6
Add @ReactModule annotation
Add `@ReactModule` annotation, this will eventually be used by TurboModules annotation processor.
2019-08-09 12:59:27 -04:00
Juan David Nicholls Cardona
024041b44b
Fix variable name to prevent confusions 2019-07-31 10:28:22 -05:00
Juan David Nicholls Cardona
944722ec71
Tell Potential Subscribers 2019-07-31 00:35:26 -05:00
Juan David Nicholls Cardona
73a4a2af29 Create a SECURITY.md 2019-07-30 23:56:03 -05:00
Juan David Nicholls Cardona
af285efdfb Add a delay to update the status bar when the browser is animated from iOS 2019-07-30 19:03:54 -05:00
Juan David Nicholls Cardona
2502195d0e
Update README.md 2019-07-28 11:38:36 -05:00
Juan David Nicholls Cardona
313650e131
Update README.md 2019-07-27 19:49:39 -05:00
Juan David Nicholls Cardona
0f7f5f519c Publish v3.0.0 2019-07-27 19:23:16 -05:00
Juan David Nicholls Cardona
c90c0468e0 Add internet permission for Android 2019-07-27 19:09:16 -05:00
Juan David Nicholls Cardona
587a32b39f Add workaround to dismiss SafariViewController without animation 2019-07-27 17:08:48 -05:00
Juan David Nicholls Cardona
fd382ea1e0 Update README 2019-07-25 01:27:49 -05:00
Juan David Nicholls Cardona
298e8225ed Add animations to example app 2019-07-23 21:25:40 -05:00
Juan David Nicholls Cardona
8f417dc42c Add FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, Code review and update example 2019-07-23 16:12:03 -05:00
Juan David Nicholls Cardona
484a8198ad Update CHANGELOG 2019-07-22 00:08:58 -05:00
Juan David Nicholls Cardona
4a0d57c73e Present the SafariViewController modally or as push instead 2019-07-21 23:59:04 -05:00
Juan David Nicholls Cardona
3c23fcd317 Merge branch 'master' of https://github.com/proyecto26/react-native-inappbrowser 2019-07-21 09:31:03 -05:00
Juan David Nicholls Cardona
6c334ccaa1 Add some iOS options 2019-07-21 09:30:53 -05:00
Juan David Nicholls Cardona
4ef264af86
Delete yarn.lock 2019-07-21 04:15:35 -05:00
Juan David Nicholls Cardona
86c2d33302 Remove package-lock from example folder 2019-07-21 04:15:01 -05:00
Juan David Nicholls Cardona
86f7238d8e Add animated, modalPresentationStyle and modalTransitionStyle options for iOS 2019-07-21 04:13:59 -05:00
Juan David Nicholls Cardona
f6eea5868a
Create .npmignore 2019-07-19 10:31:20 -05:00
Juan David Nicholls Cardona
e7bde77ef1
Update CHANGELOG.md 2019-07-18 16:01:24 -05:00
Juan David Nicholls Cardona
5a155d2ecf
Update CHANGELOG.md 2019-07-18 15:59:29 -05:00
Juan David Nicholls Cardona
48b58463c5
Update CHANGELOG.md 2019-07-18 15:51:44 -05:00
Juan David Nicholls Cardona
d2d46ac6b7
Merge pull request #80 from opencollective/opencollective
Activating Open Collective
2019-07-18 14:14:16 -05:00
Juan David Nicholls Cardona
6c10b0a737
Create CONTRIBUTING.md 2019-07-18 14:13:20 -05:00
Juan David Nicholls Cardona
646d6705a9
Update README.md 2019-07-18 13:33:00 -05:00
Juan David Nicholls Cardona
18d1d48122
Update README.md 2019-07-18 13:29:49 -05:00
Juan David Nicholls Cardona
5863d753b5
Merge branch 'master' into opencollective 2019-07-18 13:22:58 -05:00
Juan David Nicholls Cardona
d512ccb892 Add ESLint config for React Native 2019-07-17 09:00:09 -05:00
Jess
dd5a5a45a6 Added call to donate after npm install (optional) 2019-07-15 06:19:39 -07:00
Jess
b6ee648ceb Added financial contributors to the README 2019-07-15 06:19:39 -07:00
Juan David Nicholls Cardona
0be80ec1e0
Update CHANGELOG.md 2019-07-14 03:05:26 -05:00
Juan David Nicholls Cardona
4553a806b7
Delete yarn.lock 2019-07-13 01:59:35 -05:00
Juan David Nicholls Cardona
7b045a4d62
Update CHANGELOG.md 2019-07-12 14:56:32 -05:00
Juan David Nicholls Cardona
94b1ef0202
Update CHANGELOG.md 2019-07-12 14:50:38 -05:00
Juan David Nicholls Cardona
ad85c39b87
Add git hash of every commit 2019-07-12 14:50:00 -05:00
Juan David Nicholls Cardona
7c8cb8b51c Validate if EventBus of Android is registered before to unregister 2019-07-12 02:28:08 -05:00
Juan David Nicholls Cardona
dcbfaef49f Add CHANGELOG and remove com.facebook.infer.annotation dependency 2019-07-12 02:12:18 -05:00
Juan David Nicholls Cardona
60a237c2dd Remove package-lock from demo 2019-07-10 09:38:54 -05:00
Juan David Nicholls Cardona
9003715cf1 Update package-lock file 2019-07-09 19:30:39 -05:00
Juan David Nicholls Cardona
ed1c48ace0 Fix maven url for AndroidX 2019-07-09 17:41:37 -05:00
Juan David Nicholls Cardona
0b59abd323
Update org.eclipse.buildship.core.prefs 2019-07-09 01:49:12 -05:00
Juan David Nicholls Cardona
8a083f2484 Support AndroidX with RN >= 0.60 2019-07-09 01:01:35 -05:00
Juan David Nicholls Cardona
dd85315a07
Update README.md 2019-06-30 15:00:42 -05:00
Juan David Nicholls Cardona
faa205ef59
Add ProGuard config step 2019-06-29 20:55:43 -05:00
Juan David Nicholls Cardona
85ec06377a
Update FUNDING.yml 2019-06-23 13:04:52 -05:00
Juan David Nicholls Cardona
69f4630acc Remove package-lock from demo folder 2019-06-06 20:12:36 -05:00
Juan David Nicholls Cardona
fafee1a409
Update FUNDING.yml 2019-05-29 22:54:30 -05:00
Juan David Nicholls Cardona
030809c4d7
Merge pull request #71 from proyecto26/sponsor-button
Add sponsor button
2019-05-29 22:48:05 -05:00
Juan David Nicholls Cardona
dc395a3c1b
Create FUNDING.yml 2019-05-29 22:45:48 -05:00
Juan David Nicholls Cardona
19fa5be385 Update InAppBrowser version from example project 2019-05-16 01:17:06 -05:00
Juan David Nicholls Cardona
526f3ebf8e
Update README.md 2019-05-16 01:12:53 -05:00
Juan David Nicholls Cardona
4f87741fcf
Update README.md 2019-05-16 01:02:56 -05:00
Juan David Nicholls Cardona
5cefc333df Update to 2.0.4 version 2019-05-16 00:41:58 -05:00
Juan David Nicholls Cardona
9d4daa0855 Use ASWebAuthenticationSession instead of SFAuthenticationSession (Deprecated) 2019-05-16 00:39:46 -05:00
Juan David Nicholls Cardona
19d1adaafb
Center badges buttons 2019-05-10 11:13:42 -05:00
Juan David Nicholls Cardona
69bfae10c8
Update README.md 2019-05-08 00:16:59 -05:00
Juan David Nicholls Cardona
4c4f99fe87
Add npm badges 2019-05-08 00:08:36 -05:00
Juan David Nicholls Cardona
2ecdf75490 Add image of InAppBrowser for React Native 2019-05-06 22:24:17 -05:00
Juan David Nicholls Cardona
b9756ab316 Add deep linking example 2019-05-06 16:36:46 -05:00
Juan David Nicholls Cardona
64b693bd14 Set theme jekyll-theme-cayman 2019-05-05 17:41:54 -05:00
106 changed files with 12036 additions and 16015 deletions

13
.eslintrc Normal file
View File

@ -0,0 +1,13 @@
{
"extends": "@react-native-community",
"rules": {
"comma-dangle": ["error", "always-multiline", {
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "never"
}],
"prettier/prettier": ["error", { "singleQuote": true }]
}
}

View File

@ -1,46 +1,101 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js
# We fork some components by platform.
.*/*.web.js
.*/*.android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/React.js
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
node_modules/react-native/Libraries/react-native/React.js
; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*
# Ignore commoner tests
.*/node_modules/commoner/test/.*
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*
# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js
; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js
# Ignore jest
.*/react-native/node_modules/jest-cli/.*
<PROJECT_ROOT>/example/.*
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
[options]
emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error
[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
[version]
0.14.0
^0.98.0

9
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# These are supported funding model platforms
github: jdnichollsc
patreon: proyecto26
open_collective: proyecto26
ko_fi: proyecto26
tidelift: npm/react-native-inappbrowser-reborn
liberapay: jdnichollsc
custom: paypal.me/jdnichollsc

25
.github/issue_template.md vendored Normal file
View File

@ -0,0 +1,25 @@
### Make sure to check the demo app(s) for sample usage
### Make sure to check the existing issues in this repository
### If the demo apps cannot help and there is no issue for your problem, tell us about it
Please, ensure your title is less than 63 characters long and starts with a capital
letter.
### Which platform(s) does your issue occur on?
- iOS/Android/Both
- iOS/Android versions
- emulator or device. What type of device?
### Please, provide the following version numbers that your issue occurs with:
- CLI: (run `react-native --version` to fetch it)
- Plugin(s): (look for the version numbers in the `package.json` file of your
project and paste your dependencies and devDependencies here)
### Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.
### Is there any code involved?
- provide a code example to recreate the problem
- (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.

36
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,36 @@
<!--
We, the rest of the React Native community, thank you for your
contribution!
To help the rest of the community review your change, please follow the instructions in the template.
-->
<!-- PULL REQUEST TEMPLATE -->
<!-- (Update "[ ]" to "[x]" to check a box) -->
## PR Checklist
- [ ] The PR title follows our guidelines: https://github.com/proyecto26/react-native-inappbrowser/blob/master/CONTRIBUTING.md#pull-request-process.
- [ ] 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.
- [ ] All existing tests are passing
- [ ] Tests for the changes are included
## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
## What is the new behavior?
<!-- Describe the changes. -->
Fixes/Implements/Closes #[Issue Number].
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
<!--
BREAKING CHANGES:
[Describe the impact of the changes here.]
Migration steps:
[Provide a migration path for existing applications.]
-->

24
.gitignore vendored
View File

@ -1,15 +1,7 @@
# OSX
#
.DS_Store
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# Xcode
#
build/
@ -28,8 +20,6 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IntelliJ
#
@ -39,8 +29,20 @@ build/
local.properties
*.iml
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore
# Visual Studio Code (Java plugin)
#
.classpath
.project
.settings/

1
.npmignore Normal file
View File

@ -0,0 +1 @@
example/

173
CHANGELOG.md Normal file
View File

@ -0,0 +1,173 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
<!-- TODO: Add new releases in the following format
## [new tag] - tag date
### Added
for new features.
### Changed
for changes in existing functionality.
### Deprecated
for soon-to-be removed features.
### Removed
for now removed features.
### Fixed
for any bug fixes.
### Security
in case of vulnerabilities.
-->
## [Unreleased]
## [3.4.0] - 2020-04-08
### Added
- Added `ephemeralWebSession` option to supports `ephemeralWebBrowserSession` on iOS 13 by [@avenner](https://github.com/avenner) ([#141](https://github.com/proyecto26/react-native-inappbrowser/pull/141)).
- Add `@ReactModule` annotation by [@janicduplessis](https://github.com/janicduplessis) ([#94](https://github.com/proyecto26/react-native-inappbrowser/pull/94)).
### Fixed
- Remove listener of `openAuth` when `closeAuth` is called.
## [3.3.4] - 2020-01-07
### Fixed
- Disable swipe to dismiss gesture for modal by [@frankyjuang](https://github.com/frankyjuang) ([#134](https://github.com/proyecto26/react-native-inappbrowser/pull/134)).
## [3.3.3] - 2019-11-25
### Fixed
- Remove build warnings with **iOS** 13 using [Pragmas](https://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas).
## [3.3.2] - 2019-11-15
### Fixed
- Validate if the **type** of the auth result is different to `cancel` before to check the url of the last redirection from **Android**.
- Fixed issue getting the result of the auth redirection by using `AppState` to detect **Android** Activity `OnResume` event once.
## [3.3.1] - 2019-11-13
### Fixed
- Exclude unnecessary file and folders from release distribution by [@SaeedZhiany](https://github.com/SaeedZhiany) ([#114](https://github.com/proyecto26/react-native-inappbrowser/pull/114)).
- Update `.gitignore` to clean unnecessary files by [@friederbluemle](https://github.com/friederbluemle) ([#115](https://github.com/proyecto26/react-native-inappbrowser/pull/115)).
- Use `yarn` instead of `npm` cli by [@friederbluemle](https://github.com/friederbluemle) ([#116](https://github.com/proyecto26/react-native-inappbrowser/pull/116)).
- Update dev dependencies by [@friederbluemle](https://github.com/friederbluemle) ([#117](https://github.com/proyecto26/react-native-inappbrowser/pull/117)).
## [3.3.0] - 2019-11-12
### Fixed
- Removed `waitForRedirectDelay` option and fixed race condition from **Android** to get the response of the redirection ([#36](https://github.com/proyecto26/react-native-inappbrowser/issues/36))
- Fixed **Android** Activity issue closing the browser and restoring the state by using `onSaveInstanceState` ([#60](https://github.com/proyecto26/react-native-inappbrowser/issues/60)).
## [3.2.0] - 2019-11-10
### Added
- Added support for `automatic` modal presentation style from **iOS**.
- Added `enableBarCollapsing` option to determines whether the browser's tool bars will collapse or not from **iOS**.
### Fixed
- Fixed Browser crashes on iOS 13 when openAuth is used.
## [3.1.0] - 2019-09-03
### Added
- Added `waitForRedirectDelay` option for **Android** to fix issues dismissing the browser before detecting the redirection with `Linking` ([817f6ec](https://github.com/proyecto26/react-native-inappbrowser/commit/817f6ece140c0f2f84e21a537d5030403e652bc1)).
## [3.0.1] - 2019-08-16
### Added
- Added gradle backward-compatibility for Android Support with Jetifier ([#96](https://github.com/proyecto26/react-native-inappbrowser/pull/97)).
- Added **androidXAnnotation** and **androidXBrowser** properties from **rootProject.ext** for **AndroidX** with backward compatibility using **supportLibVersion** property instead.
## [3.0.0] - 2019-07-27
### Added
- **Android:** Migrate to AndroidX by [@jdnichollsc](https://github.com/jdnichollsc) ([8a083f2](https://github.com/proyecto26/react-native-inappbrowser/commit/8a083f24847ac5f49923c6217106628434634b4d)).
- Start following [SemVer](https://semver.org) with git tags properly 😅.
- Include a **CHANGELOG.md** to see the history of the changes of the project.
- Validate if `EventBus` of **Android** is registered before to unregister.
- Include ESLint config for React Native.
- Activating Open Collective ([#80](https://github.com/proyecto26/react-native-inappbrowser/pull/80)) and Create **CONTRIBUTING.md** to see how to contribute.
- Added `animated`, `modalPresentationStyle` and `modalTransitionStyle` properties for iOS options ([86f7238](https://github.com/proyecto26/react-native-inappbrowser/commit/86f7238d8eb856b28fae9981ca7bb42b12c43e18)).
- Present the **SafariViewController** modally or as push instead using the `modalEnabled` property ([4a0d57c](https://github.com/proyecto26/react-native-inappbrowser/commit/4a0d57c73eccaaf45a212853c50aa41520b550c8)).
- Add workaround to dismiss **SafariViewController** without animation.
### Removed
- **com.facebook.infer.annotation** dependency is not required anymore to build for **Android** ([dcbfaef](https://github.com/proyecto26/react-native-inappbrowser/commit/dcbfaef49fa04fdabc281cd2c61124a11c6a7d29#diff-7ae5a9093507568eabbf35c3b0665732)).
### BREAKING CHANGES
- **Android:** You are required to only use either the Support Library or AndroidX for your dependencies. If you need to migrate this library back to the support library, or another library forward to AndroidX, then take a look at the [Jetifier tool](https://github.com/mikehardy/jetifier).
## [2.0.4] - 2019-05-16
### Added
- README now contains a badges section.
- Include deep linking example with `demo` schemes, redirecting back from an external static page created with [GitHub Pages](https://github.com/proyecto26/react-native-inappbrowser/tree/gh-pages).
- Use `ASWebAuthenticationSession` instead of `SFAuthenticationSession` for **iOS** >= 12.
## [2.0.3] - 2019-05-02
### Fixed
- Wrong `registerEventBus` been called from `close` event on **Android**, using `unregister` of `EventBus` instead.
## [2.0.2] - 2019-05-02
### Added
- README now contains the different options to open the browser.
### Fixed
- Add `customTabsIntent.startAnimationBundle` when the `ChromeTabsManagerActivity` intent is created to fix **Android** animations by [@miktolon](https://github.com/miktolon) ([3f0cb35](https://github.com/proyecto26/react-native-inappbrowser/commit/3f0cb356733832a4578ebf1cb45377aa0d8d2806)).
### Changed
- Using **Android** `AssertionError` instead of use `Assertion` lib of Facebook by [@SnaiNeR](https://github.com/SnaiNeR) ([e9a54d3](https://github.com/proyecto26/react-native-inappbrowser/commit/e9a54d3fe759380f992aa1ed7fbcf5d1299a7d73)).
- Set modal presentation style of **SFSafariViewController** to `UIModalPresentationNone` instead of `UIModalPresentationOverFullScreen`.
- Update example to use RN 0.59.5.
## [2.0.1] - 2019-04-12
### Fixed
- Fix flow types by [@petekp](https://github.com/petekp) ([66dd631](https://github.com/proyecto26/react-native-inappbrowser/commit/66dd631d0059f5365f4d1bf5ea219d7aef489efe)/[018f505](https://github.com/proyecto26/react-native-inappbrowser/commit/018f5054c6757cf3b8aa2fc6c278e821077c6fbe)).
## [2.0.0] - 2019-03-21
### Added
- Default methods to open and close the embedded browser **(open, close)** with options.
- Methods to open and close external urls to authenticate the user **(openAuth, closeAuth)** using deep linking.
- `isAvailable` method to detect if the device supports the plugin.
## [...2.0.0]
Missing tags for previous versions 🤷‍♂
### Added
- Create `InAppBrowser for React Native` library inspired by [WebBrowser](https://docs.expo.io/versions/latest/sdk/webbrowser) component of [Expo SDK](https://github.com/expo/expo-sdk/blob/dce1ad93dba25dc5eab486f23e77ba4ec9b6d415/src/WebBrowser.js).
- Include options to costumize the browser, inspired from [Chrome Custom Tabs for React Native](https://github.com/droibit/react-native-custom-tabs) and [A React Native wrapper for Safari View Controller](https://github.com/naoufal/react-native-safari-view).
- Include **readermode** property for **iOS** options by [@EQuimper](https://github.com/EQuimper) ([fb3efac](https://github.com/proyecto26/react-native-inappbrowser/commit/fb3efac7098ff222b07612896cfa2956465a9934)).
- Let status bar been managed from the react-native side by [@EQuimper](https://github.com/EQuimper) ([e66f652](https://github.com/proyecto26/react-native-inappbrowser/commit/e66f652792f4f8fbe30fb469733a5441302d8b08)).
- Typescript support by [@bonesyblue](https://github.com/bonesyblue) ([d62f705](https://github.com/proyecto26/react-native-inappbrowser/commit/d62f705006347cf60117bd526ff632f3533524d4)).
- Fix result type when **ChromeTabsManagerActivity** is dismissed by [@mlazari](https://github.com/mlazari) ([f5a0be5](https://github.com/proyecto26/react-native-inappbrowser/commit/f5a0be5efb631980b3dc46fcfb0fecf32f0ed32e)).
- Move podspec file to root project by [@plamworapot](https://github.com/plamworapot) ([aa7d33b](https://github.com/proyecto26/react-native-inappbrowser/commit/aa7d33b7f6fea502b302ba421582a860b6886a5c)).
- Fix gradle compile config by [@fschindler](https://github.com/fschindler) ([8bfa6da](https://github.com/proyecto26/react-native-inappbrowser/commit/8bfa6da07feedd961a49642b365797637506bedd)).
- Include **supportLibVersion** definition to avoid collisions by [@maestor](https://github.com/maestor) ([332ceef](https://github.com/proyecto26/react-native-inappbrowser/commit/332ceefeba4e729237412954b8b941654263bfbd)).
- Fix the repository URL for podspec file by [@adammcarth](https://github.com/adammcarth) ([7e4038c](https://github.com/proyecto26/react-native-inappbrowser/commit/7e4038c19a7e1a44ab01e9dcd762709ab854eb85)).
- Provide example how to restore old status bar style by [@MrLoh](https://github.com/MrLoh) ([8cb9e75](https://github.com/proyecto26/react-native-inappbrowser/commit/8cb9e7535a3edb0d9919eab7813bf5f136f455ff)).
- Add `com.facebook.infer.annotation` dependecy to fix build error by [Artem Emelyanov](mailto:snainer@gmail.com) ([80ff313](https://github.com/proyecto26/react-native-inappbrowser/commit/80ff313c36911d4d82d2885ad8424d7f0f72de29)).
- Clear `mOpenBrowserPromise` after sending a cancel by [@rbscott](https://github.com/rbscott) ([d9cc2a3](https://github.com/proyecto26/react-native-inappbrowser/commit/d9cc2a3183f84790deb22bf01f4f7658d67bc8ca)).
- Fix README to import native package in `MainApplication` instead of `MainActivity` by [@mammad2c](https://github.com/mammad2c) ([ce3f5a9](https://github.com/proyecto26/react-native-inappbrowser/commit/ce3f5a93812a1a2dd7293092bb4a2972f4943268)).
- Update the `isAvailable` method to return a boolean instead by [@kikketer](https://github.com/kikketer) ([1d75810](https://github.com/proyecto26/react-native-inappbrowser/commit/1d75810881cc6fd5a6913fbef986f897d366cdb9)).
- Fix **TypeScript** typings by [@petekp](https://github.com/petekp) ([e0e99a5](https://github.com/proyecto26/react-native-inappbrowser/commit/e0e99a523d9a2df99263ffbed3f2738afd05b46b)).
- 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.4.0...HEAD
[3.4.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.4...v3.4.0
[3.3.4]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.3...v3.3.4
[3.3.3]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.2...v3.3.3
[3.3.2]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.1...v3.3.2
[3.3.1]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.3.0...v3.3.1
[3.3.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.2.0...v3.3.0
[3.2.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.1.0...v3.2.0
[3.1.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.0.1...v3.1.0
[3.0.1]: https://github.com/proyecto26/react-native-inappbrowser/compare/v3.0.0...v3.0.1
[3.0.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/2.0.4...v3.0.0
[2.0.4]: https://github.com/proyecto26/react-native-inappbrowser/compare/2.0.3...2.0.4
[2.0.3]: https://github.com/proyecto26/react-native-inappbrowser/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/proyecto26/react-native-inappbrowser/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/proyecto26/react-native-inappbrowser/compare/2.0...2.0.1
[2.0.0]: https://github.com/proyecto26/react-native-inappbrowser/releases/tag/2.0
[...2.0.0]: https://github.com/proyecto26/react-native-inappbrowser/compare/bf51cfd...2.0

92
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,92 @@
# 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.
Please note we have a code of conduct, please follow it in all your interactions with the project.
## Pull Request Process
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at jdnichollsc@hotmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Proyecto 26
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

255
README.md
View File

@ -1,7 +1,33 @@
<p align="center">
<h1 align="center">InAppBrowser for React Native</h1>
<a href="./LICENSE">
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT license" />
</a>
<a href="https://npmjs.org/package/react-native-inappbrowser-reborn">
<img src="http://img.shields.io/npm/v/react-native-inappbrowser-reborn.svg" alt="Current npm package version" />
</a>
<a href="https://github.com/proyecto26/react-native-inappbrowser/graphs/commit-activity">
<img src="https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg" alt="Maintenance" />
</a>
<a href="https://tidelift.com/subscription/pkg/npm-react-native-inappbrowser-reborn?utm_source=npm-react-native-inappbrowser-reborn&utm_medium=referral&utm_campaign=readme">
<img src="https://tidelift.com/badges/package/npm/react-native-inappbrowser-reborn" alt="Tidelift Subscription" />
</a>
<a href="https://opencollective.com/proyecto26" alt="Financial Contributors on Open Collective">
<img src="https://opencollective.com/proyecto26/all/badge.svg?label=financial+contributors" />
</a>
<a href="https://npmjs.org/package/react-native-inappbrowser-reborn">
<img src="http://img.shields.io/npm/dm/react-native-inappbrowser-reborn.svg" alt="Downloads" />
</a>
<a href="https://npmjs.org/package/react-native-inappbrowser-reborn">
<img src="http://img.shields.io/npm/dt/react-native-inappbrowser-reborn.svg?label=total%20downloads" alt="Total downloads" />
</a>
<a href="https://twitter.com/intent/follow?screen_name=jdnichollsc">
<img src="https://img.shields.io/twitter/follow/jdnichollsc.svg?label=Follow%20@jdnichollsc" alt="Follow @jdnichollsc" />
</a>
</p>
<h1 align="center">InAppBrowser for React Native</h1>
<h4 align="center"><a href="https://developer.chrome.com/multidevice/android/customtabs#whatarethey">Chrome Custom Tabs</a> for Android & <a href="https://developer.apple.com/documentation/safariservices">SafariServices</a>/<a href="https://developer.apple.com/documentation/authenticationservices">AuthenticationServices</a> for iOS.</h4>
<p align="center">
<img width="400px" src="img/inappbrowser.png">
</p>
@ -12,11 +38,53 @@
### Mostly automatic installation
#### Using React Native >= 0.60
Linking the package manually is not required anymore with [Autolinking](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md).
- **iOS Platform:**
`$ cd ios && pod install && cd ..` # CocoaPods on iOS needs this extra step
- **Android Platform with Android Support:**
Using [Jetifier tool](https://github.com/mikehardy/jetifier) for backward-compatibility.
Modify your **android/build.gradle** configuration:
```
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
# Only using Android Support libraries
supportLibVersion = "28.0.0"
}
```
- **Android Platform with AndroidX:**
Modify your **android/build.gradle** configuration:
```
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
# Remove 'supportLibVersion' property and put specific versions for AndroidX libraries
androidXAnnotation = "1.1.0"
androidXBrowser = "1.0.0"
// Put here other AndroidX dependencies
}
```
#### Using React Native < 0.60
`$ react-native link react-native-inappbrowser-reborn`
### Manual installation
#### iOS
1. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]`
@ -43,16 +111,25 @@
```
implementation project(':react-native-inappbrowser-reborn')
```
4. Update ProGuard config (Optional)
- Append the following lines to your ProGuard config (`proguard-rules.pro`)
```
-keepattributes *Annotation*
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
```
## Usage
Methods | Action
------------- | ------
`open` | Opens the url with Safari in a modal on iOS using **SFSafariViewController**, and Chrome in a new custom tab on Android. On iOS, the modal Safari will not share cookies with the system Safari.
`close` | Dismisses the system's presented web browser
`openAuth` | Opens the url with Safari in a modal on iOS using **SFAuthenticationSession**, and Chrome in a new custom tab on Android. On iOS, the user will be asked whether to allow the app to authenticate using the given url.
`closeAuth` | Dismisses the current authentication session
`isAvailable` | Detect if the device supports this plugin
`close` | Dismisses the system's presented web browser.
`openAuth` | Opens the url with Safari in a modal on iOS using **SFAuthenticationSession/ASWebAuthenticationSession**, and Chrome in a new custom tab on Android. On iOS, the user will be asked whether to allow the app to authenticate using the given url **(OAuth flow with deep linking redirection)**.
`closeAuth` | Dismisses the current authentication session.
`isAvailable` | Detect if the device supports this plugin.
### iOS Options
@ -62,17 +139,25 @@ Property | Description
`preferredBarTintColor` (String) | The color to tint the background of the navigation bar and the toolbar. [`white`/`#FFFFFF`]
`preferredControlTintColor` (String) | The color to tint the control buttons on the navigation bar and the toolbar. [`gray`/`#808080`]
`readerMode` (Boolean) | A value that specifies whether Safari should enter Reader mode, if it is available. [`true`/`false`]
`animated` (Boolean) | Animate the presentation. [`true`/`false`]
`modalPresentationStyle` (String) | The presentation style for modally presented view controllers. [`automatic`/`none`/`fullScreen`/`pageSheet`/`formSheet`/`currentContext`/`custom`/`overFullScreen`/`overCurrentContext`/`popover`]
`modalTransitionStyle` (String) | The transition style to use when presenting the view controller. [`coverVertical`/`flipHorizontal`/`crossDissolve`/`partialCurl`]
`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`]
### Android Options
Property | Description
-------------- | ------
`showTitle` (Boolean) | Sets whether the title should be shown in the custom tab. [`true`/`false`]
`hasBackButton` (Boolean) | Sets a back arrow instead of the default X icon to close the custom tab. [`true`/`false`]
`toolbarColor` (String) | Sets the toolbar color. [`gray`/`#808080`]
`secondaryToolbarColor` (String) | Sets the color of the secondary toolbar. [`white`/`#FFFFFF`]
`enableUrlBarHiding` (Boolean) | Enables the url bar to hide as the user scrolls down on the page. [`true`/`false`]
`enableDefaultShare` (Boolean) | Adds a default share item to the menu. [`true`/`false`]
`animations` (Object) | Sets the start and exit animations. [`{ startEnter, startExit, endEnter, endExit }`]
`headers` (Object) | The data are key/value pairs, they will be sent in the HTTP request headers for the provided url. [`{ 'Authorization': 'Bearer ...' }`]
`forceCloseOnRedirection` (Boolean) | Open Custom Tab in a new task to avoid issues redirecting back to app scheme. [`true`/`false`]
### Demo
@ -88,9 +173,14 @@ import InAppBrowser from 'react-native-inappbrowser-reborn'
const result = await InAppBrowser.open(url, {
// iOS Properties
dismissButtonStyle: 'cancel',
preferredBarTintColor: 'gray',
preferredBarTintColor: '#453AA4',
preferredControlTintColor: 'white',
readerMode: false,
animated: true,
modalPresentationStyle: 'fullScreen',
modalTransitionStyle: 'partialCurl',
modalEnabled: true,
enableBarCollapsing: false,
// Android Properties
showTitle: true,
toolbarColor: '#6200EE',
@ -108,7 +198,7 @@ import InAppBrowser from 'react-native-inappbrowser-reborn'
},
headers: {
'my-custom-header': 'my custom header value'
},
}
})
Alert.alert(JSON.stringify(result))
}
@ -122,6 +212,36 @@ import InAppBrowser from 'react-native-inappbrowser-reborn'
### 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,
define your app scheme and replace `my-scheme` and `my-host` with your info.
- Enable deep linking (Android) - **[AndroidManifest.xml](https://github.com/proyecto26/react-native-inappbrowser/blob/master/example/android/app/src/main/AndroidManifest.xml#L23)**
```
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="my-scheme" android:host="my-host" android:pathPrefix="" />
</intent-filter>
```
- Enable deep linking (iOS) - **[Info.plist](https://github.com/proyecto26/react-native-inappbrowser/blob/master/example/ios/example/Info.plist#L23)**
```
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>my-scheme</string>
<key>CFBundleURLSchemes</key>
<array>
<string>my-scheme</string>
</array>
</dict>
</array>
```
- utilities.js
```javascript
import { Platform } from 'react-native'
@ -139,11 +259,12 @@ import { createStackNavigator } from 'react-navigation'
const Main = createStackNavigator(
{
SplashComponent: { screen: SplashComponent },
LoginComponent: { screen: LoginComponent },
HomeComponent: { screen: HomeComponent },
SplashComponent: { //Redirect users to the Home page if they are authenticated, otherwise to Login page...
screen: SplashComponent,
path: 'callback/' //Deep linking to get the auth_token
CallbackComponent: { //Redirect users to the Home page if they are authenticated, otherwise to Login page...
screen: CallbackComponent,
path: 'callback/' //Enable Deep linking redirection to get the auth_token
}
},
{
@ -176,14 +297,16 @@ import { getDeepLink } from './utilities'
if (await InAppBrowser.isAvailable()) {
InAppBrowser.openAuth(url, deepLink, {
// iOS Properties
dismissButtonStyle: 'cancel',
ephemeralWebSession: false,
// Android Properties
showTitle: false,
enableUrlBarHiding: true,
enableDefaultShare: true,
enableDefaultShare: false
}).then((response) => {
if (response.type === 'success' &&
response.url) {
if (
response.type === 'success' &&
response.url
) {
Linking.openURL(response.url)
}
})
@ -198,18 +321,39 @@ import { getDeepLink } from './utilities'
- SplashComponent
```javascript
...
componentWillMount() {
async componentDidMount() {
// Play Lottie Animation :)
// Validate the stored access token (Maybe with a request)
// Redirect the user to the Home page if the token is still valid
// Otherwise redirect to the Login page
}
...
```
- CallbackComponent
```javascript
...
async componentDidMount() {
// Play Lottie Animation :)
try {
await this.loadUserInfo()
// Redirect to the Home page
} catch (error) {
// Show error and redirect the user to the Login page
}
}
async loadUserInfo() {
const { navigation } = this.props
const { state: { params } } = navigation
const { access_token } = params || {}
const { code, error } = params || {}
if (access_token) {
// Opened by deep linking, the user is authenticated
// Redirect to the Home page
if (code) {
// Get and Save the access token request, user info...
}
else {
// Detect if the stored token is still valid
// And redirect the user to Home or Login page
return Promise.reject(new Error(error))
}
}
...
@ -217,7 +361,24 @@ import { getDeepLink } from './utilities'
### StatusBar
The StatusBar will keep the last one provided in your app. So if the StatusBar is `dark-content` before you open the browser this will keep it. If you want to change before opening you can do something like
The StatusBar will keep the last one provided in your app. So if the StatusBar is `dark-content` before you open the browser this will keep it.
Starting with React Native 0.59 onwards, there is a simpler way of handling this update, without the need of patching StatusBar.
```javascript
async openInBrowser(url) {
try {
const oldStyle = StatusBar.pushStackEntry({ barStyle: 'dark-content', animate: false });
await InAppBrowser.open(url)
StatusBar.popStackEntry(oldStyle);
} catch (error) {
Alert.alert(error.message)
}
})
```
For previous versions, you can still apply the method described below.
If you want to change before opening you can do something like
```javascript
async openInBrowser(url) {
@ -256,23 +417,59 @@ You can than restore the old bar style after the browser has been dismissed like
})
```
### Authentication
Using in-app browser tabs (like SFAuthenticationSession/ASWebAuthenticationSession and Android Custom Tabs) where available. Embedded user-agents, known as web-views (like UIWebView and WKWebView), are explicitly not supported due to the usability and security reasons documented in [Section 8.12 of RFC 8252](https://tools.ietf.org/html/rfc8252#section-8.12).
## Credits 👍
* **Expo:** [WebBrowser](https://docs.expo.io/versions/latest/sdk/webbrowser)
* **React Native Custom Tabs:** [Chrome Custom Tabs for React Native](https://github.com/droibit/react-native-custom-tabs)
* **React Native Safari View:** [A React Native wrapper for Safari View Controller](https://github.com/naoufal/react-native-safari-view)
## Contributors ✨
Thanks goes to these wonderful people:
<!-- CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img alt="jdnichollsc" src="https://avatars3.githubusercontent.com/u/2154886?v=3" width="100" /><br /><sub><b>Juan Nicholls</b></sub>](https://github.com/jdnichollsc)<br />[✉](mailto:jdnichollsc@hotmail.com) | [<img alt="EQuimper" src="https://avatars3.githubusercontent.com/u/15819498?v=3" width="100" /><br /><sub><b>Emanuel Quimper</b></sub>](https://github.com/EQuimper)<br />[✉](mailto:quimperemanuel@gmail.com) | [<img alt="bonesyblue" src="https://avatars3.githubusercontent.com/u/7486722?v=3" width="100" /><br /><sub><b>Jonathan Bones</b></sub>](https://github.com/bonesyblue)<br />[✉](mailto:bonesyblue@gmail.com) | [<img alt="mlazari" src="https://avatars3.githubusercontent.com/u/4928274?v=3" width="100" /><br /><sub><b>Mihai Lazari</b></sub>](https://github.com/mlazari) | [<img alt="maestor" src="https://avatars3.githubusercontent.com/u/3604902?v=3" width="100" /><br /><sub><b>Kalle Haavisto</b></sub>](https://github.com/maestor)<br />[✉](mailto:maestori@gmail.com) | [<img alt="plamworapot" src="https://avatars3.githubusercontent.com/u/4770354?v=3" width="100" /><br /><sub><b>Worapot Pengsuk</b></sub>](https://github.com/plamworapot) | [<img alt="adammcarth" src="https://avatars3.githubusercontent.com/u/3016455?v=3" width="100" /><br /><sub><b>Adam McArthur</b></sub>](https://github.com/adammcarth)<br />[✉](mailto:adam@adammcarthur.net) |
| :---: | :---: |:---: | :---: | :---: | :---: | :---: |
| [<img alt="SnaiNeR" src="https://avatars3.githubusercontent.com/u/39980963?v=3" width="100" /><br /><sub><b>Artem Emelyanov</b></sub>](https://github.com/SnaiNeR)<br />[✉](mailto:snainer@gmail.com) | [<img alt="rbscott" src="https://avatars2.githubusercontent.com/u/882258?v=4&s=117" width="100" /><br /><sub><b>Robert Scott</b></sub>](https://github.com/rbscott) | [<img alt="Kikketer" src="https://avatars0.githubusercontent.com/u/958042?s=460&v=4" width="100" /><br /><sub><b>Chris Weed</b></sub>](https://github.com/kikketer) | [<img alt="almouro" src="https://avatars3.githubusercontent.com/u/4534323?v=4" width="100" /><br /><sub><b>Alexandre Moureaux</b></sub>](https://github.com/almouro) | [<img alt="petekp" src="https://avatars2.githubusercontent.com/u/950779?s=460&v=4" width="100" /><br /><sub><b>Pete Petrash</b></sub>](https://github.com/petekp) | [<img alt="miktolon" src="https://avatars3.githubusercontent.com/u/1495540?v=4" width="100" /><br /><sub><b>Mika Tolonen</b></sub>](https://github.com/miktolon)
<!-- CONTRIBUTORS-LIST:END -->
Please do contribute! Issues and pull requests are welcome.
### Code Contributors
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="https://github.com/proyecto26/react-native-inappbrowser/graphs/contributors"><img src="https://opencollective.com/proyecto26/contributors.svg?width=890&button=false" /></a>
### Financial Contributors
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/proyecto26/contribute)]
#### Individuals
<a href="https://opencollective.com/proyecto26"><img src="https://opencollective.com/proyecto26/individuals.svg?width=890"></a>
#### Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/proyecto26/contribute)]
<a href="https://opencollective.com/proyecto26/organization/0/website"><img src="https://opencollective.com/proyecto26/organization/0/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/1/website"><img src="https://opencollective.com/proyecto26/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/2/website"><img src="https://opencollective.com/proyecto26/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/3/website"><img src="https://opencollective.com/proyecto26/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/4/website"><img src="https://opencollective.com/proyecto26/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/5/website"><img src="https://opencollective.com/proyecto26/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/6/website"><img src="https://opencollective.com/proyecto26/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/7/website"><img src="https://opencollective.com/proyecto26/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/8/website"><img src="https://opencollective.com/proyecto26/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/proyecto26/organization/9/website"><img src="https://opencollective.com/proyecto26/organization/9/avatar.svg"></a>
## Supporting 🍻
I believe in Unicorns 🦄
Support [me](http://www.paypal.me/jdnichollsc/2), if you do too.
## Enterprise 💼
Available as part of the Tidelift Subscription.
The maintainers of InAppBrowser for React Native and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-react-native-inappbrowser-reborn?utm_source=npm-react-native-inappbrowser-reborn&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Security contact information 🚨
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## Happy coding 💯
Made with ❤️

View File

@ -3,21 +3,21 @@ require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = "RNInAppBrowser"
s.name = "RNInAppBrowser"
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.author = package['author']
s.homepage = package['homepage']
s.source = { :git => package['repository']['url'], :tag => "master" }
s.source = { :git => package['repository']['url'], :tag => "v#{s.version}" }
s.requires_arc = true
s.platform = :ios, '8.0'
s.platform = :ios, '9.0'
s.preserve_paths = 'LICENSE', 'README.md', 'package.json', 'index.js'
s.source_files = 'ios/*.{h,m}'
s.exclude_files = 'android/**/*'
s.source_files = 'ios/**/*.{h,m}'
s.exclude_files = 'android/**/*'
s.dependency "React"
#s.dependency "others"

28
SECURITY.md Normal file
View File

@ -0,0 +1,28 @@
# Security Policy 🚨
## Reporting a Vulnerability 🐞
The `Proyecto 26` team and community take all security bugs in `react-native-inappbrowser-reborn` seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
The `Proyecto 26` team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will endeavor to keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
Report security bugs in third-party modules to the person or team maintaining the module.
## Disclosure Policy 📢
When the security team receives a security bug report, they will assign it to a primary handler. This person will coordinate the fix and release process,
involving the following steps:
* Confirm the problem and determine the affected versions.
* Audit code to find any potential similar problems.
* Prepare fixes for all releases still under maintenance. These fixes will be released as fast as possible.
## Comments on this Policy ✍
If you have suggestions on how this process could be improved please submit a pull request.
## Security Is Everyone's Responsibility 🌐
Thank you for making the world a better place for everyone! 🙏

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>

10
android/.npmignore Normal file
View File

@ -0,0 +1,10 @@
*.iml
.DS_Store
.gradle/
.idea/
.npmignore
build/
gradle/
gradlew
gradlew.bat
local.properties

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>react-native-inappbrowser-reborn</name>
<comment>Project react-native-inappbrowser-reborn created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
connection.project.dir=../../../android
eclipse.preferences.version=1

View File

@ -1,24 +1,30 @@
apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
}
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
repositories {
maven { url "https://maven.google.com" }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
}
}
}
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
def DEFAULT_COMPILE_SDK_VERSION = 27
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
def DEFAULT_COMPILE_SDK_VERSION = 28
def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
def DEFAULT_MIN_SDK_VERSION = 16
def DEFAULT_TARGET_SDK_VERSION = 27
def DEFAULT_SUPPORT_LIB_VERSION = "27.1.1"
def DEFAULT_TARGET_SDK_VERSION = 28
android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
@ -41,9 +47,21 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.react:react-native:+'
implementation 'com.facebook.infer.annotation:infer-annotation:+'
implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', DEFAULT_SUPPORT_LIB_VERSION)}"
implementation "com.android.support:customtabs:${safeExtGet('supportLibVersion', DEFAULT_SUPPORT_LIB_VERSION)}"
implementation 'org.greenrobot:eventbus:3.+'
def supportLibVersion = safeExtGet('supportLibVersion', safeExtGet('supportVersion', null))
def androidXVersion = safeExtGet('androidXVersion', null)
if (supportLibVersion && androidXVersion == null) {
implementation "com.android.support:support-annotations:$supportLibVersion"
implementation "com.android.support:customtabs:$supportLibVersion"
} else {
def defaultAndroidXVersion = "1.+"
if (androidXVersion == null) {
androidXVersion = defaultAndroidXVersion
}
def androidXAnnotation = safeExtGet('androidXAnnotation', androidXVersion)
def androidXBrowser = safeExtGet('androidXBrowser', androidXVersion)
implementation "androidx.annotation:annotation:$androidXAnnotation"
implementation "androidx.browser:browser:$androidXBrowser"
}
}

Binary file not shown.

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip

View File

@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.proyecto26.inappbrowser">
<uses-permission android:name="android.permission.INTERNET" />
<application>
<activity
android:name=".ChromeTabsManagerActivity">

View File

@ -5,7 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import org.greenrobot.eventbus.EventBus;
@ -15,8 +15,11 @@ import org.greenrobot.eventbus.EventBus;
*/
public class ChromeTabsManagerActivity extends Activity {
static final String KEY_BROWSER_INTENT = "browserIntent";
static final String BROWSER_RESULT_TYPE = "browserResultType";
static final String DEFAULT_RESULT_TYPE = "dismiss";
private boolean mOpened = false;
private String resultType = null;
public static Intent createStartIntent(Context context, Intent authIntent) {
Intent intent = createBaseIntent(context);
@ -41,10 +44,13 @@ public class ChromeTabsManagerActivity extends Activity {
// This activity gets opened in 2 different ways. If the extra KEY_BROWSER_INTENT is present we
// start that intent and if it is not it means this activity was started with FLAG_ACTIVITY_CLEAR_TOP
// in order to close the intent that was started previously so we just close this.
if (getIntent().hasExtra(KEY_BROWSER_INTENT)) {
if (getIntent().hasExtra(KEY_BROWSER_INTENT)
&& (savedInstanceState == null || savedInstanceState.getString(BROWSER_RESULT_TYPE) == null)
) {
Intent browserIntent = getIntent().getParcelableExtra(KEY_BROWSER_INTENT);
browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(browserIntent);
resultType = DEFAULT_RESULT_TYPE;
} else {
finish();
}
@ -60,14 +66,24 @@ public class ChromeTabsManagerActivity extends Activity {
if (!mOpened) {
mOpened = true;
} else {
EventBus.getDefault().post(new ChromeTabsDismissedEvent("chrome tabs activity closed", "cancel"));
resultType = "cancel";
finish();
}
}
@Override
protected void onDestroy() {
EventBus.getDefault().post(new ChromeTabsDismissedEvent("chrome tabs activity destroyed", "dismiss"));
if (resultType != null) {
switch (resultType) {
case "cancel":
EventBus.getDefault().post(new ChromeTabsDismissedEvent("chrome tabs activity closed", resultType));
break;
default:
EventBus.getDefault().post(new ChromeTabsDismissedEvent("chrome tabs activity destroyed", DEFAULT_RESULT_TYPE));
break;
}
resultType = null;
}
super.onDestroy();
}
@ -76,4 +92,16 @@ public class ChromeTabsManagerActivity extends Activity {
super.onNewIntent(intent);
setIntent(intent);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
resultType = savedInstanceState.getString(BROWSER_RESULT_TYPE);
}
@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putString(BROWSER_RESULT_TYPE, DEFAULT_RESULT_TYPE);
super.onSaveInstanceState(savedInstanceState);
}
}

View File

@ -6,10 +6,13 @@ import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.graphics.Color;
import android.graphics.BitmapFactory;
import android.provider.Browser;
import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent;
import androidx.annotation.Nullable;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.graphics.ColorUtils;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
@ -23,6 +26,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.regex.Pattern;
import java.util.List;
public class RNInAppBrowser {
private final static String ERROR_CODE = "InAppBrowser";
@ -38,8 +42,10 @@ public class RNInAppBrowser {
private static final String KEY_ANIMATION_START_EXIT = "startExit";
private static final String KEY_ANIMATION_END_ENTER = "endEnter";
private static final String KEY_ANIMATION_END_EXIT = "endExit";
private static final String HASBACKBUTTON = "hasBackButton";
private @Nullable Promise mOpenBrowserPromise;
private Boolean isLightTheme;
private Activity currentActivity;
private static final Pattern animationIdentifierPattern = Pattern.compile("^.+:.+/");
@ -66,6 +72,7 @@ public class RNInAppBrowser {
final String colorString = options.getString(KEY_TOOLBAR_COLOR);
try {
builder.setToolbarColor(Color.parseColor(colorString));
isLightTheme = toolbarIsLight(colorString);
} catch (IllegalArgumentException e) {
throw new JSApplicationIllegalArgumentException(
"Invalid toolbar color '" + colorString + "': " + e.getMessage());
@ -92,6 +99,11 @@ public class RNInAppBrowser {
final ReadableMap animations = options.getMap(KEY_ANIMATIONS);
applyAnimation(context, builder, animations);
}
if (options.hasKey(HASBACKBUTTON) &&
options.getBoolean(HASBACKBUTTON)) {
builder.setCloseButtonIcon(BitmapFactory.decodeResource(
context.getResources(), isLightTheme ? R.drawable.ic_arrow_back_black : R.drawable.ic_arrow_back_white));
}
CustomTabsIntent customTabsIntent = builder.build();
@ -122,6 +134,7 @@ public class RNInAppBrowser {
options.getBoolean(KEY_FORCE_CLOSE_ON_REDIRECTION)) {
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
}
Intent intent = customTabsIntent.intent;
@ -150,7 +163,7 @@ public class RNInAppBrowser {
return;
}
EventBus.getDefault().unregister(this);
unRegisterEventBus();
WritableMap result = Arguments.createMap();
result.putString("type", "dismiss");
@ -161,9 +174,15 @@ public class RNInAppBrowser {
ChromeTabsManagerActivity.createDismissIntent(currentActivity));
}
public void isAvailable(Context context, final Promise promise) {
Intent serviceIntent = new Intent("android.support.customtabs.action.CustomTabsService");
List<ResolveInfo> resolveInfos = context.getPackageManager().queryIntentServices(serviceIntent, 0);
promise.resolve(!(resolveInfos == null || resolveInfos.isEmpty()));
}
@Subscribe
public void onEvent(ChromeTabsDismissedEvent event) {
EventBus.getDefault().unregister(this);
unRegisterEventBus();
if (mOpenBrowserPromise == null) {
throw new AssertionError();
@ -208,7 +227,17 @@ public class RNInAppBrowser {
private void registerEventBus() {
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
EventBus.getDefault().register(this);
}
}
private void unRegisterEventBus() {
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
}
private Boolean toolbarIsLight(String themeColor) {
return ColorUtils.calculateLuminance(Color.parseColor(themeColor)) > 0.5;
}
}

View File

@ -7,8 +7,12 @@ import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.module.annotations.ReactModule;
@ReactModule(name = RNInAppBrowserModule.NAME)
public class RNInAppBrowserModule extends ReactContextBaseJavaModule {
public final static String NAME = "RNInAppBrowser";
private final RNInAppBrowser inAppBrowser;
private final ReactApplicationContext reactContext;
@ -20,7 +24,7 @@ public class RNInAppBrowserModule extends ReactContextBaseJavaModule {
@Override
public String getName() {
return "RNInAppBrowser";
return NAME;
}
@ReactMethod
@ -33,4 +37,9 @@ public class RNInAppBrowserModule extends ReactContextBaseJavaModule {
public void close() {
inAppBrowser.close();
}
}
@ReactMethod
public void isAvailable(final Promise promise) {
inAppBrowser.isAvailable(this.reactContext, promise);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

4
example/.eslintrc.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};

View File

@ -5,24 +5,23 @@
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
; Ignore polyfills
.*/Libraries/polyfills/.*
node_modules/react-native/Libraries/polyfills/.*
; Ignore metro
.*/node_modules/metro/.*
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/interface.js
node_modules/react-native/flow/
[options]
@ -31,39 +30,45 @@ emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error
[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
[version]
^0.92.0
^0.113.0

7
example/.gitignore vendored
View File

@ -20,7 +20,6 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IntelliJ
#
@ -40,6 +39,7 @@ yarn-error.log
buck-out/
\.buckd/
*.keystore
!debug.keystore
# fastlane
#
@ -55,6 +55,5 @@ buck-out/
# Bundle artifact
*.jsbundle
# Haul
#
haul-debug.log
# CocoaPods
/ios/Pods/

6
example/.prettierrc.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};

View File

@ -3,10 +3,10 @@
* https://github.com/facebook/react-native
*
* @format
* @flow
* @flow strict-local
*/
import React, { Component } from 'react'
import React, {Component} from 'react';
import {
Platform,
StyleSheet,
@ -16,40 +16,50 @@ import {
Alert,
TextInput,
StatusBar,
Linking
} from 'react-native'
import InAppBrowser from 'react-native-inappbrowser-reborn'
Linking,
} from 'react-native';
import InAppBrowser from 'react-native-inappbrowser-reborn';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu'
})
'Shake or press menu button for dev menu',
});
export default class App extends Component {
constructor (props) {
super(props)
constructor(props) {
super(props);
this.state = {
url: 'https://www.google.com'
}
}
sleep (timeout) {
return new Promise(resolve => setTimeout(resolve, timeout))
url: 'https://www.google.com',
statusBarStyle: 'dark-content',
};
}
async openLink () {
const { url } = this.state
sleep(timeout) {
return new Promise((resolve) => setTimeout(resolve, timeout));
}
async openLink() {
const {url, statusBarStyle} = this.state;
try {
if (await InAppBrowser.isAvailable()) {
StatusBar.setBarStyle('light-content')
// A delay to change the StatusBar when the browser is opened
const animated = true;
const delay = animated && Platform.OS === 'ios' ? 400 : 0;
setTimeout(() => StatusBar.setBarStyle('light-content'), delay);
const result = await InAppBrowser.open(url, {
// iOS Properties
dismissButtonStyle: 'cancel',
preferredBarTintColor: '#453AA4',
preferredControlTintColor: 'white',
readerMode: false,
animated,
modalPresentationStyle: 'fullScreen',
modalTransitionStyle: 'partialCurl',
modalEnabled: true,
enableBarCollapsing: false,
// Android Properties
showTitle: true,
toolbarColor: '#6200EE',
@ -63,37 +73,82 @@ export default class App extends Component {
startEnter: 'slide_in_right',
startExit: 'slide_out_left',
endEnter: 'slide_in_left',
endExit: 'slide_out_right'
endExit: 'slide_out_right',
},
headers: {
'my-custom-header': 'my custom header value'
}
})
await this.sleep(800)
Alert.alert('Response', JSON.stringify(result))
} else Linking.openURL(url)
'my-custom-header': 'my custom header value',
},
});
// A delay to show an alert when the browser is closed
await this.sleep(800);
Alert.alert('Response', JSON.stringify(result));
} else {
Linking.openURL(url);
}
} catch (error) {
Alert.alert(error.message)
Alert.alert(error.message);
} finally {
// Restore the previous StatusBar of the App
StatusBar.setBarStyle(statusBarStyle);
}
}
render () {
getDeepLink(path = '') {
const scheme = 'my-demo';
const prefix =
Platform.OS === 'android' ? `${scheme}://demo/` : `${scheme}://`;
return prefix + path;
}
async tryDeepLinking() {
const loginUrl = 'https://proyecto26.github.io/react-native-inappbrowser/';
const redirectUrl = this.getDeepLink();
const url = `${loginUrl}?redirect_url=${encodeURIComponent(redirectUrl)}`;
try {
if (await InAppBrowser.isAvailable()) {
const result = await InAppBrowser.openAuth(url, redirectUrl, {
// iOS Properties
ephemeralWebSession: false,
// Android Properties
showTitle: false,
enableUrlBarHiding: true,
enableDefaultShare: false,
});
Alert.alert('Response', JSON.stringify(result));
} else {
Alert.alert('InAppBrowser is not supported :/');
}
} catch (error) {
Alert.alert('Somethings wrong with the app :(');
}
}
render() {
const {statusBarStyle} = this.state;
return (
<View style={styles.container}>
<StatusBar barStyle='dark-content' />
<Text style={styles.welcome}>{'Welcome InAppBrowser\nfor React Native!'}</Text>
<StatusBar barStyle={statusBarStyle} />
<Text style={styles.welcome}>
{'Welcome InAppBrowser\nfor React Native!'}
</Text>
<Text style={styles.instructions}>Type the url</Text>
<TextInput
style={styles.urlInput}
onChangeText={(text) => this.setState({ url: text })}
onChangeText={(text) => this.setState({url: text})}
value={this.state.url}
/>
<View style={styles.openButton}>
<Button title='Open link' onPress={() => this.openLink()} />
<Button title="Open link" onPress={() => this.openLink()} />
</View>
<View style={styles.openButton}>
<Button
title="Try deep linking"
onPress={() => this.tryDeepLinking()}
/>
</View>
<Text style={styles.instructions}>{instructions}</Text>
</View>
)
);
}
}
@ -103,26 +158,26 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
padding: 30
padding: 30,
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5
marginBottom: 5,
},
urlInput: {
height: 40,
width: '100%',
borderColor: 'gray',
borderWidth: 1
borderWidth: 1,
},
openButton: {
paddingTop: Platform.OS === 'ios' ? 0 : 20,
paddingBottom: Platform.OS === 'ios' ? 0 : 20
}
})
paddingBottom: Platform.OS === 'ios' ? 0 : 20,
},
});

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>example</name>
<comment>Project android_ created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

View File

@ -1,55 +0,0 @@
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
lib_deps = []
create_aar_targets(glob(["libs/*.aar"]))
create_jar_targets(glob(["libs/*.jar"]))
android_library(
name = "all-libs",
exported_deps = lib_deps,
)
android_library(
name = "app-code",
srcs = glob([
"src/main/java/**/*.java",
]),
deps = [
":all-libs",
":build_config",
":res",
],
)
android_build_config(
name = "build_config",
package = "com.example",
)
android_resource(
name = "res",
package = "com.example",
res = "src/main/res",
)
android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)

View File

@ -1,156 +0,0 @@
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
entryFile: "index.js"
]
project.ext.react = [
cliPath: "node_modules/haul/bin/cli.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-inappbrowser-reborn')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

View File

@ -1,19 +0,0 @@
"""Helper definitions to glob .aar and .jar targets"""
def create_aar_targets(aarfiles):
for aarfile in aarfiles:
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
lib_deps.append(":" + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)
def create_jar_targets(jarfiles):
for jarfile in jarfiles:
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
lib_deps.append(":" + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)

View File

@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
</manifest>

View File

@ -1,26 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<translate android:duration="500" android:fromXDelta="-100%" android:toXDelta="0%"/>
<alpha android:duration="500" android:fromAlpha="0.0" android:toAlpha="1.0" />
</set>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<translate android:duration="500" android:fromXDelta="100%" android:toXDelta="0%" />
<alpha android:duration="500" android:fromAlpha="0.0" android:toAlpha="1.0" />
</set>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<translate android:duration="500" android:fromXDelta="0%" android:toXDelta="-100%"/>
<alpha android:duration="500" android:fromAlpha="1.0" android:toAlpha="0.0" />
</set>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<translate android:duration="500" android:fromXDelta="0%" android:toXDelta="100%"/>
<alpha android:duration="500" android:fromAlpha="1.0" android:toAlpha="0.0" />
</set>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,3 +0,0 @@
<resources>
<string name="app_name">example</string>
</resources>

View File

@ -1,8 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -15,9 +15,14 @@ import com.android.build.OutputFile
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
@ -73,11 +78,7 @@ import com.android.build.OutputFile
*/
project.ext.react = [
entryFile: "index.js"
]
project.ext.react = [
cliPath: "node_modules/haul/bin/cli.js"
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
@ -97,6 +98,28 @@ def enableSeparateBuildPerCPUArchitecture = false
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
@ -120,32 +143,76 @@ android {
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-inappbrowser-reborn')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
@ -154,3 +221,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

Binary file not shown.

View File

@ -8,10 +8,3 @@
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -0,0 +1,72 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.example;
import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(
new NetworkingModule.CustomClientBuilder() {
@Override
public void apply(OkHttpClient.Builder builder) {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
}
});
client.addPlugin(networkFlipperPlugin);
client.start();
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
// Hence we run if after all native modules have been initialized
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext == null) {
reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceManager.ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(ReactContext reactContext) {
reactInstanceManager.removeReactInstanceEventListener(this);
reactContext.runOnNativeModulesQueueThread(
new Runnable() {
@Override
public void run() {
client.addPlugin(new FrescoFlipperPlugin());
}
});
}
});
} else {
client.addPlugin(new FrescoFlipperPlugin());
}
}
}
}

View File

@ -14,7 +14,8 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -4,12 +4,12 @@ import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "example";
}
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "example";
}
}

View File

@ -1,38 +1,39 @@
package com.example;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.proyecto26.inappbrowser.RNInAppBrowserPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNInAppBrowserPackage()
);
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
@ -43,5 +44,37 @@ public class MainApplication extends Application implements ReactApplication {
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.example.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}

View File

@ -3,6 +3,7 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
</resources>

View File

@ -6,14 +6,13 @@ buildscript {
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath("com.android.tools.build:gradle:3.5.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@ -23,11 +22,17 @@ buildscript {
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}

View File

@ -16,3 +16,13 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.33.1

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

View File

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

View File

@ -1,8 +0,0 @@
keystore(
name = "debug",
properties = "debug.keystore.properties",
store = "debug.keystore",
visibility = [
"PUBLIC",
],
)

View File

@ -1,4 +0,0 @@
key.store=debug.keystore
key.alias=androiddebugkey
key.store.password=android
key.alias.password=android

View File

@ -1,5 +1,3 @@
rootProject.name = 'example'
include ':react-native-inappbrowser-reborn'
project(':react-native-inappbrowser-reborn').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-inappbrowser-reborn/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

View File

@ -1,7 +0,0 @@
import { createWebpackConfig } from "haul";
export default {
webpack: createWebpackConfig(({ platform }) => ({
entry: `./index.js`
}))
};

81
example/ios/Podfile Normal file
View File

@ -0,0 +1,81 @@
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
def add_flipper_pods!
version = '~> 0.33.1'
pod 'FlipperKit', version, :configuration => 'Debug'
pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug'
pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug'
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', version, :configuration => 'Debug'
pod 'FlipperKit/FlipperKitReactPlugin', version, :configuration => 'Debug'
end
# Post Install processing for Flipper
def flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == 'YogaKit'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end
target 'example' do
# Pods for example
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
target 'exampleTests' do
inherit! :complete
# Pods for testing
end
use_native_modules!
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
add_flipper_pods!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'example-tvOS' do
# Pods for example-tvOS
target 'example-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end

448
example/ios/Podfile.lock Normal file
View File

@ -0,0 +1,448 @@
PODS:
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.4)
- CocoaLibEvent (1.0.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.62.1)
- FBReactNativeSpec (0.62.1):
- Folly (= 2018.10.22.00)
- RCTRequired (= 0.62.1)
- RCTTypeSafety (= 0.62.1)
- React-Core (= 0.62.1)
- React-jsi (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- Flipper (0.33.1):
- Flipper-Folly (~> 2.1)
- Flipper-RSocket (~> 1.0)
- Flipper-DoubleConversion (1.1.7)
- Flipper-Folly (2.2.0):
- boost-for-react-native
- CocoaLibEvent (~> 1.0)
- Flipper-DoubleConversion
- Flipper-Glog
- OpenSSL-Universal (= 1.0.2.19)
- Flipper-Glog (0.3.6)
- Flipper-PeerTalk (0.0.4)
- Flipper-RSocket (1.1.0):
- Flipper-Folly (~> 2.2)
- FlipperKit (0.33.1):
- FlipperKit/Core (= 0.33.1)
- FlipperKit/Core (0.33.1):
- Flipper (~> 0.33.1)
- FlipperKit/CppBridge
- FlipperKit/FBCxxFollyDynamicConvert
- FlipperKit/FBDefines
- FlipperKit/FKPortForwarding
- FlipperKit/CppBridge (0.33.1):
- Flipper (~> 0.33.1)
- FlipperKit/FBCxxFollyDynamicConvert (0.33.1):
- Flipper-Folly (~> 2.1)
- FlipperKit/FBDefines (0.33.1)
- FlipperKit/FKPortForwarding (0.33.1):
- CocoaAsyncSocket (~> 7.6)
- Flipper-PeerTalk (~> 0.0.4)
- FlipperKit/FlipperKitHighlightOverlay (0.33.1)
- FlipperKit/FlipperKitLayoutPlugin (0.33.1):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutTextSearchable
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutTextSearchable (0.33.1)
- FlipperKit/FlipperKitNetworkPlugin (0.33.1):
- FlipperKit/Core
- FlipperKit/FlipperKitReactPlugin (0.33.1):
- FlipperKit/Core
- FlipperKit/FlipperKitUserDefaultsPlugin (0.33.1):
- FlipperKit/Core
- FlipperKit/SKIOSNetworkPlugin (0.33.1):
- FlipperKit/Core
- FlipperKit/FlipperKitNetworkPlugin
- Folly (2018.10.22.00):
- boost-for-react-native
- DoubleConversion
- Folly/Default (= 2018.10.22.00)
- glog
- Folly/Default (2018.10.22.00):
- boost-for-react-native
- DoubleConversion
- glog
- glog (0.3.5)
- OpenSSL-Universal (1.0.2.19):
- OpenSSL-Universal/Static (= 1.0.2.19)
- OpenSSL-Universal/Static (1.0.2.19)
- RCTRequired (0.62.1)
- RCTTypeSafety (0.62.1):
- FBLazyVector (= 0.62.1)
- Folly (= 2018.10.22.00)
- RCTRequired (= 0.62.1)
- React-Core (= 0.62.1)
- React (0.62.1):
- React-Core (= 0.62.1)
- React-Core/DevSupport (= 0.62.1)
- React-Core/RCTWebSocket (= 0.62.1)
- React-RCTActionSheet (= 0.62.1)
- React-RCTAnimation (= 0.62.1)
- React-RCTBlob (= 0.62.1)
- React-RCTImage (= 0.62.1)
- React-RCTLinking (= 0.62.1)
- React-RCTNetwork (= 0.62.1)
- React-RCTSettings (= 0.62.1)
- React-RCTText (= 0.62.1)
- React-RCTVibration (= 0.62.1)
- React-Core (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default (= 0.62.1)
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/CoreModulesHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/Default (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/DevSupport (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default (= 0.62.1)
- React-Core/RCTWebSocket (= 0.62.1)
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- React-jsinspector (= 0.62.1)
- Yoga
- React-Core/RCTActionSheetHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTAnimationHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTBlobHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTImageHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTLinkingHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTNetworkHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTSettingsHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTTextHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTVibrationHeaders (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-Core/RCTWebSocket (0.62.1):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default (= 0.62.1)
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsiexecutor (= 0.62.1)
- Yoga
- React-CoreModules (0.62.1):
- FBReactNativeSpec (= 0.62.1)
- Folly (= 2018.10.22.00)
- RCTTypeSafety (= 0.62.1)
- React-Core/CoreModulesHeaders (= 0.62.1)
- React-RCTImage (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- React-cxxreact (0.62.1):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2018.10.22.00)
- glog
- React-jsinspector (= 0.62.1)
- React-jsi (0.62.1):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2018.10.22.00)
- glog
- React-jsi/Default (= 0.62.1)
- React-jsi/Default (0.62.1):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2018.10.22.00)
- glog
- React-jsiexecutor (0.62.1):
- DoubleConversion
- Folly (= 2018.10.22.00)
- glog
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsinspector (0.62.1)
- React-RCTActionSheet (0.62.1):
- React-Core/RCTActionSheetHeaders (= 0.62.1)
- React-RCTAnimation (0.62.1):
- FBReactNativeSpec (= 0.62.1)
- Folly (= 2018.10.22.00)
- RCTTypeSafety (= 0.62.1)
- React-Core/RCTAnimationHeaders (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- React-RCTBlob (0.62.1):
- FBReactNativeSpec (= 0.62.1)
- Folly (= 2018.10.22.00)
- React-Core/RCTBlobHeaders (= 0.62.1)
- React-Core/RCTWebSocket (= 0.62.1)
- React-jsi (= 0.62.1)
- React-RCTNetwork (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- React-RCTImage (0.62.1):
- FBReactNativeSpec (= 0.62.1)
- Folly (= 2018.10.22.00)
- RCTTypeSafety (= 0.62.1)
- React-Core/RCTImageHeaders (= 0.62.1)
- React-RCTNetwork (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- React-RCTLinking (0.62.1):
- FBReactNativeSpec (= 0.62.1)
- React-Core/RCTLinkingHeaders (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- React-RCTNetwork (0.62.1):
- FBReactNativeSpec (= 0.62.1)
- Folly (= 2018.10.22.00)
- RCTTypeSafety (= 0.62.1)
- React-Core/RCTNetworkHeaders (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- React-RCTSettings (0.62.1):
- FBReactNativeSpec (= 0.62.1)
- Folly (= 2018.10.22.00)
- RCTTypeSafety (= 0.62.1)
- React-Core/RCTSettingsHeaders (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- React-RCTText (0.62.1):
- React-Core/RCTTextHeaders (= 0.62.1)
- React-RCTVibration (0.62.1):
- FBReactNativeSpec (= 0.62.1)
- Folly (= 2018.10.22.00)
- React-Core/RCTVibrationHeaders (= 0.62.1)
- ReactCommon/turbomodule/core (= 0.62.1)
- ReactCommon/callinvoker (0.62.1):
- DoubleConversion
- Folly (= 2018.10.22.00)
- glog
- React-cxxreact (= 0.62.1)
- ReactCommon/turbomodule/core (0.62.1):
- DoubleConversion
- Folly (= 2018.10.22.00)
- glog
- React-Core (= 0.62.1)
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- ReactCommon/callinvoker (= 0.62.1)
- RNInAppBrowser (3.4.0):
- React
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
DEPENDENCIES:
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
- FlipperKit (~> 0.33.1)
- FlipperKit/FlipperKitLayoutPlugin (~> 0.33.1)
- FlipperKit/FlipperKitReactPlugin (~> 0.33.1)
- FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.33.1)
- FlipperKit/SKIOSNetworkPlugin (~> 0.33.1)
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
- React (from `../node_modules/react-native/`)
- React-Core (from `../node_modules/react-native/`)
- React-Core/DevSupport (from `../node_modules/react-native/`)
- React-Core/RCTWebSocket (from `../node_modules/react-native/`)
- React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
- React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
- React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
- React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
- React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
- React-RCTText (from `../node_modules/react-native/Libraries/Text`)
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- ReactCommon/callinvoker (from `../node_modules/react-native/ReactCommon`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNInAppBrowser (from `../node_modules/react-native-inappbrowser-reborn`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- boost-for-react-native
- CocoaAsyncSocket
- CocoaLibEvent
- Flipper
- Flipper-DoubleConversion
- Flipper-Folly
- Flipper-Glog
- Flipper-PeerTalk
- Flipper-RSocket
- FlipperKit
- OpenSSL-Universal
- YogaKit
EXTERNAL SOURCES:
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
:path: "../node_modules/react-native/Libraries/FBLazyVector"
FBReactNativeSpec:
:path: "../node_modules/react-native/Libraries/FBReactNativeSpec"
Folly:
:podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
glog:
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
RCTRequired:
:path: "../node_modules/react-native/Libraries/RCTRequired"
RCTTypeSafety:
:path: "../node_modules/react-native/Libraries/TypeSafety"
React:
:path: "../node_modules/react-native/"
React-Core:
:path: "../node_modules/react-native/"
React-CoreModules:
:path: "../node_modules/react-native/React/CoreModules"
React-cxxreact:
:path: "../node_modules/react-native/ReactCommon/cxxreact"
React-jsi:
:path: "../node_modules/react-native/ReactCommon/jsi"
React-jsiexecutor:
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
React-jsinspector:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
:path: "../node_modules/react-native/Libraries/NativeAnimation"
React-RCTBlob:
:path: "../node_modules/react-native/Libraries/Blob"
React-RCTImage:
:path: "../node_modules/react-native/Libraries/Image"
React-RCTLinking:
:path: "../node_modules/react-native/Libraries/LinkingIOS"
React-RCTNetwork:
:path: "../node_modules/react-native/Libraries/Network"
React-RCTSettings:
:path: "../node_modules/react-native/Libraries/Settings"
React-RCTText:
:path: "../node_modules/react-native/Libraries/Text"
React-RCTVibration:
:path: "../node_modules/react-native/Libraries/Vibration"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNInAppBrowser:
:path: "../node_modules/react-native-inappbrowser-reborn"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845
CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
FBLazyVector: 95ee3e58937a6052f86b0e32f142388c22fa22c5
FBReactNativeSpec: 26dd6459299e48cd64eb397c45635e466dba9f45
Flipper: 6c1f484f9a88d30ab3e272800d53688439e50f69
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Flipper-Folly: c12092ea368353b58e992843a990a3225d4533c3
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
Flipper-RSocket: 64e7431a55835eb953b0bf984ef3b90ae9fdddd7
FlipperKit: 6dc9b8f4ef60d9e5ded7f0264db299c91f18832e
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355
RCTRequired: e291538a455f5ad1afc2139a4288990be0cadd46
RCTTypeSafety: 8b6237185765dd9a03a3647807e08864105b1f95
React: 7b33e15fab929c47ac9c3c94c409258b13cfe452
React-Core: 9a164d53492e2d8a84e7acf87988253dff09cf93
React-CoreModules: 9aba468d44532cbc301e1323a62b3d796c69c26d
React-cxxreact: 1eed6bc2a4f8e25910994b5dfca1acf1878b25c7
React-jsi: 600d8e42510c3254fd2abd702f4b9d3f598d8f52
React-jsiexecutor: e9698dee4fd43ceb44832baf15d5745f455b0157
React-jsinspector: f74a62727e5604119abd4a1eda52c0a12144bcd5
React-RCTActionSheet: af8f28dd82fec89b8fe29637b8c779829e016a88
React-RCTAnimation: 0d21fff7c20fb8ee41de5f2ebb63221127febd96
React-RCTBlob: 9496bd93130b22069bfbc5d35e98653dae7c35c6
React-RCTImage: a220d154ab3b92bc8a3d040651a21a047c5876b7
React-RCTLinking: 07b694640ae4a43e25c0e3e54713345f9ef1a706
React-RCTNetwork: 043479410782020c2081498b5766db136aea6fe9
React-RCTSettings: 826bed85c8887cec143f561a27bb3044f28fbde4
React-RCTText: 239e040f401505001327a109f9188a4e6dad1bd2
React-RCTVibration: 072c3b427dd29e730c2ee5bfc509cf5054741a50
ReactCommon: 3585806280c51d5c2c0d3aa5a99014c3badb629d
RNInAppBrowser: c1a0dad2734458d79bcb6c8f4297ba8658a1da9f
Yoga: 50fb6eb13d2152e7363293ff603385db380815b1
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
PODFILE CHECKSUM: a52de829a37f999f30e05cdcfceda802cd83620c
COCOAPODS: 1.7.5

View File

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@ -22,6 +22,19 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
@ -36,19 +49,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
BuildableName = "libReact.a"
BlueprintName = "React-tvOS"
ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
@ -34,20 +20,6 @@
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
BuildableName = "example-tvOSTests.xctest"
BlueprintName = "example-tvOSTests"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
@ -67,17 +39,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "example-tvOS.app"
BlueprintName = "example-tvOS"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -99,8 +60,6 @@
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@ -1,25 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
BuildableName = "libReact.a"
BlueprintName = "React"
ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
@ -34,20 +20,6 @@
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "exampleTests.xctest"
BlueprintName = "exampleTests"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
@ -67,17 +39,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "example.app"
BlueprintName = "example"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -99,8 +60,6 @@
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:example.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,10 +1,3 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>

View File

@ -1,20 +1,36 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#if DEBUG
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#if DEBUG
InitializeFlipper(application);
#endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"example"

View File

@ -37,6 +37,19 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
@ -53,21 +66,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@ -1,10 +1,3 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import "AppDelegate.h"

View File

@ -1,10 +1,3 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@ -12,7 +5,7 @@
#import <React/RCTRootView.h>
#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
#define TEXT_TO_LOOK_FOR @"Welcome to React"
@interface exampleTests : XCTestCase
@ -40,11 +33,13 @@
BOOL foundElement = NO;
__block NSString *redboxError = nil;
#ifdef DEBUG
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
#endif
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
@ -58,7 +53,9 @@
}];
}
#ifdef DEBUG
RCTSetLogFunction(RCTDefaultLogFunction);
#endif
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);

11382
example/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,24 +3,30 @@
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"ios": "react-native run-ios --simulator=\"iPhone X\"",
"android": "react-native run-android",
"haul": "haul"
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
"clean:android": "cd android && ./gradlew clean && cd ..",
"clean:ios": "cd ios && pod cache clean --all;rm -rf ~/Library/Caches/CocoaPods; rm -rf Pods; rm -rf ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; pod install;"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.5",
"react-native-inappbrowser-reborn": "^2.0.2"
"react": "16.11.0",
"react-native": "0.62.1",
"react-native-inappbrowser-reborn": "file:.."
},
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/runtime": "^7.4.3",
"babel-jest": "^24.7.1",
"jest": "^24.7.1",
"metro-react-native-babel-preset": "^0.53.1",
"react-test-renderer": "16.8.6"
"@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@react-native-community/eslint-config": "^1.0.0",
"babel-jest": "^25.2.6",
"eslint": "^6.8.0",
"jest": "^25.2.7",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
// @flow
declare var __DEV__: boolean;
declare module 'react-native' {
declare module.exports: any;
}
declare module 'react-native/Libraries/Core/Devtools/parseErrorStack' {
declare type StackFrame = {
column: ?number,
file: string,
lineNumber: number,
methodName: string,
};
declare type ExtendedError = Error & {
framesToPop?: number,
};
declare module.exports: (error: ExtendedError) => Array<StackFrame>;
}
declare module 'react-native/Libraries/Core/Devtools/symbolicateStackTrace' {
import type { StackFrame } from 'react-native/Libraries/Core/Devtools/parseErrorStack';
declare module.exports: (stack: Array<StackFrame>) => Promise<Array<StackFrame>>;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 KiB

After

Width:  |  Height:  |  Size: 743 KiB

27
index.d.ts vendored
View File

@ -12,11 +12,34 @@ declare module 'react-native-inappbrowser-reborn' {
url: string;
}
export interface InAppBrowserOptions {
type InAppBrowseriOSOptions = {
dismissButtonStyle?: 'done' | 'close' | 'cancel',
preferredBarTintColor?: string,
preferredControlTintColor?: string,
readerMode?: boolean,
animated?: boolean,
modalPresentationStyle?:
| 'automatic'
| 'fullScreen'
| 'pageSheet'
| 'formSheet'
| 'currentContext'
| 'custom'
| 'overFullScreen'
| 'overCurrentContext'
| 'popover'
| 'none',
modalTransitionStyle?:
| 'coverVertical'
| 'flipHorizontal'
| 'crossDissolve'
| 'partialCurl',
modalEnabled?: boolean,
enableBarCollapsing?: boolean,
ephemeralWebSession?: boolean
}
type InAppBrowserAndroidOptions = {
showTitle?: boolean,
toolbarColor?: string,
secondaryToolbarColor?: string,
@ -32,6 +55,8 @@ declare module 'react-native-inappbrowser-reborn' {
headers?: { [key: string]: string }
}
export type InAppBrowserOptions = InAppBrowserAndroidOptions | InAppBrowseriOSOptions;
type AuthSessionResult = RedirectResult | BrowserResult;
interface RNInAppBrowserClassMethods {

168
index.js
View File

@ -1,7 +1,20 @@
// @flow
/**
* InAppBrowser for React Native
* https://github.com/proyecto26/react-native-inappbrowser
*
* @format
* @flow strict-local
*/
import invariant from 'invariant'
import { Linking, NativeModules, Platform, processColor } from 'react-native'
import invariant from 'invariant';
import {
Linking,
NativeModules,
Platform,
processColor,
AppState,
AppStateStatus,
} from 'react-native';
const { RNInAppBrowser } = NativeModules;
@ -18,11 +31,34 @@ type RedirectResult = {
url: string,
};
type InAppBrowserOptions = {
type InAppBrowseriOSOptions = {
dismissButtonStyle?: 'done' | 'close' | 'cancel',
preferredBarTintColor?: string,
preferredControlTintColor?: string,
readerMode?: boolean,
animated?: boolean,
modalPresentationStyle?:
| 'automatic'
| 'fullScreen'
| 'pageSheet'
| 'formSheet'
| 'currentContext'
| 'custom'
| 'overFullScreen'
| 'overCurrentContext'
| 'popover'
| 'none',
modalTransitionStyle?:
| 'coverVertical'
| 'flipHorizontal'
| 'crossDissolve'
| 'partialCurl',
modalEnabled?: boolean,
enableBarCollapsing?: boolean,
ephemeralWebSession?: boolean,
};
type InAppBrowserAndroidOptions = {
showTitle?: boolean,
toolbarColor?: string,
secondaryToolbarColor?: string,
@ -33,25 +69,34 @@ type InAppBrowserOptions = {
startEnter: string,
startExit: string,
endEnter: string,
endExit: string
endExit: string,
},
headers?: { [key: string]: string }
}
headers?: { [key: string]: string },
};
async function open(url: string, options: InAppBrowserOptions = {}): Promise<BrowserResult> {
const inAppBrowseroptions = {
type InAppBrowserOptions = InAppBrowserAndroidOptions | InAppBrowseriOSOptions;
async function open(
url: string,
options: InAppBrowserOptions = {}
): Promise<BrowserResult> {
const inAppBrowserOptions = {
...options,
url,
dismissButtonStyle: options.dismissButtonStyle || 'close',
readerMode: options.readerMode !== undefined ? options.readerMode : false
}
if (inAppBrowseroptions.preferredBarTintColor) {
inAppBrowseroptions.preferredBarTintColor = processColor(inAppBrowseroptions.preferredBarTintColor)
}
if (inAppBrowseroptions.preferredControlTintColor) {
inAppBrowseroptions.preferredControlTintColor = processColor(inAppBrowseroptions.preferredControlTintColor)
}
return RNInAppBrowser.open(inAppBrowseroptions);
readerMode: !!options.readerMode,
animated: options.animated !== undefined ? options.animated : true,
modalEnabled:
options.modalEnabled !== undefined ? options.modalEnabled : true,
enableBarCollapsing: !!options.enableBarCollapsing,
preferredBarTintColor:
options.preferredBarTintColor &&
processColor(options.preferredBarTintColor),
preferredControlTintColor:
options.preferredControlTintColor &&
processColor(options.preferredControlTintColor),
};
return RNInAppBrowser.open(inAppBrowserOptions);
}
function close(): void {
@ -60,24 +105,36 @@ function close(): void {
type AuthSessionResult = RedirectResult | BrowserResult;
async function openAuth(url: string, redirectUrl: string, options: InAppBrowserOptions = {}): Promise<AuthSessionResult> {
async function openAuth(
url: string,
redirectUrl: string,
options: InAppBrowserOptions = {}
): Promise<AuthSessionResult> {
const inAppBrowserOptions = {
...options,
ephemeralWebSession:
options.ephemeralWebSession !== undefined
? options.ephemeralWebSession
: false,
};
if (_authSessionIsNativelySupported()) {
return RNInAppBrowser.openAuth(url, redirectUrl);
return RNInAppBrowser.openAuth(url, redirectUrl, inAppBrowserOptions);
} else {
return _openAuthSessionPolyfillAsync(url, redirectUrl, options);
return _openAuthSessionPolyfillAsync(url, redirectUrl, inAppBrowserOptions);
}
}
function closeAuth(): void {
closeAuthSessionPolyfillAsync();
if (_authSessionIsNativelySupported()) {
RNInAppBrowser.closeAuth();
} else {
RNInAppBrowser.close();
close();
}
}
/* iOS <= 10 and Android polyfill for SFAuthenticationSession flow */
function _authSessionIsNativelySupported() {
if (Platform.OS === 'android') {
return false;
@ -89,6 +146,13 @@ function _authSessionIsNativelySupported() {
let _redirectHandler: ?(event: RedirectEvent) => void;
function closeAuthSessionPolyfillAsync(): void {
if (_redirectHandler) {
Linking.removeEventListener('url', _redirectHandler);
_redirectHandler = null;
}
}
async function _openAuthSessionPolyfillAsync(
startUrl: string,
returnUrl: string,
@ -98,20 +162,25 @@ async function _openAuthSessionPolyfillAsync(
!_redirectHandler,
'InAppBrowser.openAuth is in a bad state. _redirectHandler is defined when it should not be.'
);
let response = null;
try {
return await Promise.race([open(startUrl, options), _waitForRedirectAsync(returnUrl)]);
response = await Promise.race([
_waitForRedirectAsync(returnUrl),
open(startUrl, options).then(function (result) {
return _checkResultAndReturnUrl(returnUrl, result);
}),
]);
} finally {
closeAuthSessionPolyfillAsync();
close();
Linking.removeEventListener('url', _redirectHandler);
_redirectHandler = null;
}
return response;
}
function _waitForRedirectAsync(returnUrl: string): Promise<RedirectResult> {
return new Promise(resolve => {
return new Promise(function (resolve) {
_redirectHandler = (event: RedirectEvent) => {
if (event.url.startsWith(returnUrl)) {
if (event.url && event.url.startsWith(returnUrl)) {
resolve({ url: event.url, type: 'success' });
}
};
@ -120,13 +189,42 @@ function _waitForRedirectAsync(returnUrl: string): Promise<RedirectResult> {
});
}
/**
* Detect Android Activity `OnResume` event once
*/
function AppStateActiveOnce(): Promise<void> {
return new Promise(function (resolve) {
function _handleAppStateChange(nextAppState: AppStateStatus) {
if (nextAppState === 'active') {
AppState.removeEventListener('change', _handleAppStateChange);
resolve();
}
}
AppState.addEventListener('change', _handleAppStateChange);
});
}
async function _checkResultAndReturnUrl(
returnUrl: string,
result: AuthSessionResult
): Promise<AuthSessionResult> {
if (Platform.OS === 'android' && result.type !== 'cancel') {
try {
await AppStateActiveOnce();
const url = await Linking.getInitialURL();
return url && url.startsWith(returnUrl)
? { url, type: 'success' }
: result;
} catch {
return result;
}
} else {
return result;
}
}
async function isAvailable(): Promise<boolean> {
if (Platform.OS === 'android') {
return Promise.resolve(true);
}
else {
return RNInAppBrowser.isAvailable();
}
return RNInAppBrowser.isAvailable();
}
export default {

Some files were not shown because too many files have changed in this diff Show More