GithubHelp home page GithubHelp logo

isabella232 / actions-shortcut-convert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from actions-on-google/actions-shortcut-convert

0.0 0.0 0.0 194 KB

License: Apache License 2.0

Kotlin 100.00%

actions-shortcut-convert's Introduction

App Actions actions.xml to shortcuts.xml conversion utility

This project is a conversion from actions.xml to shortcuts.xml. The shortcuts.xml output will migrate most (but not all) content in your actions.xml.

Check out the shortcuts.xml documentation for more details on the new XML format.

Requirements

  • JVM compatible with Java 8

Usage

Command

Run this command from the root directory of the project to convert your actions.xml: ./gradlew run -Pactions=<path_to_actions.xml> -Pshortcuts=<path_to_shortcuts.xml>

Verifying

Manually you'll need to review your new shortcuts.xml as well as test the output in the App Actions Test Tool.

Post-processing and Manual Inspection

XML Character Entity References

The converter escapes any literal & by converting it to &amp; and assumes any sequence of 10 characters surrounded by & and ; is a XML entity reference (list of XML character entity references) .

It is highly recommended that input actions.xml is well-formed XML with properly escaped characters. To ensure the converter escaped characters as intended, it is also recommended that you verify that the generated shortcuts.xml contains properly escaped character entity references.

Defaults

Post-processing may be needed for defaults based on the use case and/or if you want to take advantage of the new shortcuts.xml features (e.g. targetClass fulfillment).

Field that require manual post-processing in the generated shortcuts.xml will be in the format of YOUR_<FIELD_NAME>. For example, for shortcutShortLabel, you will see YOUR_SHORTCUT_SHORT_LABEL. To quickly find the fields that require post-processing, you can do a search for"YOUR_".

Please check out the shortcuts.xml documentation to get a better idea on new features.

List of XML elements to post-process

See shortcuts.xml schema for details on the elements listed below.

Mandatory post-processing
  • shortcutShortLabel attribute of <shortcut>
Optional post-processing
  • android:action attribute of <intent> tag within <capability> and <shortcut>. This currently defaults to android.intent.action.VIEW

Tests

Unit Tests

ConvertActionsToShortcutsTest tests proper conversion of actions.xml to shortcuts.xml using either programmatically built actions/shortcuts or sample actions.xml and shortcuts.xml.

To add a unit test for a conversion case using sample test data, add the corresponding sample actions.xml and shortcuts.xml to the test data resources directory and reference the resources in the corresponding test case. See test standard actions using sample files in ConvertActionsToShortcutsTest for an example test case.

Notes:

  • Ensure that the actions.xml test data contains proper XML. Special characters should be properly escaped.

actions-shortcut-convert's People

Contributors

codingdoug avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.