Socket
Socket
Sign inDemoInstall

capacitor-android-shortcuts

Package Overview
Dependencies
2
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.1 to 5.0.2

145

dist/docs.json

@@ -29,3 +29,3 @@ {

{
"name": "addDynamic",
"name": "setDynamic",
"signature": "(options: { items: ShortcutItem[]; }) => any",

@@ -46,10 +46,10 @@ "parameters": [

],
"docs": "Created dynamic shortcuts",
"docs": "Set dynamic shortcuts",
"complexTypes": [
"ShortcutItem"
],
"slug": "adddynamic"
"slug": "setdynamic"
},
{
"name": "addPinned",
"name": "pin",
"signature": "(options: ShortcutItem) => any",

@@ -70,11 +70,11 @@ "parameters": [

],
"docs": "Created a pinned shortcut",
"docs": "Add a pinned shortcut",
"complexTypes": [
"ShortcutItem"
],
"slug": "addpinned"
"slug": "pin"
},
{
"name": "addListener",
"signature": "(eventName: 'shortcut', listenerFunc: MessageListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
"signature": "(eventName: 'shortcut', listenerFunc: (response: { data: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle",
"parameters": [

@@ -89,3 +89,3 @@ {

"docs": "",
"type": "MessageListener"
"type": "(response: { data: string; }) => void"
}

@@ -106,6 +106,59 @@ ],

"complexTypes": [
"MessageListener",
"PluginListenerHandle"
],
"slug": "addlistenershortcut"
},
{
"name": "addDynamic",
"signature": "(options: { items: ShortcutItem[]; }) => any",
"parameters": [
{
"name": "options",
"docs": "An items array with the options of each shortcut",
"type": "{ items: {}; }"
}
],
"returns": "any",
"tags": [
{
"name": "param",
"text": "options An items array with the options of each shortcut"
},
{
"name": "deprecated",
"text": "This function will be removed in future releases. Use {@link #setDynamic()} instead."
}
],
"docs": "Set dynamic shortcuts",
"complexTypes": [
"ShortcutItem"
],
"slug": "adddynamic"
},
{
"name": "addPinned",
"signature": "(options: ShortcutItem) => any",
"parameters": [
{
"name": "options",
"docs": "An option object for the pinned shortcut",
"type": "ShortcutItem"
}
],
"returns": "any",
"tags": [
{
"name": "param",
"text": "options An option object for the pinned shortcut"
},
{
"name": "deprecated",
"text": "This function will be removed in future releases. Use {@link #pin()} instead."
}
],
"docs": "Add a pinned shortcut",
"complexTypes": [
"ShortcutItem"
],
"slug": "addpinned"
}

@@ -117,2 +170,48 @@ ],

{
"name": "ShortcutItem",
"slug": "shortcutitem",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "id",
"tags": [],
"docs": "ID of the shortcut",
"complexTypes": [],
"type": "string"
},
{
"name": "shortLabel",
"tags": [],
"docs": "Sets the short title of a shortcut.\r\nThis is a mandatory field when publishing a new shortcut with ShortcutManager.addDynamicShortcuts(List) or ShortcutManager.setDynamicShortcuts(List).\r\nThis field is intended to be a concise description of a shortcut.\r\nThe recommended maximum length is 10 characters.",
"complexTypes": [],
"type": "string"
},
{
"name": "longLabel",
"tags": [],
"docs": "Sets the text of a shortcut.\r\nThis field is intended to be more descriptive than the shortcut title. The launcher shows this instead of the short title when it has enough space.\r\nThe recommend maximum length is 25 characters.",
"complexTypes": [],
"type": "string"
},
{
"name": "icon",
"tags": [],
"docs": "Defines the icon of the shortcut.\r\nYou can set the icon as a BASE64-Bitmap or as a Resource name",
"complexTypes": [
"AvailableIconTypes"
],
"type": "{ type: AvailableIconTypes; name: string; } | undefined"
},
{
"name": "data",
"tags": [],
"docs": "Data that is passed to the 'shortcut' event",
"complexTypes": [],
"type": "string"
}
]
},
{
"name": "PluginListenerHandle",

@@ -137,15 +236,2 @@ "slug": "pluginlistenerhandle",

{
"name": "ShortcutItem",
"slug": "shortcutitem",
"docs": "",
"types": [
{
"text": "{\r\n /**\r\n * ID of the shortcut\r\n */\r\n id: string;\r\n /**\r\n * Sets the short title of a shortcut.\r\n * This is a mandatory field when publishing a new shortcut with ShortcutManager.addDynamicShortcuts(List) or ShortcutManager.setDynamicShortcuts(List).\r\n * This field is intended to be a concise description of a shortcut.\r\n * The recommended maximum length is 10 characters.\r\n */\r\n shortLabel: string;\r\n /**\r\n * Sets the text of a shortcut.\r\n * This field is intended to be more descriptive than the shortcut title. The launcher shows this instead of the short title when it has enough space.\r\n * The recommend maximum length is 25 characters.\r\n */\r\n longLabel: string;\r\n /**\r\n * Defines the icon of the shortcut.\r\n * You can set the icon as a BASE64-Bitmap or as a Resource name\r\n */\r\n icon?: {\r\n /**\r\n * Type of the icon\r\n */\r\n type: AvailableIconTypes;\r\n /**\r\n * Name of te Resource or data of the encoded Bitmap\r\n */\r\n name: string;\r\n }\r\n /**\r\n * Data you will receive when the shortcut is opened\r\n */\r\n data: string;\r\n}",
"complexTypes": [
"AvailableIconTypes"
]
}
]
},
{
"name": "AvailableIconTypes",

@@ -156,21 +242,10 @@ "slug": "availableicontypes",

{
"text": "\"Bitmap\"",
"text": "'Bitmap'",
"complexTypes": []
},
{
"text": "\"Resource\"",
"text": "'Resource'",
"complexTypes": []
}
]
},
{
"name": "MessageListener",
"slug": "messagelistener",
"docs": "",
"types": [
{
"text": "(response: { data: string; }): void",
"complexTypes": []
}
]
}

