@msepena/capacitor-plugin-sirishortcuts
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@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

Package Sidebar

Install

npm i @msepena/capacitor-plugin-sirishortcuts

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

832 kB

Total Files

182

Last publish

Collaborators

  • msepena