Skip to content

Commit

Permalink
Updated readme and fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed Jun 3, 2020
1 parent b025020 commit 8b1f702
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

This fork takes the [original work](https://github.com/evanshortiss/sns-mobile) over by:
* upgrading dependencies (AWS SDK, Asyn,c, Mocha, Node version, etc.)
* adding support for SMS notifications (as detailled in this unmerged [PR](https://github.com/evanshortiss/sns-mobile/pull/30))
* adding support for SMS notifications (managed as a new platform, see this unmerged [PR](https://github.com/evanshortiss/sns-mobile/pull/30) for details)
* adding support for e-mail notifications (similar approach to previous one)
* adding lint, coverage and publication stages
* adding Travis CI

# SNS Mobile Push

Module to make interacting with mobile push notifications for iOS and Android easier. Wraps the Amazon aws-sdk node module. The idea is that you can create an object to represent each Platform Application you plan to use and remove the excess features that aren't needed for Android and iOS applications.
Module to make interacting with mobile push notifications for iOS and Android easier by wrapping the Amazon aws-sdk node module. The idea is that you can create an object to represent each Platform Application you plan to use (eg Android and iOS) and remove the excess features that aren't needed for Android and iOS applications.

Note that different endpoint types can subscribe to a given topic in AWS (eg devices for push notification, phone numbers for SMS, email address for mailing, etc.). Although this interface segregates access according to the application platform (eg Android or iOS - AWS application protocol) and the protocol (eg sms or email AWS protocol), take care that when using topics you can actually target multiple platforms or protocols. However, you can also name topics differently for each application platform or protocol so that you really segregate topic publications as well.

> **If you were/are using 1.0.0 or 1.0.1 please upgrade to 1.0.2, it fixes a major bug where messages were not sending.**
Expand Down
2 changes: 0 additions & 2 deletions lib/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ Interface.prototype.subscribeWithProtocol = function (endpointArn, topicArn, pro
Protocol: protocol
}
var self = this
console.log(params)
self.sns.subscribe(params, function (err, res) {
if (err) {
self.emit(EMITTED_EVENTS.SUBSCRIBE_FAILED, endpointArn, topicArn, err)
Expand Down Expand Up @@ -629,7 +628,6 @@ Interface.prototype.sendMessage = function (endpointArn, msg, callback) {
if (self.platform === SUPPORTED_PLATFORMS.SMS) params.PhoneNumber = endpointArn
else params.TargetArn = endpointArn
if (self.platform === SUPPORTED_PLATFORMS.EMAIL) params.Subject = message.subject
console.log(params)
try {
self.sns.publish(params, function (err, res) {
if (err) {
Expand Down
7 changes: 2 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ describe('SNS Module.', function () {

var theTopicArnThatThisTestCreated
var thePushSubscriptionArnThatThisTestCreated,
thePhoneSubscriptionArnThatThisTestCreated,
theEmailSubscriptionArnThatThisTestCreated
thePhoneSubscriptionArnThatThisTestCreated
// theEmailSubscriptionArnThatThisTestCreated

it('Should have events and supported platforms exposed on the interface', function () {
assert(SNS.SUPPORTED_PLATFORMS)
Expand Down Expand Up @@ -228,7 +228,6 @@ describe('SNS Module.', function () {
}), function (err, endpointArn) {
assert(!err)
sns.sendMessage(endpointArn, 'Application test message', function (err, res) {
console.log(err)
assert(!err)
assert(res)
assert.strictEqual(typeof res, 'string')
Expand All @@ -248,7 +247,6 @@ describe('SNS Module.', function () {

it('Should send a message to an email address.', function (done) {
snsForEmail.sendMessage(EMAIL_ADDRESS, 'Email test message', function (err, res) {
console.log(err)
assert(!err)
assert(res)
assert.strictEqual(typeof res, 'string')
Expand Down Expand Up @@ -304,7 +302,6 @@ describe('SNS Module.', function () {
/* Email subscription requires the user to confirm it via a link, not easy to be done in tests
it('Should subscribe an email address to a topic.', function (done) {
snsForEmail.subscribe(EMAIL_ADDRESS, theTopicArnThatThisTestCreated, function (err, subscriptionArn) {
console.log(subscriptionArn)
assert(!err)
assert(subscriptionArn)
theEmailSubscriptionArnThatThisTestCreated = subscriptionArn
Expand Down

0 comments on commit 8b1f702

Please sign in to comment.