Giter Club home page Giter Club logo

poes's Introduction

Poes

A Swift command-line tool to easily send push notifications to the iOS simulator.

Twitter: @twannl

Poes helps you with:

  • Generating a JSON payload for push notifications
  • Sending and testing push notifications in the simulator

Requirements

  • Xcode 11.4 beta 1 and up

Usage

$ poes --help
OVERVIEW: A Swift command-line tool to easily test push notifications to the
iOS simulator

USAGE: poes <subcommand>

OPTIONS:
  -h, --help              Show help information.

SUBCOMMANDS:
  send                    Send a push notification to an app installed on the
                          iOS Simulator
$ poes send --help
OVERVIEW: Send a push notification to an app installed on the iOS Simulator

USAGE: poes send <bundle-identifier> [--title <title>] [--body <body>] [--badge <badge>] [--is-mutable] [--verbose]

ARGUMENTS:
  <bundle-identifier>     The bundle identifier of the app to push to 

OPTIONS:
  -t, --title <title>     The title of the Push notification (default: Default
                          Title)
  -b, --body <body>       The body of the Push notification (default: Default
                          Body)
  -b, --badge <badge>     The number to display in a badge on your app’s icon 
  -i, --is-mutable        Adds the mutable-content key to the payload 
  --verbose               Show extra logging for debugging purposes 
  -h, --help              Show help information.

The bundle identifier is mandatory, all others have a default value. The following command can be enough to send out a notification:

$ poes send com.wetransfer.app --verbose
Generated payload:

{
  "aps" : {
    "alert" : {
      "title" : "Default title",
      "body" : "Default body"
    },
    "mutable-content" : false
  }
}

Sending push notification...
Push notification sent successfully

Installation using Mint

You can install Poes using Mint as follows:

$ mint install AvdLee/Poes

Development

  • cd into the repository
  • run swift package generate-xcodeproj (Generates an Xcode project for development)
  • Run the following command to try it out:
swift run Poes --help

FAQ

Why is it called "Poes"?

Poes is a Dutch word for a female cat. The pronunciation is the same as "Push" and pushing notifications is what we're doing here!

Why is there a PoesCore framework?

This makes it really easy to eventually create a Mac App with a UI around it 🚀

How do I create a Swift Package myself?

Check out my blog post Swift Package framework creation in Xcode.

Can I learn more about testing Push Notifications on the iOS simulator?

Yes! I've written a detailed blog post about this: Testing push notifications on the iOS simulator

poes's People

Contributors

avdlee avatar engali94 avatar juanpe avatar swiftleebot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

poes's Issues

Add support for background pushes that set content-available

This would be similar to the option to generate the mutable content flag.
Within the aps section, add "content-available" : 1. This should not be included with other keys in the 'aps' section, but can include other data which may also need support for setting.

Add an option to create a APNS file based on input

This would probably be a subcommand that allows generating a payload for the given input parameters.
It can be interesting to have as you can drag APNS files into the simulator.

The APNS file can be checked into repositories for easy use within teams. You could imagine yourself adding APNS files for each push notification type that is supported.

Push notification sent successfully... Not

I'm running the command: poes send my_bundle_id
Sending push notification...
Push notification sent successfully

I'm not seeing any notifications. The notification methods are being hit.
If I drop an .apns file into the simulator it works.
What are some trouble shooting steps here? Thanx.

Create a Mac app with User Interface

Although this works great from the terminal, the project is suitable to easily port to a simple Mac app with UI. This way we could make form fields to easily fill in the bundle identifier, title, body, and more.

import PoesCore

Should be enough to get started. After that, we can simply call the executable as follows:

try Poes.run(arguments: ["poes", "--bundle-identifier", expectedBundleIdentifier, "-t", title, "-b", body, "-m"])

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.