@@ -46,30 +46,30 @@ let InAppBrowserModuleInstance: InAppBrowserClassMethods;
4646function setup ( ) {
4747 @NativeClass ( )
4848 class InAppBrowserModule extends java . lang . Object implements InAppBrowserClassMethods {
49- private static ERROR_CODE = " InAppBrowser" ;
50- private static KEY_TOOLBAR_COLOR = " toolbarColor" ;
51- private static KEY_SECONDARY_TOOLBAR_COLOR = " secondaryToolbarColor" ;
52- private static KEY_NAVIGATION_BAR_COLOR = " navigationBarColor" ;
53- private static KEY_NAVIGATION_BAR_DIVIDER_COLOR = " navigationBarDividerColor" ;
54- private static KEY_ENABLE_URL_BAR_HIDING = " enableUrlBarHiding" ;
55- private static KEY_SHOW_PAGE_TITLE = " showTitle" ;
56- private static KEY_DEFAULT_SHARE_MENU_ITEM = " enableDefaultShare" ;
57- private static KEY_FORCE_CLOSE_ON_REDIRECTION = " forceCloseOnRedirection" ;
58- private static KEY_ANIMATIONS = " animations" ;
59- private static KEY_HEADERS = " headers" ;
60- private static KEY_ANIMATION_START_ENTER = " startEnter" ;
61- private static KEY_ANIMATION_START_EXIT = " startExit" ;
62- private static KEY_ANIMATION_END_ENTER = " endEnter" ;
63- private static KEY_ANIMATION_END_EXIT = " endExit" ;
64- private static KEY_HAS_BACK_BUTTON = " hasBackButton" ;
65- private static KEY_BROWSER_PACKAGE = " browserPackage" ;
66- private static KEY_SHOW_IN_RECENTS = " showInRecents" ;
49+ private static ERROR_CODE = ' InAppBrowser' ;
50+ private static KEY_TOOLBAR_COLOR = ' toolbarColor' ;
51+ private static KEY_SECONDARY_TOOLBAR_COLOR = ' secondaryToolbarColor' ;
52+ private static KEY_NAVIGATION_BAR_COLOR = ' navigationBarColor' ;
53+ private static KEY_NAVIGATION_BAR_DIVIDER_COLOR = ' navigationBarDividerColor' ;
54+ private static KEY_ENABLE_URL_BAR_HIDING = ' enableUrlBarHiding' ;
55+ private static KEY_SHOW_PAGE_TITLE = ' showTitle' ;
56+ private static KEY_DEFAULT_SHARE_MENU_ITEM = ' enableDefaultShare' ;
57+ private static KEY_FORCE_CLOSE_ON_REDIRECTION = ' forceCloseOnRedirection' ;
58+ private static KEY_ANIMATIONS = ' animations' ;
59+ private static KEY_HEADERS = ' headers' ;
60+ private static KEY_ANIMATION_START_ENTER = ' startEnter' ;
61+ private static KEY_ANIMATION_START_EXIT = ' startExit' ;
62+ private static KEY_ANIMATION_END_ENTER = ' endEnter' ;
63+ private static KEY_ANIMATION_END_EXIT = ' endExit' ;
64+ private static KEY_HAS_BACK_BUTTON = ' hasBackButton' ;
65+ private static KEY_BROWSER_PACKAGE = ' browserPackage' ;
66+ private static KEY_SHOW_IN_RECENTS = ' showInRecents' ;
6767
6868 private static redirectResolve : RedirectResolve ;
6969 private static redirectReject : RedirectReject ;
7070 private isLightTheme : boolean ;
7171 private currentActivity : any ;
72- private animationIdentifierPattern = Pattern . compile ( " ^.+:.+/" ) ;
72+ private animationIdentifierPattern = Pattern . compile ( ' ^.+:.+/' ) ;
7373
7474 constructor ( ) {
7575 super ( ) ;
@@ -99,6 +99,10 @@ function setup() {
9999 if ( ! this . currentActivity ) {
100100 return Promise . reject ( new Error ( InAppBrowserModule . ERROR_CODE ) ) ;
101101 }
102+ const result = new Promise < BrowserResult > ( function ( resolve , reject ) {
103+ InAppBrowserModule . redirectResolve = resolve ;
104+ InAppBrowserModule . redirectReject = reject ;
105+ } ) ;
102106
103107 const inAppBrowserOptions = getDefaultOptions ( url , options ) ;
104108
@@ -201,18 +205,15 @@ function setup() {
201205 else {
202206 intent . putExtra ( CustomTabsIntent . EXTRA_TITLE_VISIBILITY_STATE , CustomTabsIntent . NO_TITLE ) ;
203207 }
204-
208+
205209 this . registerEvent ( ) ;
206210
207211 this . currentActivity . startActivity (
208212 createStartIntent ( this . currentActivity , intent ) ,
209213 customTabsIntent . startAnimationBundle
210214 ) ;
211215
212- return new Promise ( function ( resolve , reject ) {
213- InAppBrowserModule . redirectResolve = resolve ;
214- InAppBrowserModule . redirectReject = reject ;
215- } ) ;
216+ return result ;
216217 }
217218
218219 public close ( ) {
@@ -287,7 +288,7 @@ function setup() {
287288 if ( this . animationIdentifierPattern . matcher ( identifier ) . find ( ) ) {
288289 return context . getResources ( ) . getIdentifier ( identifier , null , null ) ;
289290 } else {
290- return context . getResources ( ) . getIdentifier ( identifier , " anim" , context . getPackageName ( ) ) ;
291+ return context . getResources ( ) . getIdentifier ( identifier , ' anim' , context . getPackageName ( ) ) ;
291292 }
292293 }
293294
0 commit comments