Skip to content

Commit 5acd097

Browse files
committed
Code review
1 parent 5cbd2be commit 5acd097

File tree

7 files changed

+12370
-25
lines changed

7 files changed

+12370
-25
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ in case of vulnerabilities.
2222

2323
## [Unreleased]
2424

25+
## [3.0.0] - 2020-10-30
26+
### Added
27+
- Added `hasBackButton` option to sets a back arrow instead of the default X icon to close the custom tab.
28+
- Added default browser configuration for custom tab if any.
29+
- Added `browserPackage` option to use a Package name of a browser to be used to handle Custom Tabs.
30+
- Added `showInRecents` option to determine whether browsed website should be shown as separate entry in Android recents/multitasking view.
31+
32+
### Fixed
33+
- Android `isAvailable` method checks **Custom Tab** support.
34+
- Added a null check for `redirectResolve` in `safariViewControllerDidFinish`.
35+
- Fixed `AppStateActiveOnce` event listener.
36+
2537
## [2.3.0] - 2020-04-08
2638
### Added
2739
- Added `ephemeralWebSession` option to supports `ephemeralWebBrowserSession` on iOS 13.
@@ -65,7 +77,8 @@ in case of vulnerabilities.
6577
- Methods to open and close external urls to authenticate the user **(openAuth, closeAuth)** using deep linking.
6678
- `isAvailable` method to detect if the device supports the plugin.
6779

68-
[Unreleased]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.3.0...HEAD
80+
[Unreleased]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v3.0.0...HEAD
81+
[3.0.0]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.3.0...v3.0.0
6982
[2.3.0]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.2.0...v2.3.0
7083
[2.2.0]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.1.1...v2.2.0
7184
[2.1.1]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.1.0...v2.1.1

README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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";
185186
export 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';
195196
import { InAppBrowser } from 'nativescript-inappbrowser';
196197
import { 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
...

demo/app/home/home-view-model.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ export class HelloWorldModel extends Observable {
5555
},
5656
headers: {
5757
'my-custom-header': 'my custom header value'
58-
}
58+
},
59+
hasBackButton: true,
60+
browserPackage: '',
61+
showInRecents: false
5962
});
6063
await sleep(800);
6164
Dialogs.alert({

0 commit comments

Comments
 (0)