Giter Site home page Giter Site logo

nseb / capacitor-app-actions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uioporqwerty/capacitor-app-actions

0.0 0.0 1.0 263 KB

Capacitor iOS and Android Plugin for App Actions

License: MIT License

Ruby 7.99% Java 10.20% Kotlin 30.77% Swift 26.97% Objective-C 5.54% JavaScript 3.95% TypeScript 14.58%

capacitor-app-actions's Introduction


App Actions

capacitor-app-actions

Capacitor iOS and Android Plugin for App Actions


Maintainers

Maintainer GitHub Social
Nitish Sachar uioporqwerty LinkedIn

Installation

npm install capacitor-app-actions
npx cap sync

Configuration

Android:

No additional configuration required.

iOS:

Add the following to AppDelegate.swift. This snippet allows the plugin to recognize when an app action has been selected so that you can respond to those events.

func application(_ application: UIApplication,
                   performActionFor shortcutItem: UIApplicationShortcutItem,
                   completionHandler: @escaping (Bool) -> Void)
{
    NotificationCenter.default.post(name: NSNotification.Name("appActionReceived"), object: nil, userInfo: ["actionId" : shortcutItem.type])
}

Usage

Typically app actions are added at application startup, but you can add them where appropriate:

import { AppActions } from 'capacitor-app-actions'

await Capacitor.Plugins.AppActions.set({ "actions": [ 
    { id: "order", title: "Order", subtitle: "Place an Order", icon: "star.fill" }, 
    { id: "locations", title: "Find location", subtitle: "Find nearby location", icon: "star.fill"}
  ]});

Listen to an event triggered by an existing app action:

AppActions.addListener("order", (info) => {
    // Do your in app work. Navigate to the appropriate page or trigger other in app actions.
  });

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Nitish Sachar

๐Ÿšง ๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

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.