@capacitor/app
Advanced tools
Comparing version 4.0.2-nightly-d0ea188.0 to 4.1.0
@@ -6,2 +6,44 @@ # Change Log | ||
# [4.1.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/app@1.1.1...@capacitor/app@4.1.0) (2022-10-21) | ||
### Features | ||
* **app:** Add pause and resume event listeners ([#1220](https://github.com/ionic-team/capacitor-plugins/issues/1220)) ([7e93c88](https://github.com/ionic-team/capacitor-plugins/commit/7e93c888a3e3daae95c2f465941a4097484adae8)) | ||
## 4.0.1 (2022-07-28) | ||
# 4.0.0 (2022-07-27) | ||
# 4.0.0-beta.2 (2022-07-08) | ||
# 4.0.0-beta.0 (2022-06-27) | ||
### Bug Fixes | ||
* 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)) | ||
* **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)) | ||
### Features | ||
* 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)) | ||
* Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0)) | ||
* **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)) | ||
* 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)) | ||
* 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)) | ||
## [4.0.1](https://github.com/ionic-team/capacitor-plugins/compare/4.0.0...4.0.1) (2022-07-28) | ||
@@ -8,0 +50,0 @@ |
@@ -158,4 +158,9 @@ import type { PluginListenerHandle } from '@capacitor/core'; | ||
/** | ||
* Listen for changes in the App's active state (whether the app is in the foreground or background) | ||
* Listen for changes in the app or the activity states. | ||
* | ||
* On iOS it's fired when the native [UIApplication.willResignActiveNotification](https://developer.apple.com/documentation/uikit/uiapplication/1622973-willresignactivenotification) and | ||
* [UIApplication.didBecomeActiveNotification](https://developer.apple.com/documentation/uikit/uiapplication/1622953-didbecomeactivenotification) events get fired. | ||
* On Android it's fired when the Capacitor's Activity [onResume](https://developer.android.com/reference/android/app/Activity#onResume()) and [onStop](https://developer.android.com/reference/android/app/Activity#onStop()) methods gets called. | ||
* On Web it's fired when the document's visibilitychange gets fired. | ||
* | ||
* @since 1.0.0 | ||
@@ -165,2 +170,23 @@ */ | ||
/** | ||
* Listen for when the app or the activity are paused. | ||
* | ||
* On iOS it's fired when the native [UIApplication.didEnterBackgroundNotification](https://developer.apple.com/documentation/uikit/uiapplication/1623071-didenterbackgroundnotification) event gets fired. | ||
* On Android it's fired when the Capacitor's Activity [onPause](https://developer.android.com/reference/android/app/Activity#onPause()) method gets called. | ||
* On Web it's fired when the document's visibilitychange gets fired and document.hidden is true. | ||
* | ||
* @since 4.1.0 | ||
*/ | ||
addListener(eventName: 'pause', listenerFunc: () => void): Promise<PluginListenerHandle> & PluginListenerHandle; | ||
/** | ||
* Listen for when the app or activity are resumed. | ||
* | ||
* On iOS it's fired when the native [UIApplication.willEnterForegroundNotification](https://developer.apple.com/documentation/uikit/uiapplication/1622944-willenterforegroundnotification) event gets fired. | ||
* On Android it's fired when the Capacitor's Activity [onResume](https://developer.android.com/reference/android/app/Activity#onResume()) method gets called, | ||
* but only after resume has fired first. | ||
* On Web it's fired when the document's visibilitychange gets fired and document.hidden is false. | ||
* | ||
* @since 4.1.0 | ||
*/ | ||
addListener(eventName: 'resume', listenerFunc: () => void): Promise<PluginListenerHandle> & PluginListenerHandle; | ||
/** | ||
* Listen for url open events for the app. This handles both custom URL scheme links as well | ||
@@ -167,0 +193,0 @@ * as URLs your app handles (Universal Links on iOS and App Links on Android) |
@@ -10,2 +10,8 @@ import { WebPlugin } from '@capacitor/core'; | ||
this.notifyListeners('appStateChange', data); | ||
if (document.hidden) { | ||
this.notifyListeners('pause', null); | ||
} | ||
else { | ||
this.notifyListeners('resume', null); | ||
} | ||
}; | ||
@@ -12,0 +18,0 @@ document.addEventListener('visibilitychange', this.handleVisibilityChange, false); |
@@ -19,2 +19,8 @@ 'use strict'; | ||
this.notifyListeners('appStateChange', data); | ||
if (document.hidden) { | ||
this.notifyListeners('pause', null); | ||
} | ||
else { | ||
this.notifyListeners('resume', null); | ||
} | ||
}; | ||
@@ -21,0 +27,0 @@ document.addEventListener('visibilitychange', this.handleVisibilityChange, false); |
@@ -16,2 +16,8 @@ var capacitorApp = (function (exports, core) { | ||
this.notifyListeners('appStateChange', data); | ||
if (document.hidden) { | ||
this.notifyListeners('pause', null); | ||
} | ||
else { | ||
this.notifyListeners('resume', null); | ||
} | ||
}; | ||
@@ -18,0 +24,0 @@ document.addEventListener('visibilitychange', this.handleVisibilityChange, false); |
{ | ||
"name": "@capacitor/app", | ||
"version": "4.0.2-nightly-d0ea188.0", | ||
"version": "4.1.0", | ||
"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.", | ||
@@ -82,3 +82,3 @@ "main": "dist/plugin.cjs.js", | ||
}, | ||
"gitHead": "d0ea188c7f6222a6e07cb6761f6357ccc6409856" | ||
"gitHead": "4d007af1c6a652d9c460da40db409b089759d29c" | ||
} |
@@ -80,2 +80,4 @@ # @capacitor/app | ||
* [`addListener('appStateChange', ...)`](#addlistenerappstatechange) | ||
* [`addListener('pause', ...)`](#addlistenerpause) | ||
* [`addListener('resume', ...)`](#addlistenerresume) | ||
* [`addListener('appUrlOpen', ...)`](#addlistenerappurlopen) | ||
@@ -175,4 +177,9 @@ * [`addListener('appRestoredResult', ...)`](#addlistenerapprestoredresult) | ||
Listen for changes in the App's active state (whether the app is in the foreground or background) | ||
Listen for changes in the app or the activity states. | ||
On iOS it's fired when the native [UIApplication.willResignActiveNotification](https://developer.apple.com/documentation/uikit/uiapplication/1622973-willresignactivenotification) and | ||
[UIApplication.didBecomeActiveNotification](https://developer.apple.com/documentation/uikit/uiapplication/1622953-didbecomeactivenotification) events get fired. | ||
On Android it's fired when the Capacitor's Activity [onResume](https://developer.android.com/reference/android/app/Activity#onResume()) and [onStop](https://developer.android.com/reference/android/app/Activity#onStop()) methods gets called. | ||
On Web it's fired when the document's visibilitychange gets fired. | ||
| Param | Type | | ||
@@ -190,2 +197,51 @@ | ------------------ | ------------------------------------------------------------------- | | ||
### addListener('pause', ...) | ||
```typescript | ||
addListener(eventName: 'pause', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle | ||
``` | ||
Listen for when the app or the activity are paused. | ||
On iOS it's fired when the native [UIApplication.didEnterBackgroundNotification](https://developer.apple.com/documentation/uikit/uiapplication/1623071-didenterbackgroundnotification) event gets fired. | ||
On Android it's fired when the Capacitor's Activity [onPause](https://developer.android.com/reference/android/app/Activity#onPause()) method gets called. | ||
On Web it's fired when the document's visibilitychange gets fired and document.hidden is true. | ||
| Param | Type | | ||
| ------------------ | -------------------------- | | ||
| **`eventName`** | <code>'pause'</code> | | ||
| **`listenerFunc`** | <code>() => void</code> | | ||
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
**Since:** 4.1.0 | ||
-------------------- | ||
### addListener('resume', ...) | ||
```typescript | ||
addListener(eventName: 'resume', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle | ||
``` | ||
Listen for when the app or activity are resumed. | ||
On iOS it's fired when the native [UIApplication.willEnterForegroundNotification](https://developer.apple.com/documentation/uikit/uiapplication/1622944-willenterforegroundnotification) event gets fired. | ||
On Android it's fired when the Capacitor's Activity [onResume](https://developer.android.com/reference/android/app/Activity#onResume()) method gets called, | ||
but only after resume has fired first. | ||
On Web it's fired when the document's visibilitychange gets fired and document.hidden is false. | ||
| Param | Type | | ||
| ------------------ | -------------------------- | | ||
| **`eventName`** | <code>'resume'</code> | | ||
| **`listenerFunc`** | <code>() => void</code> | | ||
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
**Since:** 4.1.0 | ||
-------------------- | ||
### addListener('appUrlOpen', ...) | ||
@@ -192,0 +248,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
80058
394
1
424