Skip to content

Commit 8de3793

Browse files
Aaron Czichonihadeed
authored andcommitted
feat(browser-tab): add browser tab plugin (#1126)
* feature: added hasPermission function to Firebase fixes #1115 * feat: Implemented support for BrowserTab #1077
1 parent 448ec7a commit 8de3793

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { BarcodeScanner } from './plugins/barcodescanner';
1818
import { Base64ToGallery } from './plugins/base64togallery';
1919
import { BatteryStatus } from './plugins/batterystatus';
2020
import { Brightness } from './plugins/brightness';
21+
import { BrowserTab } from './plugins/browser-tab';
2122
import { BLE } from './plugins/ble';
2223
import { BluetoothSerial } from './plugins/bluetoothserial';
2324
import { Broadcaster } from './plugins/broadcaster';
@@ -142,6 +143,7 @@ export * from './plugins/batterystatus';
142143
export * from './plugins/ble';
143144
export * from './plugins/bluetoothserial';
144145
export * from './plugins/brightness';
146+
export * from './plugins/browser-tab';
145147
export * from './plugins/broadcaster';
146148
export * from './plugins/calendar';
147149
export * from './plugins/call-number';
@@ -264,6 +266,7 @@ window['IonicNative'] = {
264266
Base64ToGallery,
265267
BatteryStatus,
266268
Brightness,
269+
BrowserTab,
267270
BLE,
268271
BluetoothSerial,
269272
Broadcaster,

src/plugins/browser-tab.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* This is a template for new plugin wrappers
3+
*
4+
* TODO:
5+
* - Add/Change information below
6+
* - Document usage (importing, executing main functionality)
7+
* - Remove any imports that you are not using
8+
* - Add this file to /src/index.ts (follow style of other plugins)
9+
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs.
10+
* - Remove this note
11+
*
12+
*/
13+
import { Plugin, Cordova } from './plugin';
14+
15+
/**
16+
* @name BrowserTab
17+
* @description
18+
* This plugin does something
19+
*
20+
* @usage
21+
* ```
22+
* import { BrowserTab } from 'ionic-native';
23+
*
24+
* BrowserTab.functionName('Hello', 123)
25+
* .then((something: any) => doSomething(something))
26+
* .catch((error: any) => console.log(error));
27+
*
28+
* ```
29+
*/
30+
@Plugin({
31+
pluginName: 'BrowserTab',
32+
plugin: 'cordova-plugin-browsertab', // npm package name, example: cordova-plugin-camera
33+
pluginRef: 'cordova.plugins.browsertab', // the variable reference to call the plugin, example: navigator.geolocation
34+
repo: 'https://github.com/google/cordova-plugin-browsertab', // the github repository URL for the plugin
35+
platforms: ['Android', 'iOS']
36+
})
37+
export class BrowserTab {
38+
39+
/**
40+
* Check if BrowserTab option is available
41+
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
42+
*/
43+
@Cordova()
44+
static isAvailable(): Promise<any> {
45+
return; // We add return; here to avoid any IDE / Compiler errors
46+
}
47+
48+
/**
49+
* Opens the provided URL using a browser tab
50+
* @param {string} url The URL you want to open
51+
* @return {Promise<any>} Returns a promise that resolves when check open was successful
52+
*/
53+
@Cordova()
54+
static openUrl(url: string): Promise<any> {
55+
return;
56+
}
57+
58+
/**
59+
* Closes browser tab
60+
* @return {Promise<any>} Returns a promise that resolves when close was finished
61+
*/
62+
@Cordova()
63+
static close(): Promise<any> {
64+
return; // We add return; here to avoid any IDE / Compiler errors
65+
}
66+
}

src/plugins/firebase.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ export class Firebase {
6262
})
6363
static grantPermission(): Promise<any> { return; }
6464

65+
/**
66+
* Check permission to recieve push notifications
67+
* @return {Promise<any>}
68+
*/
69+
@Cordova({
70+
platforms: ['iOS']
71+
})
72+
static hasPermission(): Promise<any> { return; }
73+
6574
/**
6675
* Set icon badge number. Set to 0 to clear the badge.
6776
* @param badgeNumber {number}

0 commit comments

Comments
 (0)