@capacitor/app 1.0.7 → 4.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,64 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 4.0.0-beta.0 (2022-06-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Make removeAllListeners return a promise ([#895](https://github.com/ionic-team/capacitor-plugins/issues/895)) ([e5c49d6](https://github.com/ionic-team/capacitor-plugins/commit/e5c49d64445dca70286334e6a0441d8021197b13))
12
+ * **app:** get correct build value ([#858](https://github.com/ionic-team/capacitor-plugins/issues/858)) ([4d3b125](https://github.com/ionic-team/capacitor-plugins/commit/4d3b1253c5a9c699c146526fab64c4184f810469))
13
+ * correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
14
+ * inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
15
+ * **app:** Don't unset App Listeners on removeAllListeners ([#716](https://github.com/ionic-team/capacitor-plugins/issues/716)) ([17f2ee8](https://github.com/ionic-team/capacitor-plugins/commit/17f2ee8743e1366dd74771bdad9829cc5f3891e8))
16
+ * remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
17
+ * **app:** Update getLaunchUrl return type as can be undefined ([#299](https://github.com/ionic-team/capacitor-plugins/issues/299)) ([cdc446b](https://github.com/ionic-team/capacitor-plugins/commit/cdc446b1349ef55717b12756d3fcb2fbec671a28))
18
+ * **app:** use alternative to deprecated versionCode ([#491](https://github.com/ionic-team/capacitor-plugins/issues/491)) ([6ebabf7](https://github.com/ionic-team/capacitor-plugins/commit/6ebabf77f1b9a954b25fdad8aaf9a89638d8366b))
19
+ * add es2017 lib to tsconfig ([#180](https://github.com/ionic-team/capacitor-plugins/issues/180)) ([2c3776c](https://github.com/ionic-team/capacitor-plugins/commit/2c3776c38ca025c5ee965dec10ccf1cdb6c02e2f))
20
+ * support deprecated types from Capacitor 2 ([#139](https://github.com/ionic-team/capacitor-plugins/issues/139)) ([2d7127a](https://github.com/ionic-team/capacitor-plugins/commit/2d7127a488e26f0287951921a6db47c49d817336))
21
+ * **app:** remove iOS deprecate warnings ([#121](https://github.com/ionic-team/capacitor-plugins/issues/121)) ([d009826](https://github.com/ionic-team/capacitor-plugins/commit/d009826ded4a948041586bcc4d8a0fa51afbea5f))
22
+
23
+
24
+ ### Features
25
+
26
+ * set targetSDK default value to 32 ([#970](https://github.com/ionic-team/capacitor-plugins/issues/970)) ([fa70d96](https://github.com/ionic-team/capacitor-plugins/commit/fa70d96f141af751aae53ceb5642c46b204f5958))
27
+ * Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0))
28
+ * **app:** return promise in exitApp ([#777](https://github.com/ionic-team/capacitor-plugins/issues/777)) ([38e1efc](https://github.com/ionic-team/capacitor-plugins/commit/38e1efc742c7d9e887dfae3848261476202159c1))
29
+ * set targetSDK default value to 31 ([#824](https://github.com/ionic-team/capacitor-plugins/issues/824)) ([3ee10de](https://github.com/ionic-team/capacitor-plugins/commit/3ee10de98067984c1a4e75295d001c5a895c47f4))
30
+ * Upgrade gradle to 7.4 ([#826](https://github.com/ionic-team/capacitor-plugins/issues/826)) ([5db0906](https://github.com/ionic-team/capacitor-plugins/commit/5db0906f6264287c4f8e69dbaecf19d4d387824b))
31
+ * **android:** support for minimizeApp ([#743](https://github.com/ionic-team/capacitor-plugins/issues/743)) ([3ec2008](https://github.com/ionic-team/capacitor-plugins/commit/3ec2008bc0311c837346ecbdd0afd105149b427a))
32
+ * **app:** Add canGoBack to backButton event ([#265](https://github.com/ionic-team/capacitor-plugins/issues/265)) ([6d7861e](https://github.com/ionic-team/capacitor-plugins/commit/6d7861e78ff7990a21396d05270c622d42850a02))
33
+ * add commonjs output format ([#179](https://github.com/ionic-team/capacitor-plugins/issues/179)) ([8e9e098](https://github.com/ionic-team/capacitor-plugins/commit/8e9e09862064b3f6771d7facbc4008e995d9b463))
34
+ * App plugin ([#71](https://github.com/ionic-team/capacitor-plugins/issues/71)) ([94e4219](https://github.com/ionic-team/capacitor-plugins/commit/94e4219e61fbb7a51075cc430f29fc08254f659c))
35
+
36
+
37
+
38
+
39
+
40
+ ## [1.1.1](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/app@1.1.0...@capacitor/app@1.1.1) (2022-03-03)
41
+
42
+ **Note:** Version bump only for package @capacitor/app
43
+
44
+
45
+
46
+
47
+
48
+ # [1.1.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/app@1.0.7...@capacitor/app@1.1.0) (2022-01-19)
49
+
50
+
51
+ ### Bug Fixes
52
+
53
+ * inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
54
+
55
+
56
+ ### Features
57
+
58
+ * **android:** support for minimizeApp ([#743](https://github.com/ionic-team/capacitor-plugins/issues/743)) ([3ec2008](https://github.com/ionic-team/capacitor-plugins/commit/3ec2008bc0311c837346ecbdd0afd105149b427a))
59
+
60
+
61
+
62
+
63
+
6
64
  ## [1.0.7](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/app@1.0.6...@capacitor/app@1.0.7) (2021-12-08)
7
65
 
8
66
 
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'app/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '12.0'
14
+ s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/README.md CHANGED
@@ -63,7 +63,7 @@ App.addListener('appRestoredResult', data => {
63
63
  const checkAppLaunchUrl = async () => {
64
64
  const { url } = await App.getLaunchUrl();
65
65
 
66
- alert('App opened with URL: ' + url);
66
+ console.log('App opened with URL: ' + url);
67
67
  };
68
68
  ```
69
69
 
@@ -75,6 +75,7 @@ const checkAppLaunchUrl = async () => {
75
75
  * [`getInfo()`](#getinfo)
76
76
  * [`getState()`](#getstate)
77
77
  * [`getLaunchUrl()`](#getlaunchurl)
78
+ * [`minimizeApp()`](#minimizeapp)
78
79
  * [`addListener('appStateChange', ...)`](#addlistenerappstatechange)
79
80
  * [`addListener('appUrlOpen', ...)`](#addlistenerappurlopen)
80
81
  * [`addListener('appRestoredResult', ...)`](#addlistenerapprestoredresult)
@@ -91,7 +92,7 @@ const checkAppLaunchUrl = async () => {
91
92
  ### exitApp()
92
93
 
93
94
  ```typescript
94
- exitApp() => never
95
+ exitApp() => Promise<void>
95
96
  ```
96
97
 
97
98
  Force exit the app. This should only be used in conjunction with the `backButton` handler for Android to
@@ -99,8 +100,6 @@ exit the app when navigation is complete.
99
100
 
100
101
  Ionic handles this itself so you shouldn't need to call this if using Ionic.
101
102
 
102
- **Returns:** <code>never</code>
103
-
104
103
  **Since:** 1.0.0
105
104
 
106
105
  --------------------
@@ -151,6 +150,21 @@ Get the URL the app was launched with, if any.
151
150
  --------------------
152
151
 
153
152
 
153
+ ### minimizeApp()
154
+
155
+ ```typescript
156
+ minimizeApp() => Promise<void>
157
+ ```
158
+
159
+ Minimizes the application.
160
+
161
+ Only available for Android.
162
+
163
+ **Since:** 1.1.0
164
+
165
+ --------------------
166
+
167
+
154
168
  ### addListener('appStateChange', ...)
155
169
 
156
170
  ```typescript
@@ -1,8 +1,8 @@
1
1
  ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,17 +11,17 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:4.2.1'
14
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
15
  }
16
16
  }
17
17
 
18
18
  apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
22
  defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
25
  versionCode 1
26
26
  versionName "1.0"
27
27
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -36,14 +36,13 @@ android {
36
36
  abortOnError false
37
37
  }
38
38
  compileOptions {
39
- sourceCompatibility JavaVersion.VERSION_1_8
40
- targetCompatibility JavaVersion.VERSION_1_8
39
+ sourceCompatibility JavaVersion.VERSION_11
40
+ targetCompatibility JavaVersion.VERSION_11
41
41
  }
42
42
  }
43
43
 
44
44
  repositories {
45
45
  google()
46
- jcenter()
47
46
  mavenCentral()
48
47
  }
49
48
 
@@ -6,6 +6,7 @@ import android.content.pm.PackageInfo;
6
6
  import android.net.Uri;
7
7
  import android.os.Build;
8
8
  import androidx.activity.OnBackPressedCallback;
9
+ import androidx.core.content.pm.PackageInfoCompat;
9
10
  import com.getcapacitor.JSObject;
10
11
  import com.getcapacitor.Logger;
11
12
  import com.getcapacitor.Plugin;
@@ -61,6 +62,7 @@ public class AppPlugin extends Plugin {
61
62
  @PluginMethod
62
63
  public void exitApp(PluginCall call) {
63
64
  unsetAppListeners();
65
+ call.resolve();
64
66
  getBridge().getActivity().finish();
65
67
  }
66
68
 
@@ -74,11 +76,7 @@ public class AppPlugin extends Plugin {
74
76
  String appName = stringId == 0 ? applicationInfo.nonLocalizedLabel.toString() : getContext().getString(stringId);
75
77
  data.put("name", appName);
76
78
  data.put("id", pinfo.packageName);
77
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
78
- data.put("build", Long.toString(pinfo.getLongVersionCode()));
79
- } else {
80
- data.put("build", Integer.toString(pinfo.versionCode));
81
- }
79
+ data.put("build", Integer.toString((int) PackageInfoCompat.getLongVersionCode(pinfo)));
82
80
  data.put("version", pinfo.versionName);
83
81
  call.resolve(data);
84
82
  } catch (Exception ex) {
@@ -105,6 +103,15 @@ public class AppPlugin extends Plugin {
105
103
  call.resolve(data);
106
104
  }
107
105
 
106
+ @PluginMethod
107
+ public void minimizeApp(PluginCall call) {
108
+ Intent startMain = new Intent(Intent.ACTION_MAIN);
109
+ startMain.addCategory(Intent.CATEGORY_HOME);
110
+ startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
111
+ getActivity().startActivity(startMain);
112
+ call.resolve();
113
+ }
114
+
108
115
  /**
109
116
  * Handle ACTION_VIEW intents to store a URL that was used to open the app
110
117
  * @param intent
@@ -127,7 +127,7 @@ export interface AppPlugin {
127
127
  *
128
128
  * @since 1.0.0
129
129
  */
130
- exitApp(): never;
130
+ exitApp(): Promise<void>;
131
131
  /**
132
132
  * Return information about the app.
133
133
  *
@@ -146,6 +146,14 @@ export interface AppPlugin {
146
146
  * @since 1.0.0
147
147
  */
148
148
  getLaunchUrl(): Promise<AppLaunchUrl | undefined>;
149
+ /**
150
+ * Minimizes the application.
151
+ *
152
+ * Only available for Android.
153
+ *
154
+ * @since 1.1.0
155
+ */
156
+ minimizeApp(): Promise<void>;
149
157
  /**
150
158
  * Listen for changes in the App's active state (whether the app is in the foreground or background)
151
159
  *
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface AppInfo {\n /**\n * The name of the app.\n *\n * @since 1.0.0\n */\n name: string;\n\n /**\n * The identifier of the app.\n * On iOS it's the Bundle Identifier.\n * On Android it's the Application ID\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The build version.\n * On iOS it's the CFBundleVersion.\n * On Android it's the versionCode.\n *\n * @since 1.0.0\n */\n build: string;\n\n /**\n * The app version.\n * On iOS it's the CFBundleShortVersionString.\n * On Android it's package's versionName.\n *\n * @since 1.0.0\n */\n version: string;\n}\n\nexport interface AppState {\n /**\n * Whether the app is active or not.\n *\n * @since 1.0.0\n */\n isActive: boolean;\n}\n\nexport interface URLOpenListenerEvent {\n /**\n * The URL the app was opened with.\n *\n * @since 1.0.0\n */\n url: string;\n\n /**\n * The source application opening the app (iOS only)\n * https://developer.apple.com/documentation/uikit/uiapplicationopenurloptionskey/1623128-sourceapplication\n *\n * @since 1.0.0\n */\n iosSourceApplication?: any;\n /**\n * Whether the app should open the passed document in-place\n * or must copy it first.\n * https://developer.apple.com/documentation/uikit/uiapplicationopenurloptionskey/1623123-openinplace\n *\n * @since 1.0.0\n */\n iosOpenInPlace?: boolean;\n}\n\nexport interface AppLaunchUrl {\n /**\n * The url used to open the app.\n *\n * @since 1.0.0\n */\n url: string;\n}\n\nexport interface RestoredListenerEvent {\n /**\n * The pluginId this result corresponds to. For example, `Camera`.\n *\n * @since 1.0.0\n */\n pluginId: string;\n /**\n * The methodName this result corresponds to. For example, `getPhoto`\n *\n * @since 1.0.0\n */\n methodName: string;\n /**\n * The result data passed from the plugin. This would be the result you'd\n * expect from normally calling the plugin method. For example, `CameraPhoto`\n *\n * @since 1.0.0\n */\n data?: any;\n /**\n * Boolean indicating if the plugin call succeeded.\n *\n * @since 1.0.0\n */\n success: boolean;\n /**\n * If the plugin call didn't succeed, it will contain the error message.\n *\n * @since 1.0.0\n */\n error?: {\n message: string;\n };\n}\n\nexport interface BackButtonListenerEvent {\n /**\n * Indicates whether the browser can go back in history.\n * False when the history stack is on the first entry.\n *\n * @since 1.0.0\n */\n canGoBack: boolean;\n}\n\nexport type StateChangeListener = (state: AppState) => void;\nexport type URLOpenListener = (event: URLOpenListenerEvent) => void;\nexport type RestoredListener = (event: RestoredListenerEvent) => void;\nexport type BackButtonListener = (event: BackButtonListenerEvent) => void;\n\nexport interface AppPlugin {\n /**\n * Force exit the app. This should only be used in conjunction with the `backButton` handler for Android to\n * exit the app when navigation is complete.\n *\n * Ionic handles this itself so you shouldn't need to call this if using Ionic.\n *\n * @since 1.0.0\n */\n exitApp(): Promise<void>;\n\n /**\n * Return information about the app.\n *\n * @since 1.0.0\n */\n getInfo(): Promise<AppInfo>;\n\n /**\n * Gets the current app state.\n *\n * @since 1.0.0\n */\n getState(): Promise<AppState>;\n\n /**\n * Get the URL the app was launched with, if any.\n *\n * @since 1.0.0\n */\n getLaunchUrl(): Promise<AppLaunchUrl | undefined>;\n\n /**\n * Minimizes the application.\n *\n * Only available for Android.\n *\n * @since 1.1.0\n */\n minimizeApp(): Promise<void>;\n\n /**\n * Listen for changes in the App's active state (whether the app is in the foreground or background)\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'appStateChange',\n listenerFunc: StateChangeListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Listen for url open events for the app. This handles both custom URL scheme links as well\n * as URLs your app handles (Universal Links on iOS and App Links on Android)\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'appUrlOpen',\n listenerFunc: URLOpenListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * If the app was launched with previously persisted plugin call data, such as on Android\n * when an activity returns to an app that was closed, this call will return any data\n * the app was launched with, converted into the form of a result from a plugin call.\n *\n * On Android, due to memory constraints on low-end devices, it's possible\n * that, if your app launches a new activity, your app will be terminated by\n * the operating system in order to reduce memory consumption.\n *\n * For example, that means the Camera API, which launches a new Activity to\n * take a photo, may not be able to return data back to your app.\n *\n * To avoid this, Capacitor stores all restored activity results on launch.\n * You should add a listener for `appRestoredResult` in order to handle any\n * plugin call results that were delivered when your app was not running.\n *\n * Once you have that result (if any), you can update the UI to restore a\n * logical experience for the user, such as navigating or selecting the\n * proper tab.\n *\n * We recommend every Android app using plugins that rely on external\n * Activities (for example, Camera) to have this event and process handled.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'appRestoredResult',\n listenerFunc: RestoredListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Listen for the hardware back button event (Android only). Listening for this event will disable the\n * default back button behaviour, so you might want to call `window.history.back()` manually.\n * If you want to close the app, call `App.exitApp()`.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'backButton',\n listenerFunc: BackButtonListener,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Remove all native listeners for this plugin\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * @deprecated Use `RestoredListenerEvent`.\n * @since 1.0.0\n */\nexport type AppRestoredResult = RestoredListenerEvent;\n\n/**\n * @deprecated Use `URLOpenListenerEvent`.\n * @since 1.0.0\n */\nexport type AppUrlOpen = URLOpenListenerEvent;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,GAAG,GAAG,cAAc,CAAY,KAAK,EAAE;IAC3C,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;CACrD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,GAAG,GAAG,cAAc,CAAY,KAAK,EAAE;IAC3C,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;CACrD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { AppPlugin } from './definitions';\n\nconst App = registerPlugin<AppPlugin>('App', {\n web: () => import('./web').then(m => new m.AppWeb()),\n});\n\nexport * from './definitions';\nexport { App };\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -2,9 +2,10 @@ import { WebPlugin } from '@capacitor/core';
2
2
  import type { AppInfo, AppPlugin, AppLaunchUrl, AppState } from './definitions';
3
3
  export declare class AppWeb extends WebPlugin implements AppPlugin {
4
4
  constructor();
5
- exitApp(): never;
5
+ exitApp(): Promise<void>;
6
6
  getInfo(): Promise<AppInfo>;
7
7
  getLaunchUrl(): Promise<AppLaunchUrl>;
8
8
  getState(): Promise<AppState>;
9
+ minimizeApp(): Promise<void>;
9
10
  private handleVisibilityChange;
10
11
  }
package/dist/esm/web.js CHANGED
@@ -22,5 +22,8 @@ export class AppWeb extends WebPlugin {
22
22
  async getState() {
23
23
  return { isActive: document.hidden !== true };
24
24
  }
25
+ async minimizeApp() {
26
+ throw this.unimplemented('Not implemented on web.');
27
+ }
25
28
  }
26
29
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC;QACE,KAAK,EAAE,CAAC;QAwBF,2BAAsB,GAAG,GAAG,EAAE;YACpC,MAAM,IAAI,GAAG;gBACX,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI;aACnC,CAAC;YAEF,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;QA7BA,QAAQ,CAAC,gBAAgB,CACvB,kBAAkB,EAClB,IAAI,CAAC,sBAAsB,EAC3B,KAAK,CACN,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;IAChD,CAAC;CASF"}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC;QACE,KAAK,EAAE,CAAC;QA4BF,2BAAsB,GAAG,GAAG,EAAE;YACpC,MAAM,IAAI,GAAG;gBACX,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI;aACnC,CAAC;YAEF,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;QAjCA,QAAQ,CAAC,gBAAgB,CACvB,kBAAkB,EAClB,IAAI,CAAC,sBAAsB,EAC3B,KAAK,CACN,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CASF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AppInfo, AppPlugin, AppLaunchUrl, AppState } from './definitions';\n\nexport class AppWeb extends WebPlugin implements AppPlugin {\n constructor() {\n super();\n document.addEventListener(\n 'visibilitychange',\n this.handleVisibilityChange,\n false,\n );\n }\n\n exitApp(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getInfo(): Promise<AppInfo> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getLaunchUrl(): Promise<AppLaunchUrl> {\n return { url: '' };\n }\n\n async getState(): Promise<AppState> {\n return { isActive: document.hidden !== true };\n }\n\n async minimizeApp(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n private handleVisibilityChange = () => {\n const data = {\n isActive: document.hidden !== true,\n };\n\n this.notifyListeners('appStateChange', data);\n };\n}\n"]}
@@ -31,6 +31,9 @@ class AppWeb extends core.WebPlugin {
31
31
  async getState() {
32
32
  return { isActive: document.hidden !== true };
33
33
  }
34
+ async minimizeApp() {
35
+ throw this.unimplemented('Not implemented on web.');
36
+ }
34
37
  }
35
38
 
36
39
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst App = registerPlugin('App', {\n web: () => import('./web').then(m => new m.AppWeb()),\n});\nexport * from './definitions';\nexport { App };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AppWeb extends WebPlugin {\n constructor() {\n super();\n this.handleVisibilityChange = () => {\n const data = {\n isActive: document.hidden !== true,\n };\n this.notifyListeners('appStateChange', data);\n };\n document.addEventListener('visibilitychange', this.handleVisibilityChange, false);\n }\n exitApp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getLaunchUrl() {\n return { url: '' };\n }\n async getState() {\n return { isActive: document.hidden !== true };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACxD,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE,CAAC;AAChB,QAAQ,IAAI,CAAC,sBAAsB,GAAG,MAAM;AAC5C,YAAY,MAAM,IAAI,GAAG;AACzB,gBAAgB,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI;AAClD,aAAa,CAAC;AACd,YAAY,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACzD,SAAS,CAAC;AACV,QAAQ,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;AAC1F,KAAK;AACL,IAAI,OAAO,GAAG;AACd,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAC3B,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;AACtD,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst App = registerPlugin('App', {\n web: () => import('./web').then(m => new m.AppWeb()),\n});\nexport * from './definitions';\nexport { App };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AppWeb extends WebPlugin {\n constructor() {\n super();\n this.handleVisibilityChange = () => {\n const data = {\n isActive: document.hidden !== true,\n };\n this.notifyListeners('appStateChange', data);\n };\n document.addEventListener('visibilitychange', this.handleVisibilityChange, false);\n }\n exitApp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getLaunchUrl() {\n return { url: '' };\n }\n async getState() {\n return { isActive: document.hidden !== true };\n }\n async minimizeApp() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACxD,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE,CAAC;AAChB,QAAQ,IAAI,CAAC,sBAAsB,GAAG,MAAM;AAC5C,YAAY,MAAM,IAAI,GAAG;AACzB,gBAAgB,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI;AAClD,aAAa,CAAC;AACd,YAAY,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACzD,SAAS,CAAC;AACV,QAAQ,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;AAC1F,KAAK;AACL,IAAI,OAAO,GAAG;AACd,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAC3B,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;AACtD,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -28,6 +28,9 @@ var capacitorApp = (function (exports, core) {
28
28
  async getState() {
29
29
  return { isActive: document.hidden !== true };
30
30
  }
31
+ async minimizeApp() {
32
+ throw this.unimplemented('Not implemented on web.');
33
+ }
31
34
  }
32
35
 
33
36
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst App = registerPlugin('App', {\n web: () => import('./web').then(m => new m.AppWeb()),\n});\nexport * from './definitions';\nexport { App };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AppWeb extends WebPlugin {\n constructor() {\n super();\n this.handleVisibilityChange = () => {\n const data = {\n isActive: document.hidden !== true,\n };\n this.notifyListeners('appStateChange', data);\n };\n document.addEventListener('visibilitychange', this.handleVisibilityChange, false);\n }\n exitApp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getLaunchUrl() {\n return { url: '' };\n }\n async getState() {\n return { isActive: document.hidden !== true };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACxD,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE,CAAC;IAChB,QAAQ,IAAI,CAAC,sBAAsB,GAAG,MAAM;IAC5C,YAAY,MAAM,IAAI,GAAG;IACzB,gBAAgB,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI;IAClD,aAAa,CAAC;IACd,YAAY,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACzD,SAAS,CAAC;IACV,QAAQ,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;IAC1F,KAAK;IACL,IAAI,OAAO,GAAG;IACd,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAC3B,KAAK;IACL,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;IACtD,KAAK;IACL;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst App = registerPlugin('App', {\n web: () => import('./web').then(m => new m.AppWeb()),\n});\nexport * from './definitions';\nexport { App };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AppWeb extends WebPlugin {\n constructor() {\n super();\n this.handleVisibilityChange = () => {\n const data = {\n isActive: document.hidden !== true,\n };\n this.notifyListeners('appStateChange', data);\n };\n document.addEventListener('visibilitychange', this.handleVisibilityChange, false);\n }\n exitApp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getLaunchUrl() {\n return { url: '' };\n }\n async getState() {\n return { isActive: document.hidden !== true };\n }\n async minimizeApp() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACxD,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE,CAAC;IAChB,QAAQ,IAAI,CAAC,sBAAsB,GAAG,MAAM;IAC5C,YAAY,MAAM,IAAI,GAAG;IACzB,gBAAgB,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI;IAClD,aAAa,CAAC;IACd,YAAY,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACzD,SAAS,CAAC;IACV,QAAQ,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;IAC1F,KAAK;IACL,IAAI,OAAO,GAAG;IACd,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAC3B,KAAK;IACL,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;IACtD,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL;;;;;;;;;;;;;;;;;"}
@@ -4,9 +4,10 @@
4
4
  // Define the plugin using the CAP_PLUGIN Macro, and
5
5
  // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
6
  CAP_PLUGIN(AppPlugin, "App",
7
- CAP_PLUGIN_METHOD(exitApp, CAPPluginReturnNone);
7
+ CAP_PLUGIN_METHOD(exitApp, CAPPluginReturnPromise);
8
8
  CAP_PLUGIN_METHOD(getInfo, CAPPluginReturnPromise);
9
9
  CAP_PLUGIN_METHOD(getLaunchUrl, CAPPluginReturnPromise);
10
10
  CAP_PLUGIN_METHOD(getState, CAPPluginReturnPromise);
11
- CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnNone);
11
+ CAP_PLUGIN_METHOD(minimizeApp, CAPPluginReturnPromise);
12
+ CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnPromise);
12
13
  )
@@ -92,4 +92,8 @@ public class AppPlugin: CAPPlugin {
92
92
  ])
93
93
  }
94
94
  }
95
+
96
+ @objc func minimizeApp(_ call: CAPPluginCall) {
97
+ call.unimplemented()
98
+ }
95
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/app",
3
- "version": "1.0.7",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "The App API handles high level App state and events.For example, this API emits events when the app enters and leaves the foreground, handles deeplinks, opens other apps, and manages persisted plugin state.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
32
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
33
33
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
34
  "verify:web": "npm run build",
35
35
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -45,10 +45,10 @@
45
45
  "publish:cocoapod": "pod trunk push ./CapacitorApp.podspec --allow-warnings"
46
46
  },
47
47
  "devDependencies": {
48
- "@capacitor/android": "^3.0.0",
49
- "@capacitor/core": "^3.0.0",
48
+ "@capacitor/android": "next",
49
+ "@capacitor/core": "next",
50
50
  "@capacitor/docgen": "0.0.18",
51
- "@capacitor/ios": "^3.0.0",
51
+ "@capacitor/ios": "next",
52
52
  "@ionic/eslint-config": "^0.3.0",
53
53
  "@ionic/prettier-config": "~1.0.1",
54
54
  "@ionic/swiftlint-config": "^1.1.2",
@@ -61,7 +61,7 @@
61
61
  "typescript": "~4.1.5"
62
62
  },
63
63
  "peerDependencies": {
64
- "@capacitor/core": "^3.0.0"
64
+ "@capacitor/core": "next"
65
65
  },
66
66
  "prettier": "@ionic/prettier-config",
67
67
  "swiftlint": "@ionic/swiftlint-config",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "d378c00d51b1c9fb978772906448fa0ec9cb81d0"
82
+ "gitHead": "fd7db8285f72990522da0adc889514c9804b6dae"
83
83
  }