From 8b1f702a58ba999b090ed0035b7864282651bfe3 Mon Sep 17 00:00:00 2001 From: Luc Claustres Date: Wed, 3 Jun 2020 16:04:25 +0200 Subject: [PATCH] Updated readme and fixed typo --- README.md | 7 +++++-- lib/interface.js | 2 -- test/index.js | 7 ++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fd6a590..a9c840c 100644 --- a/README.md +++ b/README.md @@ -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.** diff --git a/lib/interface.js b/lib/interface.js index 1a0dfd7..6956500 100644 --- a/lib/interface.js +++ b/lib/interface.js @@ -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) @@ -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) { diff --git a/test/index.js b/test/index.js index f916ccb..69ff427 100644 --- a/test/index.js +++ b/test/index.js @@ -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) @@ -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') @@ -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') @@ -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