Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

VaporAPNS 1.1.0

Compare
Choose a tag to compare
@matthijs2704 matthijs2704 released this 31 Oct 14:08
· 71 commits to master since this release

πŸ“” Changes

  • Adds the possibility to mass send push notifications to an array of device tokens
  • Fixes network error responses
  • Adds deviceToken to the Result response

πŸš€ Installing

🌟 New install

Installing is super easy as always! Just add the following line to your Package.swift and you're done!

.Package(url:"https://github.com/matthijs2704/vapor-apns.git", majorVersion: 1, minor: 1)

➑ Are you updating from VaporAPNS 1.0.x?

Great! Just change the minor: 0 to minor: 1 and you're ready to rock! 🎸

Change: .Package(url:"https://github.com/matthijs2704/vapor-apns.git", majorVersion: 1, minor: 0)
to: .Package(url:"https://github.com/matthijs2704/vapor-apns.git", majorVersion: 1, minor: 1)

⚠ Compatibility notice

This version contains a few source-breaking changes, so you can't just update, you'll have to make some code changes. I've tried to keep compatibility with the 1.0.x version, but some changes caused that to not work out. Luckily it is pretty easy to migrate to the new version! πŸ˜ƒ

πŸš€ Migrating to 1.1.0

First thing to do is to remove the 'deviceToken' from the initialiser of your ApplePushMessage. Second thing is to change the send method where you send the push message. Change it from:

let result = vaporAPNS.send(pushMessage)

to:

let result = vaporAPNS.send(pushMessage, to: "<your deviceToken>")

If you were using VaporAPNS to batch send notifications, you can remove some more code! This version of VaporAPNS adds support for sending multiple messages at once, using this snippet:

vaporAPNS.send(pushMessage, to: ["488681b8e30e6722012aeb88f485c823b9be15c42e6cc8db1550a8f1abb590d7", "2d11c1a026a168cee25690f2770993f6068206b1d11d54f88910b8166b23f983"]) { result in
    print(result)
    if case let .success(messageId,deviceToken,serviceStatus) = result, case .success = serviceStatus {
        print ("Success!")
    }
}