From 4a731e791e9c99e0f45b11fabe1170d2ba4758dc Mon Sep 17 00:00:00 2001 From: Maxim Belov Date: Thu, 29 Apr 2021 22:19:45 +0300 Subject: [PATCH] feat(restart): add plugin --- src/@ionic-native/plugins/restart/index.ts | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/@ionic-native/plugins/restart/index.ts diff --git a/src/@ionic-native/plugins/restart/index.ts b/src/@ionic-native/plugins/restart/index.ts new file mode 100644 index 0000000000..6c18123403 --- /dev/null +++ b/src/@ionic-native/plugins/restart/index.ts @@ -0,0 +1,50 @@ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; + +/** + * @name Restart + * @description + * This plugin to restart android application + * + * @usage + * ```typescript + * import { Restart } from '@ionic-native/restart'; + * + * + * constructor(private restart: Restart) { } + * + * ... + * + * + * this.restart.restart(true) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + pluginName: 'Restart', + plugin: 'cordova-plugin-restart', + pluginRef: 'RestartPlugin', + repo: 'https://github.com/MaximBelov/cordova-plugin-restart', + install: 'ionic cordova plugin add cordova-plugin-restart', + platforms: ['Android'] +}) +@Injectable() +export class Restart extends IonicNativePlugin { + @Cordova({ + errorIndex: 0, + successIndex: 2 + }) + restart(cold: boolean): Promise { + return; + } + + @Cordova({ + errorIndex: 0, + }) + enableDebug(): Promise{ + return; + } + +}