@@ -177,0 +252,0 @@ ],

import type { PluginListenerHandle } from '@capacitor/core';
export declare type AvailableIconTypes = "Bitmap" | "Resource";
export declare type ShortcutItem = {
export declare type AvailableIconTypes = 'Bitmap' | 'Resource';
export interface ShortcutItem {
/**

@@ -36,6 +36,6 @@ * ID of the shortcut

/**
* Data you will receive when the shortcut is opened
* Data that is passed to the 'shortcut' event
*/
data: string;
};
}
export interface AndroidShortcutsPlugin {

@@ -55,13 +55,13 @@ /**

/**
* Created dynamic shortcuts
* Set dynamic shortcuts
* @param options An items array with the options of each shortcut
*/
addDynamic(options: {
setDynamic(options: {
items: ShortcutItem[];
}): Promise<void>;
/**
* Created a pinned shortcut
* Add a pinned shortcut
* @param options An option object for the pinned shortcut
*/
addPinned(options: ShortcutItem): Promise<void>;
pin(options: ShortcutItem): Promise<void>;
/**

@@ -72,6 +72,19 @@ * Add a listener to a shortcut tap event

*/
addListener(eventName: 'shortcut', listenerFunc: MessageListener): Promise<PluginListenerHandle> & PluginListenerHandle;
addListener(eventName: 'shortcut', listenerFunc: (response: {
data: string;
}) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
/**
* Set dynamic shortcuts
* @param options An items array with the options of each shortcut
* @deprecated This function will be removed in future releases. Use {@link #setDynamic()} instead.
*/
addDynamic(options: {
items: ShortcutItem[];
}): Promise<void>;
/**
* Add a pinned shortcut
* @param options An option object for the pinned shortcut
* @deprecated This function will be removed in future releases. Use {@link #pin()} instead.
*/
addPinned(options: ShortcutItem): Promise<void>;
}
export declare type MessageListener = (response: {
data: string;
}) => void;
import { WebPlugin } from '@capacitor/core';
import { ShortcutItem, MessageListener, AndroidShortcutsPlugin } from './definitions';
import type { PluginListenerHandle } from '@capacitor/core';
import type { ShortcutItem, AndroidShortcutsPlugin } from './definitions';
export declare class AndroidShortcutsWeb extends WebPlugin implements AndroidShortcutsPlugin {

@@ -10,2 +11,9 @@ isDynamicSupported(): Promise<{

}>;
setDynamic(options: {
items: ShortcutItem[];
}): Promise<void>;
pin(options: ShortcutItem): Promise<void>;
addListener(eventName: 'shortcut', listenerFunc: (response: {
data: string;
}) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
addDynamic(options: {

@@ -15,3 +23,2 @@ items: ShortcutItem[];

addPinned(options: ShortcutItem): Promise<void>;
addListener(eventName: 'shortcut', listenerFunc: MessageListener): any;
}

@@ -9,7 +9,7 @@ import { WebPlugin } from '@capacitor/core';

}
addDynamic(options) {
setDynamic(options) {
console.error("Method 'add' not implemented.", JSON.stringify(options));
return Promise.reject("Method 'add' not implemented.");
}
addPinned(options) {
pin(options) {
console.error("Method 'add' not implemented.", options);

@@ -19,6 +19,14 @@ return Promise.reject("Method 'add' not implemented.");

addListener(eventName, listenerFunc) {
listenerFunc({ data: "" });
listenerFunc({ data: '' });
return Promise.reject(`Listener for '${eventName}' not implemented.`);
}
addDynamic(options) {
console.error("Method 'add' not implemented.", JSON.stringify(options));
return Promise.reject("Method 'add' not implemented.");
}
addPinned(options) {
console.error("Method 'add' not implemented.", options);
return Promise.reject("Method 'add' not implemented.");
}
}
//# sourceMappingURL=web.js.map

@@ -18,7 +18,7 @@ 'use strict';

}
addDynamic(options) {
setDynamic(options) {
console.error("Method 'add' not implemented.", JSON.stringify(options));
return Promise.reject("Method 'add' not implemented.");
}
addPinned(options) {
pin(options) {
console.error("Method 'add' not implemented.", options);

@@ -28,5 +28,13 @@ return Promise.reject("Method 'add' not implemented.");

addListener(eventName, listenerFunc) {
listenerFunc({ data: "" });
listenerFunc({ data: '' });
return Promise.reject(`Listener for '${eventName}' not implemented.`);
}
addDynamic(options) {
console.error("Method 'add' not implemented.", JSON.stringify(options));
return Promise.reject("Method 'add' not implemented.");
}
addPinned(options) {
console.error("Method 'add' not implemented.", options);
return Promise.reject("Method 'add' not implemented.");
}
}

@@ -33,0 +41,0 @@

@@ -15,7 +15,7 @@ var capacitorAndroidShortcuts = (function (exports, core) {

}
addDynamic(options) {
setDynamic(options) {
console.error("Method 'add' not implemented.", JSON.stringify(options));
return Promise.reject("Method 'add' not implemented.");
}
addPinned(options) {
pin(options) {
console.error("Method 'add' not implemented.", options);

@@ -25,5 +25,13 @@ return Promise.reject("Method 'add' not implemented.");

addListener(eventName, listenerFunc) {
listenerFunc({ data: "" });
listenerFunc({ data: '' });
return Promise.reject(`Listener for '${eventName}' not implemented.`);
}
addDynamic(options) {
console.error("Method 'add' not implemented.", JSON.stringify(options));
return Promise.reject("Method 'add' not implemented.");
}
addPinned(options) {
console.error("Method 'add' not implemented.", options);
return Promise.reject("Method 'add' not implemented.");
}
}

@@ -30,0 +38,0 @@

{
"name": "capacitor-android-shortcuts",
"version": "5.0.1",
"version": "5.0.2",
"description": "Add shortcuts in Android",

@@ -46,3 +46,3 @@ "main": "dist/plugin.cjs.js",

"@capacitor/core": "^4.0.0",
"@capacitor/docgen": "^0.0.10",
"@capacitor/docgen": "^0.2.1",
"@ionic/eslint-config": "^0.3.0",

@@ -49,0 +49,0 @@ "@ionic/prettier-config": "^1.0.1",

@@ -10,7 +10,7 @@ [![npm version](https://badge.fury.io/js/capacitor-android-shortcuts.svg)](https://badge.fury.io/js/capacitor-android-shortcuts)

Tap and hold on the app icon and you will see the dynamic shortcuts in the dropdown<br/>
=> Usage: Call the `addDynamic` method one time to add the array of dynamic shortcuts
=> Usage: Call the `setDynamic` method one time to set the array of dynamic shortcuts
**Pinned shortcut**<br/>
You can add a pinned shortcut programmatically inside your app, i.e. let a customer add a favorite of an article/product/... to the home screen<br/>
=> Usage: Call the `addPinned` method where the user wants to pin something. An alert will be shown to add the pinned shortcut to the home screen.
=> Usage: Call the `pin` method where the user wants to pin something. An alert will be shown to add the pinned shortcut to the home screen.

@@ -39,6 +39,6 @@ ## Supported platforms

// Add dynamic shortcuts
// Set dynamic shortcuts
AndroidShortcuts.isDynamicSupported().then(({ result }) => {
if (result) {
AndroidShortcuts.addDynamic({
AndroidShortcuts.setDynamic({
items: [

@@ -73,6 +73,6 @@ {

// Add pinned shortcuts
// Add a pinned shortcut
AndroidShortcuts.isPinnedSupported().then(({ result }) => {
if (result) {
AndroidShortcuts.addPinned({
AndroidShortcuts.pin({
id: "mypinnedid",

@@ -96,4 +96,6 @@ shortLabel: "My pinned short label",

See also [Wiki: Icon examples](https://github.com/NePheus/capacitor-android-shortcuts/wiki/Icon-examples)
## Usage of icons
See [Wiki: Icon examples](https://github.com/NePheus/capacitor-android-shortcuts/wiki/Icon-examples)
## API

@@ -132,9 +134,9 @@

### addDynamic(...)
### setDynamic(...)
```typescript
addDynamic(options: { items: ShortcutItem[]; }) => any
setDynamic(options: { items: ShortcutItem[]; }) => any
```
Created dynamic shortcuts
Set dynamic shortcuts

@@ -150,9 +152,9 @@ | Param | Type | Description |

### addPinned(...)
### pin(...)
```typescript
addPinned(options: ShortcutItem) => any
pin(options: ShortcutItem) => any
```
Created a pinned shortcut
Add a pinned shortcut

@@ -171,3 +173,3 @@ | Param | Type | Description |

```typescript
addListener(eventName: 'shortcut', listenerFunc: MessageListener) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'shortcut', listenerFunc: (response: { data: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
```

@@ -177,6 +179,6 @@

| Param | Type |
| ------------------ | ----------------------------------------------------------- |
| **`eventName`** | <code>'shortcut'</code> |
| **`listenerFunc`** | <code><a href="#messagelistener">MessageListener</a></code> |
| Param | Type |
| ------------------ | ----------------------------------------------------- |
| **`eventName`** | <code>'shortcut'</code> |
| **`listenerFunc`** | <code>(response: { data: string; }) =&gt; void</code> |

@@ -188,5 +190,50 @@ **Returns:** <code>any</code>

### addDynamic(...)
```typescript
addDynamic(options: { items: ShortcutItem[]; }) => any
```
Set dynamic shortcuts
| Param | Type | Description |
| ------------- | --------------------------- | ------------------------------------------------ |
| **`options`** | <code>{ items: {}; }</code> | An items array with the options of each shortcut |
**Returns:** <code>any</code>
--------------------
### addPinned(...)
```typescript
addPinned(options: ShortcutItem) => any
```
Add a pinned shortcut
| Param | Type | Description |
| ------------- | ----------------------------------------------------- | ---------------------------------------- |
| **`options`** | <code><a href="#shortcutitem">ShortcutItem</a></code> | An option object for the pinned shortcut |
**Returns:** <code>any</code>
--------------------
### Interfaces
#### ShortcutItem
| Prop | Type | Description |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`id`** | <code>string</code> | ID of the shortcut |
| **`shortLabel`** | <code>string</code> | Sets the short title of a shortcut. This is a mandatory field when publishing a new shortcut with ShortcutManager.addDynamicShortcuts(List) or ShortcutManager.setDynamicShortcuts(List). This field is intended to be a concise description of a shortcut. The recommended maximum length is 10 characters. |
| **`longLabel`** | <code>string</code> | Sets the text of a shortcut. This field is intended to be more descriptive than the shortcut title. The launcher shows this instead of the short title when it has enough space. The recommend maximum length is 25 characters. |
| **`icon`** | <code>{ type: <a href="#availableicontypes">AvailableIconTypes</a>; name: string; }</code> | Defines the icon of the shortcut. You can set the icon as a BASE64-Bitmap or as a Resource name |
| **`data`** | <code>string</code> | Data that is passed to the 'shortcut' event |
#### PluginListenerHandle

@@ -202,16 +249,6 @@

#### ShortcutItem
<code>{ /** * ID of the shortcut */ id: string; /** * Sets the short title of a shortcut. * This is a mandatory field when publishing a new shortcut with ShortcutManager.addDynamicShortcuts(List) or ShortcutManager.setDynamicShortcuts(List). * This field is intended to be a concise description of a shortcut. * The recommended maximum length is 10 characters. */ shortLabel: string; /** * Sets the text of a shortcut. * This field is intended to be more descriptive than the shortcut title. The launcher shows this instead of the short title when it has enough space. * The recommend maximum length is 25 characters. */ longLabel: string; /** * Defines the icon of the shortcut. * You can set the icon as a BASE64-Bitmap or as a Resource name */ icon?: { /** * Type of the icon */ type: <a href="#availableicontypes">AvailableIconTypes</a>; /** * Name of te Resource or data of the encoded Bitmap */ name: string; } /** * Data you will receive when the shortcut is opened */ data: string; }</code>
#### AvailableIconTypes
<code>"Bitmap" | "Resource"</code>
<code>'Bitmap' | 'Resource'</code>
#### MessageListener
<code>(response: { data: string; }): void</code>
</docgen-api>

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc