Skip to content
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

feat(): add IonicNativePlugin base class #1425

Merged
merged 4 commits into from
Apr 27, 2017
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
1 change: 1 addition & 0 deletions src/@ionic-native/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './plugin';
export * from './decorators';
export * from './util';
export * from './ionic-native-plugin';
41 changes: 41 additions & 0 deletions src/@ionic-native/core/ionic-native-plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export class IonicNativePlugin {

static pluginName: string;

static pluginRef: string;

static plugin: string;

static repo: string;

static platforms: string[];

static install: string;

/**
* Returns a boolean that indicates whether the plugin is installed
* @return {boolean}
*/
static installed(): boolean { return false; }

/**
* Returns the original plugin object
*/
static getPlugin(): any {}

/**
* Returns the plugin's name
*/
static getPluginName(): string { return; }

/**
* Returns the plugin's reference
*/
static getPluginRef(): string { return; }

/**
* Returns the plugin's install name
*/
static getPluginInstallName(): string { return; }

}
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/action-sheet/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaProperty } from '@ionic-native/core';
import { Cordova, Plugin, CordovaProperty, IonicNativePlugin } from '@ionic-native/core';

export interface ActionSheetOptions {

Expand Down Expand Up @@ -97,7 +97,7 @@ export interface ActionSheetOptions {
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Browser']
})
@Injectable()
export class ActionSheet {
export class ActionSheet extends IonicNativePlugin {

@CordovaProperty
ANDROID_THEMES: {
Expand Down
6 changes: 2 additions & 4 deletions src/@ionic-native/plugins/admob-free/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
Expand Down Expand Up @@ -105,7 +105,7 @@ export interface AdMobFreeRewardVideoConfig {
platforms: ['Android', 'iOS']
})
@Injectable()
export class AdMobFree {
export class AdMobFree extends IonicNativePlugin {

/**
* Convenience constructor to get event names
Expand Down Expand Up @@ -171,8 +171,6 @@ export class AdMobFree {
})
export class AdMobFreeBanner {



/**
* Update config.
* @param options
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/admob/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';

export type AdSize = 'SMART_BANNER' | 'BANNER' | 'MEDIUM_RECTANGLE' | 'FULL_BANNER' | 'LEADERBOARD' | 'SKYSCRAPER' | 'CUSTOM';
Expand Down Expand Up @@ -123,7 +123,7 @@ export interface AdExtras {
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class AdMob {
export class AdMob extends IonicNativePlugin {

AD_POSITION: {
NO_CHANGE: number;
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/alipay/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';

export interface AlipayOrder {
Expand Down Expand Up @@ -103,7 +103,7 @@ export interface AlipayOrder {
install: 'ionic plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
})
@Injectable()
export class Alipay {
export class Alipay extends IonicNativePlugin {
/**
* Open Alipay to perform App pay
* @param order { AlipayOrder } alipay options
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/android-fingerprint-auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';


export interface AFAAuthOptions {
Expand Down Expand Up @@ -148,7 +148,7 @@ export interface AFAEncryptResponse {
platforms: ['Android']
})
@Injectable()
export class AndroidFingerprintAuth {
export class AndroidFingerprintAuth extends IonicNativePlugin {

/**
* Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/android-full-screen/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';

/**
* @name Android Full Screen
Expand Down Expand Up @@ -29,7 +29,7 @@ import { Cordova, Plugin } from '@ionic-native/core';
platforms: ['Android']
})
@Injectable()
export class AndroidFullScreen {
export class AndroidFullScreen extends IonicNativePlugin {
/**
* Is this plugin supported?
* @return {Promise<void>}
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/app-availability/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';

/**
* @name App Availability
Expand Down Expand Up @@ -40,7 +40,7 @@ import { Cordova, Plugin } from '@ionic-native/core';
platforms: ['Android', 'iOS']
})
@Injectable()
export class AppAvailability {
export class AppAvailability extends IonicNativePlugin {

/**
* Checks if an app is available on device
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/app-preferences/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';

Expand Down Expand Up @@ -27,7 +27,7 @@ import { Injectable } from '@angular/core';
platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'OS X', 'Windows 8', 'Windows Phone']
})
@Injectable()
export class AppPreferences {
export class AppPreferences extends IonicNativePlugin {

/**
* Get a preference value
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/app-rate/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin } from '@ionic-native/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';


declare var window;
Expand Down Expand Up @@ -134,7 +134,7 @@ export interface AppUrls {
platforms: ['Android', 'iOS', 'Windows (experimental)']
})
@Injectable()
export class AppRate {
export class AppRate extends IonicNativePlugin {

/**
* Configure various settings for the Rating View.
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/app-update/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';

/**
Expand Down Expand Up @@ -42,7 +42,7 @@ import { Injectable } from '@angular/core';
platforms: ['Android']
})
@Injectable()
export class AppUpdate {
export class AppUpdate extends IonicNativePlugin {
/**
* Check and update
* @param updateUrl {string} update api url
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/app-version/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';



Expand Down Expand Up @@ -34,7 +34,7 @@ import { Cordova, Plugin } from '@ionic-native/core';
platforms: ['Android', 'iOS']
})
@Injectable()
export class AppVersion {
export class AppVersion extends IonicNativePlugin {

/**
* Returns the name of the app
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/appodeal/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs';
import { Injectable } from '@angular/core';

Expand Down Expand Up @@ -31,7 +31,7 @@ import { Injectable } from '@angular/core';
platforms: [ 'iOS', 'Android' ]
})
@Injectable()
export class Appodeal {
export class Appodeal extends IonicNativePlugin {
// available types of advertisements
readonly AD_TYPES = {
INTERSTITIAL: 1,
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/background-fetch/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';

declare var window;
Expand Down Expand Up @@ -63,7 +63,7 @@ export interface BackgroundFetchConfig {
platforms: ['iOS']
})
@Injectable()
export class BackgroundFetch {
export class BackgroundFetch extends IonicNativePlugin {


/**
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/background-geolocation/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';

declare var window;
Expand Down Expand Up @@ -311,7 +311,7 @@ export interface BackgroundGeolocationConfig {
platforms: ['iOS', 'Android', 'Windows Phone 8']
})
@Injectable()
export class BackgroundGeolocation {
export class BackgroundGeolocation extends IonicNativePlugin {

/**

* Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers

Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/background-mode/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';


Expand Down Expand Up @@ -73,7 +73,7 @@ export interface BackgroundModeConfiguration {
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class BackgroundMode {
export class BackgroundMode extends IonicNativePlugin {

/**
* Enable the background mode.
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/backlight/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova } from '@ionic-native/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';


/**
Expand Down Expand Up @@ -32,7 +32,7 @@ import { Plugin, Cordova } from '@ionic-native/core';
platforms: ['Android']
})
@Injectable()
export class Backlight {
export class Backlight extends IonicNativePlugin {

/**
* This function turns backlight on
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/badge/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';


/**
Expand Down Expand Up @@ -30,7 +30,7 @@ import { Cordova, Plugin } from '@ionic-native/core';
platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8']
})
@Injectable()
export class Badge {
export class Badge extends IonicNativePlugin {

/**
* Clear the badge of the app icon.
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/barcode-scanner/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';


export interface BarcodeScannerOptions {
Expand Down Expand Up @@ -89,7 +89,7 @@ export interface BarcodeScannerOptions {
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows 10', 'Windows 8', 'BlackBerry 10', 'Browser']
})
@Injectable()
export class BarcodeScanner {
export class BarcodeScanner extends IonicNativePlugin {

Encode: {
TEXT_TYPE: string;
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/base64-to-gallery/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';

/**
* @name Base64 To Gallery
Expand Down Expand Up @@ -28,7 +28,7 @@ import { Cordova, Plugin } from '@ionic-native/core';
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class Base64ToGallery {
export class Base64ToGallery extends IonicNativePlugin {

/**
* Converts a base64 string to an image file in the device gallery
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/battery-status/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';

export interface BatteryStatusResponse {
Expand Down Expand Up @@ -52,7 +52,7 @@ export interface BatteryStatusResponse {
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
})
@Injectable()
export class BatteryStatus {
export class BatteryStatus extends IonicNativePlugin {

/**
* Watch the change in battery level
Expand Down
4 changes: 2 additions & 2 deletions src/@ionic-native/plugins/ble/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';

/**
Expand Down Expand Up @@ -176,7 +176,7 @@ import { Observable } from 'rxjs/Observable';
platforms: ['iOS', 'Android']
})
@Injectable()
export class BLE {
export class BLE extends IonicNativePlugin {

/**
* Scan and discover BLE peripherals for the specified amount of time.
Expand Down
Loading