@msepena/capacitor-plugin-sirishortcuts
v1.0.2
Published
Capacitor siri shortcuts
Downloads
8
Maintainers
Readme
@msepena/capacitor-plugin-sirishortcuts
This plugin adds support for donating and removing Siri Shortcuts.
Getting Started
npm i @msepena/capacitor-plugin-sirishortcuts
Prerequisites
The plugin only works in XCode 10, and on the iOS 12 platform.
Installing
npm i @msepena/capacitor-plugin-sirishortcuts
import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
import { Plugins } from '@capacitor/core';
import { SiriShortcutsPlugin } from "@msepena/capacitor-plugin-sirishortcuts";
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
constructor(
private platform: Platform
) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
const { StatusBar, SplashScreen, Toast, SiriShortcuts } = Plugins;
SplashScreen.hide();
SiriShortcuts.addListener('appLaunchBySirishortcuts', (resp) => {
Toast.show({text: resp['msg']});
});
});
}
}
donate() {
const data = {
persistentIdentifier: 'open-my-app',
title: 'open-my-app',
suggestedInvocationPhrase: 'open-my-app',
isEligibleForSearch: true,
userInfo: {msg: "murali"},
isEligibleForPrediction: true,
}
const { Toast, SiriShortcuts } = Plugins;
SiriShortcuts.donate(data).then(resp => {
Toast.show( {text: "successfully submitted"});
}, error => {
Toast.show( {text: error['message']});
});
}
Built With
https://capacitor.ionicframework.com/docs/plugins/js