Git Product home page Git Product logo

lola's Introduction

lola

SPM Compatible Platforms: macOS Twitter

A helper tool for sending push notifications from the terminal written in Swift.

Lola

Instalation

As a Command Line Tool

If you want to run lola in the terminal, clone the repo:

$ git clone https://github.com/industrialbinaries/lola
$ cd lola

And then install it with Make:

$ make install

As a Swift Package

lola is also distributed via SPM. You can use it as a framework in your macOS or iOS project. In your Package.swift add a new package depedency:

.package(
    url: "https://github.com/industrialbinaries/lola",
    from: "0.1.0"
)

Usage

From Terminal

To send push notifications from the terminal with lola you need to use the following parameters:

  • bundleId - bundle the ID of your app

  • device - device token or the device you want to send the notification to

  • teamId - Apple Developer Team ID, you can find it in your Account -> Membership -> Team ID

  • authKey - Name of your p8 file created in Apple Keys

  • notificationType - This parameter is optional, when is not set payload will be sent with default value alert. Can be one of 6 values alert, background, VOIP, complication, fileprovider, mdm

  • json - JSON payload of your notification. Either json or message value has to be specified.

  • message - The notification will be sent as an alert with the provided text. This is a convenient option instead of providigin the full json payload.

Example usage (with message):

$ lola  \
-bundleId co.industrial-binaries.LolaTestApp  \
-device d9f1767bdbf0371f5efb25c7873f1942cf570ececde9896913ed9fdb33ac1c26  \
-teamId 9Q6922742Y \
-authKey AuthKey_JP8Z7XXKD9.p8  \
-message "Hi from lola ๐Ÿ‘‹"

Example usage (with json):

$ lola  \
-bundleId co.industrial-binaries.LolaTestApp  \
-device d9f1767bdbf0371f5efb25c7873f1942cf570ececde9896913ed9fdb33ac1c26  \
-teamId 9Q6922742Y \
-authKey AuthKey_JP8Z7XXKD9.p8  \
-notificationType alert \
-json "{ \"aps\": {\"alert\": \"Hi from lola ๐Ÿ‘‹\", \"sound\": \"default\" }}"

As a Framework

  1. Get the authorization token from your P8 file using P8Parser:
let parser = try P8Parser(
  p8: /** Key of your P8 **/,
  teamID: /** Team ID of your Apple Developer account **/
)
let authorizationToken = try parser.generateToken()
  1. Create a new instance of Lola:
let configuration = AppConfiguration(
  deviceToken: /** Your app Push token **/,
  authorizationToken: /** Token from your P8 key **/,
  bundleId: /** Bundle-id of your app **/
)

let lola = Lola(configuration: configuration)
  1. Use lola to send notifications by providing a JSON payload:
lola.send(
  payload: /** Notification payload - JSON in string **/,
  type: /** Notification type **/,
  completion: /** Your completion block **/
)

... or just a simple message:

lola.send(
  message: /** Notification message - notification description **/,
  completion: /** Your completion block **/
)

License and Credits

lola is released under the MIT license. See LICENSE for details.

Created by Jan Timar @ Industrial Binaries.

lola's People

Contributors

jantimar avatar vojtastavik 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.