feat(browser-tab): add plugin (#4046)

* feat(browser-tab): add plugin

* feat(browser-tab): add documentation

Co-authored-by: Neroda.NN <n.neroda@lcgroup.su>
This commit is contained in:
VReactor 2022-02-19 23:37:28 +03:00 committed by GitHub
parent 711affd42d
commit daa4887325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 0 deletions

View File

@ -214,6 +214,7 @@
* [Android Notch](plugins/android-notch.md)
* [Network Interface](plugins/network-interface.md)
* [Printer](plugins/printer.md)
* [Browser Tab](plugins/browser-tab.md)
* [Installation](installation.md)
* [FAQ](faq.md)

View File

@ -0,0 +1,17 @@
# Browser Tab
```
$ ionic cordova plugin add cordova-plugin-browsertab
$ npm install @awesome-cordova-plugins/browser-tab
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/browser-tab/)
Plugin Repo: [https://github.com/google/cordova-plugin-browsertab](https://github.com/google/cordova-plugin-browsertab)
This plugin provides an interface to in-app browser tabs that exist on some mobile platforms, specifically [Custom Tabs](http://developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS.
## Supported platforms
- Android
- iOS

View File

@ -0,0 +1,17 @@
# Browser Tab
```
$ ionic cordova plugin add cordova-plugin-browsertab
$ npm install @awesome-cordova-plugins/browser-tab
```
## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/browser-tab/)
Plugin Repo: [https://github.com/google/cordova-plugin-browsertab](https://github.com/google/cordova-plugin-browsertab)
This plugin provides an interface to in-app browser tabs that exist on some mobile platforms, specifically [Custom Tabs](http://developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS.
## Supported platforms
- Android
- iOS

View File

@ -0,0 +1,63 @@
import { Injectable } from '@angular/core';
import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
/**
* @name Browser Tab
* @description
* This plugin provides an interface to in-app browser tabs that exist on some mobile platforms, specifically [Custom Tabs](http://developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS.
*
* @usage
* ```typescript
* import { BrowserTab } from '@awesome-cordova-plugins/browser-tab/ngx';
*
* constructor(private browserTab: BrowserTab) {
*
* browserTab.isAvailable()
* .then(isAvailable => {
* if (isAvailable) {
* browserTab.openUrl('https://ionic.io');
* } else {
* // open URL with InAppBrowser instead or SafariViewController
* }
* });
* }
*
* ```
*/
@Plugin({
pluginName: 'BrowserTab',
plugin: 'cordova-plugin-browsertab',
pluginRef: 'cordova.plugins.browsertab',
repo: 'https://github.com/google/cordova-plugin-browsertab',
platforms: ['Android', 'iOS'],
})
@Injectable()
export class BrowserTab extends AwesomeCordovaNativePlugin {
/**
* Check if BrowserTab option is available
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
*/
@Cordova()
isAvailable(): Promise<any> {
return;
}
/**
* Opens the provided URL using a browser tab
* @param {string} url The URL you want to open
* @return {Promise<any>} Returns a promise that resolves when check open was successful
*/
@Cordova()
openUrl(url: string): Promise<any> {
return;
}
/**
* Closes browser tab
* @return {Promise<any>} Returns a promise that resolves when close was finished
*/
@Cordova()
close(): Promise<any> {
return;
}
}