@@ -21,13 +21,17 @@ import {
2121 BrowserResult ,
2222 getDefaultOptions ,
2323 InAppBrowserOptions ,
24- InAppBrowserClassMethods
24+ InAppBrowserClassMethods ,
25+ RedirectResolve ,
26+ RedirectReject ,
27+ BROWSER_TYPES ,
2528} from './InAppBrowser.common' ;
2629import {
2730 Builder ,
2831 getDrawableId ,
2932 toolbarIsLight ,
3033 CustomTabsIntent ,
34+ DISMISSED_EVENT ,
3135 ARROW_BACK_WHITE ,
3236 ARROW_BACK_BLACK ,
3337 getPreferredPackages ,
@@ -59,9 +63,9 @@ function setup() {
5963 private static KEY_BROWSER_PACKAGE = "browserPackage" ;
6064 private static KEY_SHOW_IN_RECENTS = "showInRecents" ;
6165
62- private static redirectResolve : any ;
63- private static redirectReject : any ;
64- private isLightTheme : Boolean ;
66+ private static redirectResolve : RedirectResolve ;
67+ private static redirectReject : RedirectReject ;
68+ private isLightTheme : boolean ;
6569 private currentActivity : any ;
6670 private animationIdentifierPattern = Pattern . compile ( "^.+:.+/" ) ;
6771
@@ -84,7 +88,7 @@ function setup() {
8488 if ( mOpenBrowserPromise ) {
8589 this . flowDidFinish ( ) ;
8690 const result : BrowserResult = {
87- type : 'cancel'
91+ type : BROWSER_TYPES . CANCEL
8892 } ;
8993 return Promise . resolve ( result ) ;
9094 }
@@ -207,7 +211,7 @@ function setup() {
207211 return ;
208212 }
209213
210- BROWSER_ACTIVITY_EVENTS . off ( 'DismissedEvent' ) ;
214+ BROWSER_ACTIVITY_EVENTS . off ( DISMISSED_EVENT ) ;
211215
212216 const result : BrowserResult = {
213217 type : 'dismiss'
@@ -243,7 +247,7 @@ function setup() {
243247 }
244248
245249 public onEvent ( event : EventData ) : void {
246- BROWSER_ACTIVITY_EVENTS . off ( 'DismissedEvent' ) ;
250+ BROWSER_ACTIVITY_EVENTS . off ( DISMISSED_EVENT ) ;
247251
248252 if ( ! InAppBrowserModule . redirectResolve ) {
249253 throw new AssertionError ( ) ;
@@ -252,12 +256,12 @@ function setup() {
252256 InAppBrowserModule . redirectResolve ( {
253257 type : browserEvent . resultType ,
254258 message : browserEvent . message
255- } ) ;
259+ } as BrowserResult ) ;
256260 this . flowDidFinish ( ) ;
257261 }
258262
259263 private registerEvent ( ) : void {
260- BROWSER_ACTIVITY_EVENTS . once ( 'DismissedEvent' , ( e ) => this . onEvent ( e ) ) ;
264+ BROWSER_ACTIVITY_EVENTS . once ( DISMISSED_EVENT , ( e ) => this . onEvent ( e ) ) ;
261265 }
262266
263267 private resolveAnimationIdentifierIfNeeded ( context : Context , identifier : string ) : number {
0 commit comments