diff --git a/app/README.md b/app/README.md index 31a428720..1992bd9b4 100644 --- a/app/README.md +++ b/app/README.md @@ -92,7 +92,7 @@ const checkAppLaunchUrl = async () => { ### exitApp() ```typescript -exitApp() => never +exitApp() => Promise ``` Force exit the app. This should only be used in conjunction with the `backButton` handler for Android to @@ -100,8 +100,6 @@ exit the app when navigation is complete. Ionic handles this itself so you shouldn't need to call this if using Ionic. -**Returns:** never - **Since:** 1.0.0 -------------------- diff --git a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java index 673edc674..8bf9b7378 100644 --- a/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java +++ b/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java @@ -61,6 +61,7 @@ public void handleOnBackPressed() { @PluginMethod public void exitApp(PluginCall call) { unsetAppListeners(); + call.resolve(); getBridge().getActivity().finish(); } diff --git a/app/ios/Plugin/AppPlugin.m b/app/ios/Plugin/AppPlugin.m index 189b151bd..76c2c0b0a 100644 --- a/app/ios/Plugin/AppPlugin.m +++ b/app/ios/Plugin/AppPlugin.m @@ -4,7 +4,7 @@ // Define the plugin using the CAP_PLUGIN Macro, and // each method the plugin supports using the CAP_PLUGIN_METHOD macro. CAP_PLUGIN(AppPlugin, "App", - CAP_PLUGIN_METHOD(exitApp, CAPPluginReturnNone); + CAP_PLUGIN_METHOD(exitApp, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(getInfo, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(getLaunchUrl, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(getState, CAPPluginReturnPromise); diff --git a/app/src/definitions.ts b/app/src/definitions.ts index c2a64ab0f..d4637e4c3 100644 --- a/app/src/definitions.ts +++ b/app/src/definitions.ts @@ -139,7 +139,7 @@ export interface AppPlugin { * * @since 1.0.0 */ - exitApp(): never; + exitApp(): Promise; /** * Return information about the app. diff --git a/app/src/web.ts b/app/src/web.ts index 5f2678252..c0ba37dbe 100644 --- a/app/src/web.ts +++ b/app/src/web.ts @@ -12,7 +12,7 @@ export class AppWeb extends WebPlugin implements AppPlugin { ); } - exitApp(): never { + exitApp(): Promise { throw this.unimplemented('Not implemented on web.'); }