Skip to content

Commit

Permalink
feat(browser-tab): add browser tab plugin (#1126)
Browse files Browse the repository at this point in the history
* feature: added hasPermission function to Firebase fixes #1115

* feat: Implemented support for BrowserTab #1077
  • Loading branch information
Aaron Czichon authored and ihadeed committed Mar 2, 2017
1 parent 448ec7a commit 8de3793
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { BarcodeScanner } from './plugins/barcodescanner';
import { Base64ToGallery } from './plugins/base64togallery';
import { BatteryStatus } from './plugins/batterystatus';
import { Brightness } from './plugins/brightness';
import { BrowserTab } from './plugins/browser-tab';
import { BLE } from './plugins/ble';
import { BluetoothSerial } from './plugins/bluetoothserial';
import { Broadcaster } from './plugins/broadcaster';
Expand Down Expand Up @@ -142,6 +143,7 @@ export * from './plugins/batterystatus';
export * from './plugins/ble';
export * from './plugins/bluetoothserial';
export * from './plugins/brightness';
export * from './plugins/browser-tab';
export * from './plugins/broadcaster';
export * from './plugins/calendar';
export * from './plugins/call-number';
Expand Down Expand Up @@ -264,6 +266,7 @@ window['IonicNative'] = {
Base64ToGallery,
BatteryStatus,
Brightness,
BrowserTab,
BLE,
BluetoothSerial,
Broadcaster,
Expand Down
66 changes: 66 additions & 0 deletions src/plugins/browser-tab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* This is a template for new plugin wrappers
*
* TODO:
* - Add/Change information below
* - Document usage (importing, executing main functionality)
* - Remove any imports that you are not using
* - Add this file to /src/index.ts (follow style of other plugins)
* - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs.
* - Remove this note
*
*/
import { Plugin, Cordova } from './plugin';

/**
* @name BrowserTab
* @description
* This plugin does something
*
* @usage
* ```
* import { BrowserTab } from 'ionic-native';
*
* BrowserTab.functionName('Hello', 123)
* .then((something: any) => doSomething(something))
* .catch((error: any) => console.log(error));
*
* ```
*/
@Plugin({
pluginName: 'BrowserTab',
plugin: 'cordova-plugin-browsertab', // npm package name, example: cordova-plugin-camera
pluginRef: 'cordova.plugins.browsertab', // the variable reference to call the plugin, example: navigator.geolocation
repo: 'https://github.com/google/cordova-plugin-browsertab', // the github repository URL for the plugin
platforms: ['Android', 'iOS']
})
export class BrowserTab {

/**
* Check if BrowserTab option is available
* @return {Promise<any>} Returns a promise that resolves when check is successful and returns true or false
*/
@Cordova()
static isAvailable(): Promise<any> {
return; // We add return; here to avoid any IDE / Compiler errors
}

/**
* 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()
static openUrl(url: string): Promise<any> {
return;
}

/**
* Closes browser tab
* @return {Promise<any>} Returns a promise that resolves when close was finished
*/
@Cordova()
static close(): Promise<any> {
return; // We add return; here to avoid any IDE / Compiler errors
}
}
9 changes: 9 additions & 0 deletions src/plugins/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ export class Firebase {
})
static grantPermission(): Promise<any> { return; }

/**
* Check permission to recieve push notifications
* @return {Promise<any>}
*/
@Cordova({
platforms: ['iOS']
})
static hasPermission(): Promise<any> { return; }

/**
* Set icon badge number. Set to 0 to clear the badge.
* @param badgeNumber {number}
Expand Down

0 comments on commit 8de3793

Please sign in to comment.