@@ -86,10 +86,9 @@ Property | Description
8686
8787### Demo
8888
89- ``` javascript
90- import { openUrl } from ' tns-core-modules/utils/utils'
91- import { alert } from ' tns-core-modules/ui/dialogs'
92- import { InAppBrowser } from ' nativescript-inappbrowser'
89+ ``` ts
90+ import { Utils , Dialogs } from ' @nativescript/core' ;
91+ import { InAppBrowser } from ' nativescript-inappbrowser' ;
9392
9493...
9594 openLink = async () => {
@@ -124,24 +123,27 @@ import { InAppBrowser } from 'nativescript-inappbrowser'
124123 },
125124 headers: {
126125 ' my-custom-header' : ' my custom header value'
127- }
128- })
129- alert ({
126+ },
127+ hasBackButton: true ,
128+ browserPackage: ' ' ,
129+ showInRecents: false
130+ });
131+ Dialogs .alert ({
130132 title: ' Response' ,
131133 message: JSON .stringify (result ),
132134 okButtonText: ' Ok'
133- })
135+ });
134136 }
135137 else {
136- openUrl (url);
138+ Utils . openUrl (url );
137139 }
138140 }
139141 catch (error ) {
140- alert ({
142+ Dialogs . alert ({
141143 title: ' Error' ,
142144 message: error .message ,
143145 okButtonText: ' Ok'
144- })
146+ });
145147 }
146148 }
147149...
@@ -181,22 +183,21 @@ define your app scheme and replace `my-scheme` and `my-host` with your info.
181183
182184- utilities.ts
183185``` javascript
184- import { android } from " tns-core-modules/application" ;
185186export const getDeepLink = (path = " " ) => {
186187 const scheme = ' my-scheme' ;
187- const prefix = android ? ` ${ scheme} ://my-host/` : ` ${ scheme} ://` ;
188+ const prefix = global . isAndroid ? ` ${ scheme} ://my-host/` : ` ${ scheme} ://` ;
188189 return prefix + path;
189190}
190191```
191192
192193- home-page.ts
193- ``` javascript
194- import { openUrl } from ' tns-core-modules/utils/utils ' ;
194+ ``` ts
195+ import { Utils , Dialogs } from ' @nativescript/core ' ;
195196import { InAppBrowser } from ' nativescript-inappbrowser' ;
196197import { getDeepLink } from ' ./utilities' ;
197198...
198199 async onLogin () {
199- const deepLink = getDeepLink (" callback" )
200+ const deepLink = getDeepLink (' callback' )
200201 const url = ` https://my-auth-login-page.com?redirect_uri=${deepLink } `
201202 try {
202203 if (await InAppBrowser .isAvailable ()) {
@@ -212,12 +213,12 @@ import { getDeepLink } from './utilities';
212213 response .type === ' success' &&
213214 response .url
214215 ) {
215- openUrl (response .url )
216+ Utils . openUrl (response .url )
216217 }
217218 })
218- } else openUrl (url)
219+ } else Utils . openUrl (url )
219220 } catch (error ) {
220- openUrl (url)
221+ Utils . openUrl (url )
221222 }
222223 }
223224...
0 commit comments