Skip to content

Release 3.0.0 #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ matrix:
os: osx
env:
- WebPack="iOS"
osx_image: xcode11.2
osx_image: xcode12.2
language: node_js
node_js: "10"
jdk: oraclejdk8
Expand All @@ -32,8 +32,8 @@ matrix:
- os: osx
env:
- BuildiOS="12"
- Xcode="11.2"
osx_image: xcode11.2
- Xcode="12.2"
osx_image: xcode12.2
language: node_js
node_js: "10"
jdk: oraclejdk8
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ in case of vulnerabilities.

## [Unreleased]

## [3.0.0] - 2020-10-30
### Added
- Added `hasBackButton` option to sets a back arrow instead of the default X icon to close the custom tab.
- Added default browser configuration for custom tab if any.
- Added `browserPackage` option to use a Package name of a browser to be used to handle Custom Tabs.
- Added `showInRecents` option to determine whether browsed website should be shown as separate entry in Android recents/multitasking view.

### Fixed
- Android `isAvailable` method checks **Custom Tab** support.
- Added a null check for `redirectResolve` in `safariViewControllerDidFinish`.
- Fixed `AppStateActiveOnce` event listener.
- Disable swipe to dismiss gesture for modal.

## [2.3.0] - 2020-04-08
### Added
- Added `ephemeralWebSession` option to supports `ephemeralWebBrowserSession` on iOS 13.
Expand Down Expand Up @@ -65,7 +78,8 @@ in case of vulnerabilities.
- Methods to open and close external urls to authenticate the user **(openAuth, closeAuth)** using deep linking.
- `isAvailable` method to detect if the device supports the plugin.

[Unreleased]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.3.0...HEAD
[Unreleased]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v3.0.0...HEAD
[3.0.0]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.3.0...v3.0.0
[2.3.0]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.2.0...v2.3.0
[2.2.0]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.1.1...v2.2.0
[2.1.1]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v2.1.0...v2.1.1
Expand Down
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<h4 align="center"><a href="https://developer.chrome.com/multidevice/android/customtabs#whatarethey">Chrome Custom Tabs</a> for Android & <a href="https://developer.apple.com/documentation/safariservices">SafariServices</a>/<a href="https://developer.apple.com/documentation/authenticationservices">AuthenticationServices</a> for iOS.</h4>

<p align="center">
<img width="400px" src="img/inappbrowser.png">
<img width="400px" src="https://github.com/proyecto26/nativescript-inappbrowser/blob/develop/img/inappbrowser.png?raw=true">
</p>

## Getting started
Expand Down Expand Up @@ -80,13 +80,15 @@ Property | Description
`animations` (Object) | Sets the start and exit animations. [`{ startEnter, startExit, endEnter, endExit }`]
`headers` (Object) | The data are key/value pairs, they will be sent in the HTTP request headers for the provided url. [`{ 'Authorization': 'Bearer ...' }`]
`forceCloseOnRedirection` (Boolean) | Open Custom Tab in a new task to avoid issues redirecting back to app scheme. [`true`/`false`]
`hasBackButton` (Boolean) | Sets a back arrow instead of the default `X` icon to close the custom tab. [`true`/`false`]
`browserPackage` (String) | Package name of a browser to be used to handle Custom Tabs.
`showInRecents` (Boolean) | Determining whether browsed website should be shown as separate entry in Android recents/multitasking view. [`true`/`false`]

### Demo

```javascript
import { openUrl } from 'tns-core-modules/utils/utils'
import { alert } from 'tns-core-modules/ui/dialogs'
import InAppBrowser from 'nativescript-inappbrowser'
```ts
import { Utils, Dialogs } from '@nativescript/core';
import { InAppBrowser } from 'nativescript-inappbrowser';

...
openLink = async () => {
Expand All @@ -101,7 +103,7 @@ import InAppBrowser from 'nativescript-inappbrowser'
readerMode: false,
animated: true,
modalPresentationStyle: 'fullScreen',
modalTransitionStyle: 'partialCurl',
modalTransitionStyle: 'coverVertical',
modalEnabled: true,
enableBarCollapsing: false,
// Android Properties
Expand All @@ -121,24 +123,27 @@ import InAppBrowser from 'nativescript-inappbrowser'
},
headers: {
'my-custom-header': 'my custom header value'
}
})
alert({
},
hasBackButton: true,
browserPackage: '',
showInRecents: false
});
Dialogs.alert({
title: 'Response',
message: JSON.stringify(result),
okButtonText: 'Ok'
})
});
}
else {
openUrl(url);
Utils.openUrl(url);
}
}
catch(error) {
alert({
Dialogs.alert({
title: 'Error',
message: error.message,
okButtonText: 'Ok'
})
});
}
}
...
Expand All @@ -155,7 +160,7 @@ define your app scheme and replace `my-scheme` and `my-host` with your info.
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="my-scheme" android:host="my-host" android:pathPrefix="" />
<data android:scheme="my-scheme" android:host="my-host" />
</intent-filter>
```

Expand All @@ -178,22 +183,21 @@ define your app scheme and replace `my-scheme` and `my-host` with your info.

- utilities.ts
```javascript
import { android } from "tns-core-modules/application";
export const getDeepLink = (path = "") => {
const scheme = 'my-scheme';
const prefix = android ? `${scheme}://my-host/` : `${scheme}://`;
const prefix = global.isAndroid ? `${scheme}://my-host/` : `${scheme}://`;
return prefix + path;
}
```

- home-page.ts
```javascript
import { openUrl } from 'tns-core-modules/utils/utils';
import InAppBrowser from 'nativescript-inappbrowser';
```ts
import { Utils, Dialogs } from '@nativescript/core';
import { InAppBrowser } from 'nativescript-inappbrowser';
import { getDeepLink } from './utilities';
...
async onLogin() {
const deepLink = getDeepLink("callback")
const deepLink = getDeepLink('callback')
const url = `https://my-auth-login-page.com?redirect_uri=${deepLink}`
try {
if (await InAppBrowser.isAvailable()) {
Expand All @@ -209,12 +213,12 @@ import { getDeepLink } from './utilities';
response.type === 'success' &&
response.url
) {
openUrl(response.url)
Utils.openUrl(response.url)
}
})
} else openUrl(url)
} else Utils.openUrl(url)
} catch (error) {
openUrl(url)
Utils.openUrl(url)
}
}
...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="my-demo" android:host="demo" android:pathPrefix="" />
<data android:scheme="my-demo" android:host="demo" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity"/>
Expand Down
7 changes: 5 additions & 2 deletions demo/app/home/home-view-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class HelloWorldModel extends Observable {
readerMode: false,
animated: true,
modalPresentationStyle: 'fullScreen',
modalTransitionStyle: 'partialCurl',
modalTransitionStyle: 'coverVertical',
modalEnabled: true,
enableBarCollapsing: false,
// Android Properties
Expand All @@ -55,7 +55,10 @@ export class HelloWorldModel extends Observable {
},
headers: {
'my-custom-header': 'my custom header value'
}
},
hasBackButton: true,
browserPackage: '',
showInRecents: false
});
await sleep(800);
Dialogs.alert({
Expand Down
4 changes: 2 additions & 2 deletions demo/nativescript.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NativeScriptConfig } from '@nativescript/core'
import { NativeScriptConfig } from '@nativescript/core';

export default {
id: 'org.nativescript.demo',
Expand All @@ -9,4 +9,4 @@ export default {
},
useLegacyWorkflow: false,
appPath: 'app',
} as NativeScriptConfig
} as NativeScriptConfig;
Loading