@supernotes/capacitor-app-actions
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -10,3 +10,3 @@ { | ||
"name": "set", | ||
"signature": "(options: AddAppActionOptions) => any", | ||
"signature": "(options: AddAppActionOptions) => Promise<void>", | ||
"parameters": [ | ||
@@ -19,3 +19,3 @@ { | ||
], | ||
"returns": "any", | ||
"returns": "Promise<void>", | ||
"tags": [], | ||
@@ -27,35 +27,2 @@ "docs": "Set app actions for the app. Overrides any existing app actions.", | ||
"slug": "set" | ||
}, | ||
{ | ||
"name": "addListener", | ||
"signature": "(actionId: string, listener: (info: any) => void) => Promise<PluginListenerHandle> & PluginListenerHandle", | ||
"parameters": [ | ||
{ | ||
"name": "actionId", | ||
"docs": "", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "listener", | ||
"docs": "", | ||
"type": "(info: any) => void" | ||
} | ||
], | ||
"returns": "any", | ||
"tags": [], | ||
"docs": "Listen for when an app action has been clicked by the user. actionId should match existing app actions.", | ||
"complexTypes": [ | ||
"PluginListenerHandle" | ||
], | ||
"slug": "addlistener" | ||
}, | ||
{ | ||
"name": "removeAllListeners", | ||
"signature": "() => any", | ||
"parameters": [], | ||
"returns": "any", | ||
"tags": [], | ||
"docs": "Remove all listeners for this plugin.", | ||
"complexTypes": [], | ||
"slug": "removealllisteners" | ||
} | ||
@@ -120,18 +87,2 @@ ], | ||
] | ||
}, | ||
{ | ||
"name": "PluginListenerHandle", | ||
"slug": "pluginlistenerhandle", | ||
"docs": "", | ||
"tags": [], | ||
"methods": [], | ||
"properties": [ | ||
{ | ||
"name": "remove", | ||
"tags": [], | ||
"docs": "", | ||
"complexTypes": [], | ||
"type": "() => any" | ||
} | ||
] | ||
} | ||
@@ -138,0 +89,0 @@ ], |
@@ -1,7 +0,19 @@ | ||
import { PluginListenerHandle } from '@capacitor/core'; | ||
import { AppAction } from './app-action'; | ||
import type { Plugin } from '@capacitor/core'; | ||
export interface AppAction { | ||
/** | ||
* Unique identifier across all app actions. | ||
*/ | ||
id: string; | ||
title: string; | ||
subtitle?: string; | ||
/** | ||
* iOS: icon name for the system icon e.g. "star.fill" | ||
* Android: icon name for the system icon e.g. "ic_menu_search" | ||
*/ | ||
icon?: string; | ||
} | ||
export interface AddAppActionOptions { | ||
actions: AppAction[]; | ||
} | ||
export interface AppActionsPlugin { | ||
export interface AppActionsPlugin extends Plugin { | ||
/** | ||
@@ -11,10 +23,2 @@ * Set app actions for the app. Overrides any existing app actions. | ||
set(options: AddAppActionOptions): Promise<void>; | ||
/** | ||
* Listen for when an app action has been clicked by the user. actionId should match existing app actions. | ||
*/ | ||
addListener(actionId: string, listener: (info: any) => void): Promise<PluginListenerHandle> & PluginListenerHandle; | ||
/** | ||
* Remove all listeners for this plugin. | ||
*/ | ||
removeAllListeners(): Promise<void>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { PluginListenerHandle, WebPlugin } from '@capacitor/core'; | ||
import { type PluginListenerHandle, WebPlugin } from '@capacitor/core'; | ||
import type { AddAppActionOptions, AppActionsPlugin } from './definitions'; | ||
@@ -3,0 +3,0 @@ export declare class AppActionsWeb extends WebPlugin implements AppActionsPlugin { |
{ | ||
"name": "@supernotes/capacitor-app-actions", | ||
"version": "6.0.1", | ||
"description": "iOS and Android Capacitor plugin for App Actions", | ||
"version": "6.0.2", | ||
"description": "Capacitor plugin for App Actions on iOS and Android", | ||
"main": "dist/plugin.cjs.js", | ||
@@ -45,3 +45,2 @@ "module": "dist/esm/index.js", | ||
"prepublishOnly": "npm run build", | ||
"publish": "npm publish --access public", | ||
"contributors:add": "all-contributors add", | ||
@@ -55,8 +54,8 @@ "contributors:generate": "all-contributors generate" | ||
"@capacitor/ios": "^6.0.0", | ||
"@ionic/eslint-config": "^0.3.0", | ||
"@ionic/prettier-config": "^1.0.1", | ||
"@ionic/eslint-config": "^0.4.0", | ||
"@ionic/prettier-config": "^4.0.0", | ||
"@ionic/swiftlint-config": "^1.1.2", | ||
"all-contributors-cli": "^6.20.0", | ||
"eslint": "^7.11.0", | ||
"prettier": "~2.2.0", | ||
"eslint": "^8.57.0", | ||
"prettier": "^3.3.3", | ||
"prettier-plugin-java": "~1.0.0", | ||
@@ -66,3 +65,3 @@ "rimraf": "^3.0.2", | ||
"swiftlint": "^1.0.1", | ||
"typescript": "~4.0.3" | ||
"typescript": "^5.6.2" | ||
}, | ||
@@ -77,2 +76,5 @@ "peerDependencies": { | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"capacitor": { | ||
@@ -79,0 +81,0 @@ "ios": { |
@@ -30,7 +30,7 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> | ||
Android: | ||
### Android | ||
No additional configuration required. | ||
iOS: | ||
### iOS | ||
@@ -52,16 +52,19 @@ Add the following to `AppDelegate.swift`. This snippet allows the plugin to recognize when an app action has been selected so that you can respond to those events. | ||
``` | ||
```js | ||
import { AppActions } from 'capacitor-app-actions' | ||
await Capacitor.Plugins.AppActions.set({ "actions": [ | ||
{ id: "order", title: "Order", subtitle: "Place an Order", icon: "star.fill" }, | ||
{ id: "locations", title: "Find location", subtitle: "Find nearby location", icon: "star.fill"} | ||
]}); | ||
{ id: "order", title: "Order", subtitle: "Place an Order", icon: "star.fill" }, | ||
{ id: "locations", title: "Find location", subtitle: "Find nearby location", icon: "star.fill"} | ||
]}); | ||
``` | ||
Listen to an event triggered by an existing app action: | ||
``` | ||
```js | ||
AppActions.addListener("order", (info) => { | ||
// Do your in app work. Navigate to the appropriate page or trigger other in app actions. | ||
}); | ||
// Do your in app work. Navigate to the appropriate page or trigger other in app actions. | ||
}); | ||
// clean up listeners when you are done | ||
AppActions.removeAllListeners() | ||
``` | ||
@@ -68,0 +71,0 @@ ## Contributors ✨ |
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
89
26731
29
177