npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-gizwits-siri-shortcut

v1.0.8

Published

Siri shortcut tool

Downloads

10

Readme

Gizwits Siri Shortcut

由于 Cordova 目前不支持创建多个 Target 的 iOS 项目,添加 Siri Widget 的大概步骤如下:

  1. 先添加 iOS platform
  2. 添加所有依赖的 plugin,包括本插件 cordova-gizwits-siri-shortcut
  3. 手动添加 Intents Extension

Target 在 *.xcodeproj 中的排序是不确定的,Cordova 每次都是只拿排在第一的 Target 来操作 (主 App 的 Target 不一定排在第一位),导致 Cordova 操作了其他的 Target,使得项目报错。所以添加 Intents Extension 必需在完成其他操作后再进行。

一旦添加了 Intents Extension,就不能再更新插件或其他使用 Cordova 命令更新项目的操作。若要进行这些操作,请先移除 iOS 项目再进行,操作完后再重新添加 iOS。

手动添加 Siri Shortcut 指引

支持平台

  • iOS

插件添加/移除

# 添加
cordova plugin add cordova-gizwits-siri-shortcut --variable GROUP_ID=group.xxxx
# 移除
cordova plugin rm cordova-gizwits-siri-shortcut

接口使用说明

  1. 添加 Siri Shortcut addSiriShortcut

    // 参数
    // url 手动场景执行命令地址 (已拼接 homeId 及 id)
    // version Version 接口版本号
    // sceneId 场景 id
    // sceneName 手动场景名称
    // suggestedInvocationPhrase 建议的 Siri 命令短语
    // icon 图标名称
    params = {"url": "", "version": "", "sceneId": "", "sceneName": "场景名称", "suggestedInvocationPhrase": "执行手动场景1", icon: ""};
    cordova.plugins.gizSiriShortcut.addSiriShortcut(params, success, error);

    手动场景执行命令请参考接口说明: http://app-demo1.lease.iotsdk.com/swagger-ui.html#!/2623423478app4525163211602233026223/executeUsingPOST

  2. 编辑 Siri Shortcut editSiriShortcut

    // 参数
    // sceneId 场景 id
    // UUID Siri shortcut uuid
    params = {"sceneId": "", "UUID": ""};
    cordova.plugins.gizSiriShortcut.editSiriShortcut(params, success, error);
  3. Siri Shortcut 是否可用 isSiriShortcutEnabled

    cordova.plugins.gizSiriShortcut.isSiriShortcutEnabled(func (isEnabled) {
    	// isEnabled Siri Shortcut 是否可用
    	// true 可用
    	// false 不可用
    }, error);
  4. 获取 Siri 授权状态 getSiriAuthorizationStatus

    cordova.plugins.gizSiriShortcut.getSiriAuthorizationStatus(func (status) {
    	// status 授权状态值,请参照状态值表
    }, error);
  5. 请求 Siri 授权 requestSiriAuthorizationStatus

    cordova.plugins.gizSiriShortcut.requestSiriAuthorizationStatus(func (status) {
    	// status 授权状态值,请参照状态值表
    }, error);
  6. 初始化 App Groups setupWithGroupId

    请在 App 启动之后调用该方法初始化 App Groups

    groupId = "group.com.gizwits.xb";
    cordova.plugins.gizSiriShortcut.setupWithGroupId(groupId, success, error);
  7. 设置 Token setToken

    cordova.plugins.gizSiriShortcut.setToken("your token", success, error);
  8. 获取 Token getToken

    cordova.plugins.gizSiriShortcut.getToken(func (token) {
    	// token
    }, error);
  9. 获取 Siri Shortcut getSiriShortcut

    // 参数
    // sceneId 场景 id
    sceneId = "";
    cordova.plugins.gizSiriShortcut.getSiriShortcut(sceneId, func (sceneInfo) {
    	// sceneInfo 场景 Shortcut 信息 {"sceneId": "", "UUID": ""}
    }, error);
  10. 获取所有 Siri Shortcut getAllSiriShortcut

    cordova.plugins.gizSiriShortcut.getAllSiriShortcut(func (sceneInfoArray) {
    	// sceneInfoArray 场景 Shortcut 信息列表 [{"sceneId": "", "UUID": ""}]
    }, error);

状态值表

| 授权状态值 | 描述 | |---|---| | 0 | 未授权 Authorization status not determined | | 1 | 功能不可用 Authorization status restricted | | 2 | 拒绝授权 Authorization status denied | | 3 | 已授权 Authorization status authorized | | 4 | 未知状态 Authorization status unknown |