Skip to content

Commit fdfa51b

Browse files
committed
2 parents dba68df + cb7f65a commit fdfa51b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ StatusBar.setBarStyle = (style) => {
221221
};
222222
```
223223

224-
You can than restore the old bar style after the browser has been dismissed like this:
224+
You can than restore the old bar style after the browser has been dismissed like this:
225225

226226
```javascript
227227
async openInBrowser(url) {
@@ -246,7 +246,7 @@ Thanks goes to these wonderful people:
246246
<!-- CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
247247
| [<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:[email protected]) | [<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:[email protected]) | [<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:[email protected]) | [<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:[email protected]) | [<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:[email protected]) |
248248
| :---: | :---: |:---: | :---: | :---: | :---: | :---: |
249-
| [<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:[email protected]) | [<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) |
249+
| [<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:[email protected]) | [<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) |
250250
<!-- CONTRIBUTORS-LIST:END -->
251251

252252
## Supporting 🍻

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public void open(Context context, final ReadableMap options, final Promise promi
134134
intent.putExtra(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE, CustomTabsIntent.NO_TITLE);
135135
}
136136

137-
EventBus.getDefault().register(this);
137+
registerEventBus();
138138

139139
currentActivity.startActivity(
140140
ChromeTabsManagerActivity.createStartIntent(currentActivity, intent));
@@ -144,14 +144,14 @@ public void close() {
144144
if (mOpenBrowserPromise == null) {
145145
return;
146146
}
147-
147+
148148
if (currentActivity == null) {
149149
mOpenBrowserPromise.reject(ERROR_CODE, "No activity");
150150
mOpenBrowserPromise = null;
151151
return;
152152
}
153153

154-
EventBus.getDefault().unregister(this);
154+
registerEventBus();
155155

156156
WritableMap result = Arguments.createMap();
157157
result.putString("type", "dismiss");
@@ -204,4 +204,10 @@ private int resolveAnimationIdentifierIfNeeded(Context context, String identifie
204204
return context.getResources().getIdentifier(identifier, "anim", context.getPackageName());
205205
}
206206
}
207-
}
207+
208+
private void registerEventBus() {
209+
if (!EventBus.getDefault().isRegistered(this)) {
210+
EventBus.getDefault().register(this);
211+
}
212+
}
213+
}

0 commit comments

Comments
 (0)