feat(IsDebug): add the IsDebug plugin (#475)

This commit is contained in:
Matt Lewis 2016-08-26 10:16:20 +01:00 committed by Ibrahim Hadeed
parent aa76fac3af
commit dd39ba8c48
2 changed files with 37 additions and 0 deletions

View File

@ -53,6 +53,7 @@ import { ImageResizer } from './plugins/imageresizer';
import { InAppBrowser } from './plugins/inappbrowser'; import { InAppBrowser } from './plugins/inappbrowser';
import { Insomnia } from './plugins/insomnia'; import { Insomnia } from './plugins/insomnia';
import { Instagram } from './plugins/instagram'; import { Instagram } from './plugins/instagram';
import { IsDebug } from './plugins/is-debug';
import { Keyboard } from './plugins/keyboard'; import { Keyboard } from './plugins/keyboard';
import { LaunchNavigator } from './plugins/launchnavigator'; import { LaunchNavigator } from './plugins/launchnavigator';
import { LocalNotifications } from './plugins/localnotifications'; import { LocalNotifications } from './plugins/localnotifications';
@ -228,6 +229,7 @@ window['IonicNative'] = {
ImageResizer: ImageResizer, ImageResizer: ImageResizer,
InAppBrowser: InAppBrowser, InAppBrowser: InAppBrowser,
Instagram: Instagram, Instagram: Instagram,
IsDebug: IsDebug,
Keyboard: Keyboard, Keyboard: Keyboard,
LaunchNavigator: LaunchNavigator, LaunchNavigator: LaunchNavigator,
LocalNotifications: LocalNotifications, LocalNotifications: LocalNotifications,

35
src/plugins/is-debug.ts Normal file
View File

@ -0,0 +1,35 @@
import {Plugin, Cordova} from './plugin';
/**
* @name IsDebug
* @description
* Detect if the app is running in debug mode or not.
* Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user.
*
* @usage
* ```
* import {IsDebug} from 'ionic-native';
*
* IsDebug.getIsDebug()
* .then((isDebug: boolean) => console.log('Is debug:', isDebug))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-is-debug',
pluginRef: 'cordova.plugins.IsDebug',
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
})
export class IsDebug {
/**
* Determine if an app was installed via xcode / eclipse / the ionic CLI etc
* @return {Promise<boolean>} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user.
*/
@Cordova()
static getIsDebug(): Promise<boolean> {
return;
}
}