@capacitor/app
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.3.3](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/app@0.3.2...@capacitor/app@0.3.3) (2021-02-10) | ||
**Note:** Version bump only for package @capacitor/app | ||
## [0.3.2](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/app@0.3.1...@capacitor/app@0.3.2) (2021-02-05) | ||
@@ -8,0 +16,0 @@ |
@@ -145,3 +145,3 @@ import type { PluginListenerHandle } from '@capacitor/core'; | ||
*/ | ||
addListener(eventName: 'appStateChange', listenerFunc: StateChangeListener): PluginListenerHandle; | ||
addListener(eventName: 'appStateChange', listenerFunc: StateChangeListener): Promise<PluginListenerHandle> & PluginListenerHandle; | ||
/** | ||
@@ -153,3 +153,3 @@ * Listen for url open events for the app. This handles both custom URL scheme links as well | ||
*/ | ||
addListener(eventName: 'appUrlOpen', listenerFunc: URLOpenListener): PluginListenerHandle; | ||
addListener(eventName: 'appUrlOpen', listenerFunc: URLOpenListener): Promise<PluginListenerHandle> & PluginListenerHandle; | ||
/** | ||
@@ -180,3 +180,3 @@ * If the app was launched with previously persisted plugin call data, such as on Android | ||
*/ | ||
addListener(eventName: 'appRestoredResult', listenerFunc: RestoredListener): PluginListenerHandle; | ||
addListener(eventName: 'appRestoredResult', listenerFunc: RestoredListener): Promise<PluginListenerHandle> & PluginListenerHandle; | ||
/** | ||
@@ -189,3 +189,3 @@ * Listen for the hardware back button event (Android only). Listening for this event will disable the | ||
*/ | ||
addListener(eventName: 'backButton', listenerFunc: BackButtonListener): PluginListenerHandle; | ||
addListener(eventName: 'backButton', listenerFunc: BackButtonListener): Promise<PluginListenerHandle> & PluginListenerHandle; | ||
/** | ||
@@ -196,3 +196,3 @@ * Remove all native listeners for this plugin | ||
*/ | ||
removeAllListeners(): void; | ||
removeAllListeners(): Promise<void>; | ||
} | ||
@@ -199,0 +199,0 @@ /** |
@@ -9,3 +9,3 @@ import { WebPlugin } from '@capacitor/core'; | ||
getState(): Promise<AppState>; | ||
handleVisibilityChange(): void; | ||
private handleVisibilityChange; | ||
} |
@@ -5,5 +5,9 @@ import { WebPlugin } from '@capacitor/core'; | ||
super(); | ||
if (typeof document !== 'undefined') { | ||
document.addEventListener('visibilitychange', this.handleVisibilityChange.bind(this), false); | ||
} | ||
this.handleVisibilityChange = () => { | ||
const data = { | ||
isActive: document.hidden !== true, | ||
}; | ||
this.notifyListeners('appStateChange', data); | ||
}; | ||
document.addEventListener('visibilitychange', this.handleVisibilityChange, false); | ||
} | ||
@@ -22,9 +26,3 @@ exitApp() { | ||
} | ||
handleVisibilityChange() { | ||
const data = { | ||
isActive: document.hidden !== true, | ||
}; | ||
this.notifyListeners('appStateChange', data); | ||
} | ||
} | ||
//# sourceMappingURL=web.js.map |
@@ -14,5 +14,9 @@ 'use strict'; | ||
super(); | ||
if (typeof document !== 'undefined') { | ||
document.addEventListener('visibilitychange', this.handleVisibilityChange.bind(this), false); | ||
} | ||
this.handleVisibilityChange = () => { | ||
const data = { | ||
isActive: document.hidden !== true, | ||
}; | ||
this.notifyListeners('appStateChange', data); | ||
}; | ||
document.addEventListener('visibilitychange', this.handleVisibilityChange, false); | ||
} | ||
@@ -31,8 +35,2 @@ exitApp() { | ||
} | ||
handleVisibilityChange() { | ||
const data = { | ||
isActive: document.hidden !== true, | ||
}; | ||
this.notifyListeners('appStateChange', data); | ||
} | ||
} | ||
@@ -39,0 +37,0 @@ |
@@ -11,5 +11,9 @@ var capacitorApp = (function (exports, core) { | ||
super(); | ||
if (typeof document !== 'undefined') { | ||
document.addEventListener('visibilitychange', this.handleVisibilityChange.bind(this), false); | ||
} | ||
this.handleVisibilityChange = () => { | ||
const data = { | ||
isActive: document.hidden !== true, | ||
}; | ||
this.notifyListeners('appStateChange', data); | ||
}; | ||
document.addEventListener('visibilitychange', this.handleVisibilityChange, false); | ||
} | ||
@@ -28,8 +32,2 @@ exitApp() { | ||
} | ||
handleVisibilityChange() { | ||
const data = { | ||
isActive: document.hidden !== true, | ||
}; | ||
this.notifyListeners('appStateChange', data); | ||
} | ||
} | ||
@@ -36,0 +34,0 @@ |
{ | ||
"name": "@capacitor/app", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"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.", | ||
@@ -47,6 +47,6 @@ "main": "dist/plugin.cjs.js", | ||
"devDependencies": { | ||
"@capacitor/android": "^3.0.0-beta.1", | ||
"@capacitor/core": "^3.0.0-beta.1", | ||
"@capacitor/android": "^3.0.0-beta.2", | ||
"@capacitor/core": "^3.0.0-beta.2", | ||
"@capacitor/docgen": "0.0.15", | ||
"@capacitor/ios": "^3.0.0-beta.1", | ||
"@capacitor/ios": "^3.0.0-beta.2", | ||
"@ionic/eslint-config": "^0.3.0", | ||
@@ -64,3 +64,3 @@ "@ionic/prettier-config": "~1.0.1", | ||
"peerDependencies": { | ||
"@capacitor/core": "^3.0.0-beta.1" | ||
"@capacitor/core": "^3.0.0-beta.2" | ||
}, | ||
@@ -83,3 +83,3 @@ "prettier": "@ionic/prettier-config", | ||
}, | ||
"gitHead": "e10d9dc09f6189f1547a82b8ae29759749fc1f8d" | ||
"gitHead": "91779a842eb14903c48c5309b899cd059115b55f" | ||
} |
# @capacitor/app | ||
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. | ||
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. | ||
@@ -12,2 +12,36 @@ ## Install | ||
## iOS | ||
For being able to open the app from a custom scheme you need to register the scheme first. You can do it by editing the [`Info.plist`](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) file and adding this lines. | ||
```xml | ||
<key>CFBundleURLTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleURLName</key> | ||
<string>com.getcapacitor.capacitor</string> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>mycustomscheme</string> | ||
</array> | ||
</dict> | ||
</array> | ||
``` | ||
## Android | ||
For being able to open the app from a custom scheme you need to register the scheme first. You can do it by adding this lines inside the `activity` section of the `AndroidManifest.xml`. | ||
```xml | ||
<intent-filter> | ||
<action android:name="android.intent.action.VIEW" /> | ||
<category android:name="android.intent.category.DEFAULT" /> | ||
<category android:name="android.intent.category.BROWSABLE" /> | ||
<data android:scheme="@string/custom_url_scheme" /> | ||
</intent-filter> | ||
``` | ||
`custom_url_scheme` value is stored in `strings.xml`. When the Android platform is added, `@capacitor/cli` adds the app's package name as default value, but can be replaced by editing the `strings.xml` file. | ||
## Example | ||
@@ -124,3 +158,3 @@ | ||
```typescript | ||
addListener(eventName: 'appStateChange', listenerFunc: StateChangeListener) => PluginListenerHandle | ||
addListener(eventName: 'appStateChange', listenerFunc: StateChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle | ||
``` | ||
@@ -135,3 +169,3 @@ | ||
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
@@ -146,3 +180,3 @@ **Since:** 1.0.0 | ||
```typescript | ||
addListener(eventName: 'appUrlOpen', listenerFunc: URLOpenListener) => PluginListenerHandle | ||
addListener(eventName: 'appUrlOpen', listenerFunc: URLOpenListener) => Promise<PluginListenerHandle> & PluginListenerHandle | ||
``` | ||
@@ -158,3 +192,3 @@ | ||
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
@@ -169,3 +203,3 @@ **Since:** 1.0.0 | ||
```typescript | ||
addListener(eventName: 'appRestoredResult', listenerFunc: RestoredListener) => PluginListenerHandle | ||
addListener(eventName: 'appRestoredResult', listenerFunc: RestoredListener) => Promise<PluginListenerHandle> & PluginListenerHandle | ||
``` | ||
@@ -200,3 +234,3 @@ | ||
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
@@ -211,3 +245,3 @@ **Since:** 1.0.0 | ||
```typescript | ||
addListener(eventName: 'backButton', listenerFunc: BackButtonListener) => PluginListenerHandle | ||
addListener(eventName: 'backButton', listenerFunc: BackButtonListener) => Promise<PluginListenerHandle> & PluginListenerHandle | ||
``` | ||
@@ -224,3 +258,3 @@ | ||
**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code> | ||
@@ -235,3 +269,3 @@ **Since:** 1.0.0 | ||
```typescript | ||
removeAllListeners() => void | ||
removeAllListeners() => Promise<void> | ||
``` | ||
@@ -275,5 +309,5 @@ | ||
| Prop | Type | | ||
| ------------ | -------------------------- | | ||
| **`remove`** | <code>() => void</code> | | ||
| Prop | Type | | ||
| ------------ | ----------------------------------------- | | ||
| **`remove`** | <code>() => Promise<void></code> | | ||
@@ -280,0 +314,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
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
47914
347
323