1- import { Color } from 'tns-core-modules/color' ;
2- import { ios } from 'tns-core-modules/utils/utils' ;
1+ import { Color , Utils } from '@nativescript/core' ;
32
43import {
54 BrowserResult ,
@@ -46,7 +45,7 @@ const getPresentationStyle = function (styleKey: string): UIModalPresentationSty
4645 overCurrentContext : UIModalPresentationStyle . OverCurrentContext ,
4746 popover : UIModalPresentationStyle . Popover
4847 } ;
49- const defaultModalPresentationStyle = ios . MajorVersion >= 13 ?
48+ const defaultModalPresentationStyle = Utils . ios . MajorVersion >= 13 ?
5049 UIModalPresentationStyle . Automatic : UIModalPresentationStyle . FullScreen ;
5150 return styles [ styleKey ] !== undefined ? styles [ styleKey ] : defaultModalPresentationStyle ;
5251} ;
@@ -65,7 +64,7 @@ const DEFAULT_PROTOCOLS = [
6564 SFSafariViewControllerDelegate ,
6665 UIAdaptivePresentationControllerDelegate
6766] ;
68- const protocols = ios . MajorVersion >= 13 ? [
67+ const protocols = Utils . ios . MajorVersion >= 13 ? [
6968 ...DEFAULT_PROTOCOLS ,
7069 ASWebAuthenticationPresentationContextProviding
7170] : DEFAULT_PROTOCOLS ;
@@ -81,7 +80,7 @@ class InAppBrowserModule extends NSObject {
8180 private animated = false ;
8281
8382 public isAvailable ( ) : Promise < boolean > {
84- return Promise . resolve ( ios . MajorVersion >= 9 ) ;
83+ return Promise . resolve ( Utils . ios . MajorVersion >= 9 ) ;
8584 }
8685 public open (
8786 authURL : string ,
@@ -94,7 +93,7 @@ class InAppBrowserModule extends NSObject {
9493 this . animated = inAppBrowserOptions . animated ;
9594
9695 const url = NSURL . URLWithString ( inAppBrowserOptions [ 'url' ] ) ;
97- if ( ios . MajorVersion >= 11 ) {
96+ if ( Utils . ios . MajorVersion >= 11 ) {
9897 const config = SFSafariViewControllerConfiguration . alloc ( ) . init ( ) ;
9998 config . barCollapsingEnabled = inAppBrowserOptions . enableBarCollapsing ;
10099 config . entersReaderIfAvailable = inAppBrowserOptions . readerMode ;
@@ -107,7 +106,7 @@ class InAppBrowserModule extends NSObject {
107106 }
108107 this . safariVC . delegate = this ;
109108
110- if ( ios . MajorVersion >= 11 ) {
109+ if ( Utils . ios . MajorVersion >= 11 ) {
111110 if ( inAppBrowserOptions . dismissButtonStyle === 'done' ) {
112111 this . safariVC . dismissButtonStyle = SFSafariViewControllerDismissButtonStyle . Done ;
113112 }
@@ -119,7 +118,7 @@ class InAppBrowserModule extends NSObject {
119118 }
120119 }
121120
122- if ( ios . MajorVersion >= 10 ) {
121+ if ( Utils . ios . MajorVersion >= 10 ) {
123122 if ( inAppBrowserOptions . preferredBarTintColor ) {
124123 this . safariVC . preferredBarTintColor = new Color ( inAppBrowserOptions . preferredBarTintColor ) . ios ;
125124 }
@@ -138,7 +137,7 @@ class InAppBrowserModule extends NSObject {
138137 if ( this . animated ) {
139138 safariHackVC . modalTransitionStyle = getTransitionStyle ( inAppBrowserOptions . modalTransitionStyle ) ;
140139 }
141- if ( ios . MajorVersion >= 13 ) {
140+ if ( Utils . ios . MajorVersion >= 13 ) {
142141 safariHackVC . modalInPresentation = true ;
143142 if ( safariHackVC [ 'setModalInPresentation' ] )
144143 safariHackVC [ 'setModalInPresentation' ] ( true ) ;
@@ -172,13 +171,13 @@ class InAppBrowserModule extends NSObject {
172171 ...options ,
173172 ephemeralWebSession : options . ephemeralWebSession !== undefined ? options . ephemeralWebSession : false ,
174173 } ;
175- if ( ios . MajorVersion >= 11 ) {
174+ if ( Utils . ios . MajorVersion >= 11 ) {
176175 return new Promise < AuthSessionResult > ( ( resolve , reject ) => {
177176 if ( ! this . initializeWebBrowser ( resolve , reject ) ) return ;
178177
179178 const url = NSURL . URLWithString ( authUrl ) ;
180179 this . authSession = (
181- ios . MajorVersion >= 12 ? ASWebAuthenticationSession : SFAuthenticationSession
180+ Utils . ios . MajorVersion >= 12 ? ASWebAuthenticationSession : SFAuthenticationSession
182181 ) . alloc ( ) . initWithURLCallbackURLSchemeCompletionHandler (
183182 url ,
184183 redirectUrl ,
@@ -197,7 +196,7 @@ class InAppBrowserModule extends NSObject {
197196 this . flowDidFinish ( ) ;
198197 }
199198 ) ;
200- if ( ios . MajorVersion >= 13 ) {
199+ if ( Utils . ios . MajorVersion >= 13 ) {
201200 const webAuthSession = this . authSession as ASWebAuthenticationSession ;
202201 // Prevent re-use cookie from last auth session
203202 webAuthSession . prefersEphemeralWebBrowserSession = inAppBrowserOptions . ephemeralWebSession ;
@@ -216,7 +215,7 @@ class InAppBrowserModule extends NSObject {
216215 }
217216 }
218217 public closeAuth ( ) {
219- if ( ios . MajorVersion >= 11 ) {
218+ if ( Utils . ios . MajorVersion >= 11 ) {
220219 const authSession : SFAuthenticationSession | ASWebAuthenticationSession = this . authSession ;
221220 authSession . cancel ( ) ;
222221 if ( this . redirectResolve ) {
0 commit comments