Open beaudry12087 opened 5 years ago
Hi,
in my fork i have add un api to retrieve all shortcuts. The api is getAll and the success callback returns an array of key-value object containing: { persistentIdentifier: string; invocationPhrase: string; }.
In ionic app you must extends the SiriShortcuts plugin and add the method getAll. Moreover, you must add this class in list of providers in the app.module file.
Below an example:
import { Injectable } from '@angular/core';
import { SiriShortcuts } from '@ionic-native/siri-shortcuts';
import { Cordova } from '@ionic-native/core';
export interface SiriShortcutSaved {
persistentIdentifier: string;
invocationPhrase: string;
}
@Injectable()
export class SiriShortcutsExtends extends SiriShortcuts {
/**
* Get all shortcut saved
* @return Promise<SiriShortcutSaved[]>
*/
@Cordova()
getAll(): Promise<SiriShortcutSaved[]> {
return;
}
}
@levieu Thank you. This is amazing
There is an API to donate, present, and remove shortcuts but It will be pretty useful to have a method to retrieve all the shortcuts created by the Cordova app. This will be very useful as it will allow solving an issue like this one https://github.com/bartwesselink/cordova-plugin-siri-shortcuts/issues/9 without the need to change the existing APIs.