summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/phonegap-plugin-push
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/phonegap-plugin-push')
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/CHANGELOG.md582
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/MIT-LICENSE2
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/README.md10
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/docs/API.md32
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/docs/EXAMPLES.md1
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md166
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/docs/PAYLOAD.md817
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/docs/PHONEGAP_BUILD.md29
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/docs/TYPESCRIPT.md5
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/hooks/windows/setToastCapable.js8
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/package.json56
-rwxr-xr-xStoneIsland/plugins/phonegap-plugin-push/plugin.xml63
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/push.gradle18
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/spec/index.spec.js72
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/BackgroundActionButtonHandler.java4
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java (renamed from StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/FCMService.java)139
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PermissionUtils.java4
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushConstants.java16
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushDismissedHandler.java25
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushHandlerActivity.java32
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java19
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushPlugin.java132
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/RegistrationIntentService.java38
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/browser/manifest.json2
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.h17
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.m295
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/js/push.js316
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/src/windows/PushPluginProxy.js6
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/types/index.d.ts302
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js31
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/www/push.js483
31 files changed, 988 insertions, 2734 deletions
diff --git a/StoneIsland/plugins/phonegap-plugin-push/CHANGELOG.md b/StoneIsland/plugins/phonegap-plugin-push/CHANGELOG.md
index 1d66c3ac..e46cdae8 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/CHANGELOG.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/CHANGELOG.md
@@ -1,587 +1,5 @@
# Change Log
-## [v2.0.0-rc5](https://github.com/phonegap/phonegap-plugin-push/tree/v2.0.0-rc5) (2017-06-20)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v2.0.0-rc4...v2.0.0-rc5)
-
-- 2.0.0-rc5 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a5dfcb4e364a1b31d98d4b9683d9e4fe2e0e5d2d)
-- :bookmark: Bumping plugin version to 2.0.0-rc5 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4bb16bea611e9c472f34c3ede9a1a6d00a8e4c4d)
-- :arrow_up: Bump FCM to 11.0.1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/576135bf576be6e2cd183101d3d7219b4d297030)
-- :penguin: Issue #1796: Remove hook from 2.0.0 version [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/464636b9ae257afc712cfebcc1ed11425590c509)
-- :memo: Issue #1552: library not found for -lPods-Appname [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/95b23cdf5ae68faf714d63ac69cfe71ce7034dba)
-- :checkered_flag: Issue #1670: Subscribe and Unsubscribe for windows [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/228cdb4062f6019f878c456b89ef0685955ac7ed)
-- :memo: Issue #1760: fcmSandbox vs gcmSandbox [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/64562177a6d32f34b29f2a97fcc8846db9926a1c)
-- :bug: Issue #1785: plugin fails to install on windows using plugman [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/156adfc70e85a21cb9f3134de72781db405c5e07)
-- :memo: Issue #1767: Ionic 2 Android build fails with error (Can't find google-services.json file) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fa9625e7530f4c2280804fc0fcd52a7b7476e5eb)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6f98be137f997c2bbd32e5c192c1e928e4e1f2c9)
-
-## [v2.0.0-rc4](https://github.com/phonegap/phonegap-plugin-push/tree/v2.0.0-rc4) (2017-06-01)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v2.0.0-rc3...v2.0.0-rc4)
-
-- 2.0.0-rc4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/65f2e4c56b0ed440b8668986114c2c84b49e9c68)
-- :bookmark: Bumping plugin version to 2.0.0-rc4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4e887023484cb5d6dd92524e05a6490d22eb3974)
-- Update push.js [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a7cc5bdb8d149a3f6e7e9d918ecd9bb27c34009f)
-- :memo: Issue #1679: Please clarify the use of content-available in the payload doc [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/23f7965e26d48b43c09921138b1290a658a41528)
-- Update INSTALLATION.md (#1745) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f3e94bbc1dd79bf830a2342ce3d6ca0d0e1cf9a2)
-- Fixing 404 link to definition file [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9df6b4de82047a30b8322eb635c581de6c7252aa)
-- :bug::wrench: Issue #1744: The plugin installs npm in my local node_modules [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/06bb2b207848e2dc993c28052f3ad29bf84d88c4)
-- :bug: Issue #1725: Provide default for applicationServerKey [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d63bbe949edd21e86d886baf9aa00aab30f0ca95)
-- :wrench: use Node 4 on Travis [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2da999beffe2ef043767c8c979ca4e7ae7a069c6)
-- Fix INSTALLATION.md docs for v2.0.0 and Firebase Cloud Messaging (#1741) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/32ff975ea1318f6194ac01477ca563cfe4a0218a)
-- update FirebaseMessaging podspec (#1742) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1842f7ade4643ad733c18f80b0daa211147ab72c)
-- :art: Fix merge conflicts [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3efba512317119ea2d54473c7e164a6c24db3ca3)
-- Merge v2.0.x into master (#1736) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d07fdf031e052f9c457319e6aaa9d7bfb72d1224)
-- Fixes #1716 - Incomplete CocoaPods installation steps (#1738) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/525816cb0fd591b49f51b2844ac04e55397b6b8b)
-- docs updated (#1727) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4234bfe9dab6e9f72b2ff52c3a94287154d39229)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e7cbe6ea8c863b0096425836473f2fa05a0da048)
-- 1.10.4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ec7c3ea1fafbf3fafe502d278af218715aebb909)
-- :bookmark: Bumping plugin version to 1.10.4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b1efe1fa069c034aaf465e040300fd2884d46075)
-- :penguin::bug: Issue #1710: Notification message key overwritten [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/911a1d4fe5d3a05e0012ee8121464cfb8974ce23)
-- :penguin::bug: Issue #1710: Notification message key overwritten [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4eadccd93d6daa81a05396a93fdc2033a4c90b12)
-- :penguin: Fix issue #1663 by allowing message as the data payload key (#1666) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f8ac07399905fb9c6b0ab48139fa76066c5e190f)
-- [typo] Small fix to payload doc [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5a4a04b1be5a7dd30a9c577441b241767ec20500)
-- 2.0.0-rc3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b393a9d932aee66da277b404c2475cb77195d8d8)
-- :bookmark: Bumping plugin version to 2.0.0-rc3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8003110d0757107ad211cd0e0b9c175e60dcd7ed)
-- :package: update www/push.js [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c0a3a4c6d578b2ee14a82f167934ecc8a7672557)
-- :wrench: Update cordovaDependencies [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/969d546c3dc96efb59a226ee5df38de6e66e4de4)
-- :memo: update readme [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0cbb7a92946ac9febb5ac5960291928d539c0fe6)
-- :memo: Fix PAYLOAD.md regarding "drawable" directory name (#1711) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a27a62d6e346b1e61ffe2ffaae482461cf970c03)
-- Bump requirements [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/85e6419cbad124eaa3eac1c1c515aa684ccf4393)
-- Add resource-file way of copying google services files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/46ba2745f0ebc08cc3b12f9c51177247130b592c)
-- Merge branch 'v2.0.x' of https://github.com/phonegap/phonegap-plugin-push into v2.0.x [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a5c9e456ce333b3387b2e4412248cdf45d26334c)
-- Fixing package.json from failed merge/rebase. [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/974d2e218bcc8ab8ebf779ef18df74622702eb0e)
-- Remove hook and use resource-file tag to copy google services file [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/86763c7f2cc15eae39972e4137813edb5cd8b838)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9850b1b180c3b66f64edc1680d358a7b1df58b95)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/15a68ed070d611f0569c90adaa062099120a7817)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/784b7355a62490a5ce6229292213e22e671873c8)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9b9df30cf65a275c0d4727a2854b12792ec905a2)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/620af90cdda85f64aa65cc0fc0de051cb13980ba)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ee9ecc957d8961e2a0ae884f55ee5abc71652885)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c7545607bb23ea801f7a167d3408b112e4a6e812)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2ac7442de047ecedf4a6d2c66591889e14bdafc4)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5c2fc51055343467e51f6facbd690e71273cbac2)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d1b4f51fb2cd6e9ee8447fee0ce4a5e9eba0a52d)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0169587f198d0b44a06f408d803bbdac0fb1d079)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/38bd3581663ccd85b2daed7b9833571a4adbc99e)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9d5dbb196763e399d5177c0d4802ecc043cfc270)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/24f0a77bac10e0d8e4ff837a165a3d69c3447601)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2535a189caddba2a41f9e002930541c55360047d)
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8aa6f717db7dd534c97ad559307d391788e13e47)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/740cfe2bda63548a0e9cbf62b1833a4945eb432f)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/704b3635764700d5fc06f2e9c8c6a657ea4b7f29)
-- :pencil2: fixing error in CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/68b045e6e40cdf1d5b9ed84136bebdf5f7874b8a)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d8c4d002e4b6c6b399e5c5e5456012a121ee7b20)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/632a4f1d87ff306bbc8920133e96b84125e44468)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4fb78566b5ebbbf2f04268b91f9c8cbc7193601e)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e93f04a87763a762d581a18439b2de808fc81a2c)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8f827a9678dac02887872bd7374fde1c40caeb90)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/64044115de796c52132e60719d5e93fc16594002)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d1f8f8e55af40a16129cdc362e179f0c7ef60bd0)
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/05c52e22945c0405b76a6d10d837ae6b015e661b)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/600f6050a2c3899559148579c5bc32c1e56449fa)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2660a8620874d520e2f3f3217cf20ea369affada)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3f043c21a608fdea4436409b68fbcf2c822d6c0a)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/97a1615a79ab0317a5dae27b7124dbaec7bc71c7)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e04b175c72d0680b3b618fdbcce80f9f9d470055)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d21632fd2acf90847c67b0c70f0b740ed3d367a7)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b41580f7476a34014ceb03976f25989f98cbde6a)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f84574aeffc958b6ec152ca36c2ea595418e901c)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/326943dadc29fe662ce4925b8141960e31d78dd3)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b5c0156bb13a22e11cf6f174a7307e404ed6d154)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/006ca17a7482490fbbfc67faa88a4c60d81a49f4)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/102934b167c4e69c9a6a5c7b41d0ca3fba0cfd25)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/bccc1ba887603b8577c01ee5b885bffa0d406028)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7fe0379c6be007817c21355044bcecdd05bcc301)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6c1a5572c420c88772bd3fc89d81fac21027a5be)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/98c100b12613a2885ed1afd417b1e678883d37ee)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7861fd27cd052c7e80736b8da9cba8cfae442e73)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b3dc189600842c6a8e318b032bdf215ea1c9b81f)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ff2dbe0cc5a2dce0a92b6c16f35b1a67ce6a6f18)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/50285f9193f5e6b33e63c2540b8f3c7a257a5221)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f67e30d41f5ea94a60a53b00ed51b995960f89c9)
-- Merge branch 'v2.0.x' of https://github.com/phonegap/phonegap-plugin-push into v2.0.x [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/96af63840f28a57d29e21a48cc52533fa0830bea)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7371f3b31ea7a672ec6d43da7ef9475916b6c5c5)
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5099c8fe435bda7d8bc7b2648d078a3b63cf19ea)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/72d29bd4372e6043d38835d07839346ea204390a)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c44be0628bb42ba7ee07456524e9b1fffae64aea)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/95cdee193d2977a17e778bf91ca1bcfc240dc266)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a1fa7cce1168145c77fef2632ad64f8926e71d27)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ef4c7e187f2c5f386d9c844ee7211c8ff1cc214c)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5d52fdaf28f0535ef6dab315abd67141b0fcd0f7)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5d9dfdf179b39312a6382a48dd99d675e642a533)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/057cbd16f10581cd601079a9a10b9338df3c23eb)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/83238fce85413cdd192b5ff33139ba9a0bcd080f)
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9ff3929bed6bff911027bef21168e527ff61fd2c)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/94d8cc7ec8ba3a4d466758ffb2c27104c2cc1ca3)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a837c875d8a30fc4175693dff43139569974ec22)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/49da4ea30af1a2fb479110074ddf5f67e2ba370c)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ebc5d9353bab3917f91c775cf13aec47c5ca1e04)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/505c8da8253cb8562ed16659b5ec2a8e73ec1c23)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/46eafb1e5688ade278086a1644d06de4e36849b5)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f3b01f155f6300dc05c625116e0c374af61d6388)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/453561c8f2dfc4ed09b6a182f6998c90408a3d44)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ba0020349337160f83271b683195693ef0b4f440)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/aee7b93a4d0b0bb0b9c987704c1cde82612e4445)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5e0e7d107b2c9f4aeeda3a7757213e41ac573798)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/172528ea548174fd7be62d0ab2f9816566447a61)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2727d274ef650fb0b4d25786d42f0ee5f72e9730)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/697e592d8225f4e0853a0ea72a598d10a18c832d)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c2987cbee54f04e7d44eec421b2417be5e7d716e)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f358dba691fb39757003326209a232cefce53adf)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7b7de65c2718eccc1ff0eeb2800973cd440c85a7)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8bf4343369e6b12f6ec28a104512cb3ab392e834)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3de63bdf9e5a365e3b3e295f2a305ad66b512917)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b9ad4ebdeee6700d9edf95bf051dabda5923e01a)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c119bf08869d51d5fe23f9a0fb78fd8325b35248)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3a1806aaec5d3c76f7fcd30ddfd85d576fb6d197)
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/471b2aa829cb0ecc93a9a788891602ad17319a47)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7ad471ff45724828fb21630fdfbc244ba037d9d8)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b80dfb12b5053184936a4c6c881f1af55459348f)
-- :pencil2: fixing error in CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9796292910f2d600b22d4846c128196cfb54ba7c)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/297b8d28f2d7bf04420744c445e59a527c52d502)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/41c8e66483fc0c5f21da7477d2522a2212a8017a)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/08e496fffc7fa082410f7b16e73e6afe12da194c)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/156718a5800dfe4b87593e0732f4258c7c148bea)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0add758d08657e22501612ed258033e31c394e6a)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1f2fd671ae734201b1260bc3d7878ae9ef28673c)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/70c6e04a3ba072b91b3752173ca2287d4e448b8f)
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7e07d81dbb47babe161f3204cdd06222a1e2ab3c)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f3dffdcf63c3d19b4717eed89eb911b8aecdd25a)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f5182503b241f519c03c872ae12f3489383f2b83)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/27a101f1d35217e0a1b7f0be9ad0607d31ea6c57)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c25a47bd3b5c2437ce3108656449658568f2c053)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/000bc36a8ce2a00e96212b66d69f1597dac68554)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/aa1cc247fcf8b94c4d60d26b18c9229c112e8185)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7f4bcafafe56be18f6dc64f3e634a6de594bc034)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a3f0eee774c7f9791f55f85816b0aeadc5c4fb4c)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6c796a49c3a44b47f58237d7e7760f5ebc34c371)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/10c5153672dc478dd072274c220200526c313604)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/aa6e3ce5449accd5397b4eda8a950fd5cebc4f0e)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b65fe745b5eabbb7437a46b46e747be4aaf5116a)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3b5f3c71657d8af3e4407ac9ea6c36e00988b1cf)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/89040874c530c7f86c2acbcce5c3b88b351e80fb)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a1e90013f8ca8497acc2513f4ce3df1358293d51)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0bc1ca736546242772516334f47fd4ea4f8f5e5f)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f7acf338d5bff2bc25b5c1e2fa681b7e20254cc9)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a65be290d4176c1c0b51b700d673550ae22cf777)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ed630d481b9035eb9df48738c0e77029937fafe9)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c9c53761fa3d6fc99acaa96601e9abc673a62c23)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6c46880b57aa1dee2bbcfeb5a86b497035f46ebe)
-
-## [v1.10.4](https://github.com/phonegap/phonegap-plugin-push/tree/v1.10.4) (2017-05-17)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.10.3...v1.10.4)
-
-- 1.10.4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ec7c3ea1fafbf3fafe502d278af218715aebb909)
-- :bookmark: Bumping plugin version to 1.10.4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b1efe1fa069c034aaf465e040300fd2884d46075)
-- :penguin::bug: Issue #1710: Notification message key overwritten [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/911a1d4fe5d3a05e0012ee8121464cfb8974ce23)
-- :penguin::bug: Issue #1710: Notification message key overwritten [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4eadccd93d6daa81a05396a93fdc2033a4c90b12)
-- :penguin: Fix issue #1663 by allowing message as the data payload key (#1666) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f8ac07399905fb9c6b0ab48139fa76066c5e190f)
-- [typo] Small fix to payload doc [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5a4a04b1be5a7dd30a9c577441b241767ec20500)
-- :memo: update readme [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0cbb7a92946ac9febb5ac5960291928d539c0fe6)
-- :memo: Fix PAYLOAD.md regarding "drawable" directory name (#1711) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a27a62d6e346b1e61ffe2ffaae482461cf970c03)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cfad83fa420df5ba4ac12f2f3f7fa68fdb22cc03)
-
-## [v2.0.0-rc3](https://github.com/phonegap/phonegap-plugin-push/tree/v2.0.0-rc3) (2017-05-09)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v2.0.0-rc2...v2.0.0-rc3)
-
-- 2.0.0-rc3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b393a9d932aee66da277b404c2475cb77195d8d8)
-- :bookmark: Bumping plugin version to 2.0.0-rc3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8003110d0757107ad211cd0e0b9c175e60dcd7ed)
-- :package: update www/push.js [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c0a3a4c6d578b2ee14a82f167934ecc8a7672557)
-- :wrench: Update cordovaDependencies [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/969d546c3dc96efb59a226ee5df38de6e66e4de4)
-- Bump requirements [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/85e6419cbad124eaa3eac1c1c515aa684ccf4393)
-- Add resource-file way of copying google services files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/46ba2745f0ebc08cc3b12f9c51177247130b592c)
-- Merge branch 'v2.0.x' of https://github.com/phonegap/phonegap-plugin-push into v2.0.x [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a5c9e456ce333b3387b2e4412248cdf45d26334c)
-- Fixing package.json from failed merge/rebase. [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/974d2e218bcc8ab8ebf779ef18df74622702eb0e)
-- Remove hook and use resource-file tag to copy google services file [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/86763c7f2cc15eae39972e4137813edb5cd8b838)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9850b1b180c3b66f64edc1680d358a7b1df58b95)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/15a68ed070d611f0569c90adaa062099120a7817)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/784b7355a62490a5ce6229292213e22e671873c8)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9b9df30cf65a275c0d4727a2854b12792ec905a2)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/620af90cdda85f64aa65cc0fc0de051cb13980ba)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ee9ecc957d8961e2a0ae884f55ee5abc71652885)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c7545607bb23ea801f7a167d3408b112e4a6e812)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2ac7442de047ecedf4a6d2c66591889e14bdafc4)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5c2fc51055343467e51f6facbd690e71273cbac2)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d1b4f51fb2cd6e9ee8447fee0ce4a5e9eba0a52d)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0169587f198d0b44a06f408d803bbdac0fb1d079)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/38bd3581663ccd85b2daed7b9833571a4adbc99e)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9d5dbb196763e399d5177c0d4802ecc043cfc270)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/24f0a77bac10e0d8e4ff837a165a3d69c3447601)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2535a189caddba2a41f9e002930541c55360047d)
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8aa6f717db7dd534c97ad559307d391788e13e47)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/740cfe2bda63548a0e9cbf62b1833a4945eb432f)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/704b3635764700d5fc06f2e9c8c6a657ea4b7f29)
-- :pencil2: fixing error in CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/68b045e6e40cdf1d5b9ed84136bebdf5f7874b8a)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d8c4d002e4b6c6b399e5c5e5456012a121ee7b20)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/632a4f1d87ff306bbc8920133e96b84125e44468)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4fb78566b5ebbbf2f04268b91f9c8cbc7193601e)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e93f04a87763a762d581a18439b2de808fc81a2c)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8f827a9678dac02887872bd7374fde1c40caeb90)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/64044115de796c52132e60719d5e93fc16594002)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d1f8f8e55af40a16129cdc362e179f0c7ef60bd0)
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/05c52e22945c0405b76a6d10d837ae6b015e661b)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/600f6050a2c3899559148579c5bc32c1e56449fa)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2660a8620874d520e2f3f3217cf20ea369affada)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3f043c21a608fdea4436409b68fbcf2c822d6c0a)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/97a1615a79ab0317a5dae27b7124dbaec7bc71c7)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e04b175c72d0680b3b618fdbcce80f9f9d470055)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d21632fd2acf90847c67b0c70f0b740ed3d367a7)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b41580f7476a34014ceb03976f25989f98cbde6a)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f84574aeffc958b6ec152ca36c2ea595418e901c)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/326943dadc29fe662ce4925b8141960e31d78dd3)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b5c0156bb13a22e11cf6f174a7307e404ed6d154)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/006ca17a7482490fbbfc67faa88a4c60d81a49f4)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/102934b167c4e69c9a6a5c7b41d0ca3fba0cfd25)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/bccc1ba887603b8577c01ee5b885bffa0d406028)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7fe0379c6be007817c21355044bcecdd05bcc301)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6c1a5572c420c88772bd3fc89d81fac21027a5be)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/98c100b12613a2885ed1afd417b1e678883d37ee)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7861fd27cd052c7e80736b8da9cba8cfae442e73)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b3dc189600842c6a8e318b032bdf215ea1c9b81f)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ff2dbe0cc5a2dce0a92b6c16f35b1a67ce6a6f18)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/50285f9193f5e6b33e63c2540b8f3c7a257a5221)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f67e30d41f5ea94a60a53b00ed51b995960f89c9)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cfad83fa420df5ba4ac12f2f3f7fa68fdb22cc03)
-- 1.10.3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1e072b351056d453fd1c1d40d5fcac310f3e107c)
-- :bookmark: Bumping plugin version to 1.10.3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/29df66eae54e773925e25bd92299957e4d654723)
-- :bug: Handle null in getCircleBitmap (#1705) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3acdfa338d7a8b56ec4dc73c50aa9917ecb3be7c)
-- :shirt: Issue #1702: The logging tag can be at most 23 characters, was 40 (PushPlugin_BackgroundActionButtonHandler) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2045873acda2e81d54b2da87cd2d10f056bd90f9)
-- Shortened log tag PushPlugin_BackgroundActionButtonHandler to bring u… (#1703) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/dd707122b7aa78649fa6f5f73ba9b05436799926)
-- Merge branch 'v2.0.x' of https://github.com/phonegap/phonegap-plugin-push into v2.0.x [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/96af63840f28a57d29e21a48cc52533fa0830bea)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7371f3b31ea7a672ec6d43da7ef9475916b6c5c5)
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5099c8fe435bda7d8bc7b2648d078a3b63cf19ea)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/72d29bd4372e6043d38835d07839346ea204390a)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c44be0628bb42ba7ee07456524e9b1fffae64aea)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/95cdee193d2977a17e778bf91ca1bcfc240dc266)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a1fa7cce1168145c77fef2632ad64f8926e71d27)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ef4c7e187f2c5f386d9c844ee7211c8ff1cc214c)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5d52fdaf28f0535ef6dab315abd67141b0fcd0f7)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5d9dfdf179b39312a6382a48dd99d675e642a533)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/057cbd16f10581cd601079a9a10b9338df3c23eb)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/83238fce85413cdd192b5ff33139ba9a0bcd080f)
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9ff3929bed6bff911027bef21168e527ff61fd2c)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/94d8cc7ec8ba3a4d466758ffb2c27104c2cc1ca3)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a837c875d8a30fc4175693dff43139569974ec22)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/49da4ea30af1a2fb479110074ddf5f67e2ba370c)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ebc5d9353bab3917f91c775cf13aec47c5ca1e04)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/505c8da8253cb8562ed16659b5ec2a8e73ec1c23)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/46eafb1e5688ade278086a1644d06de4e36849b5)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f3b01f155f6300dc05c625116e0c374af61d6388)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/453561c8f2dfc4ed09b6a182f6998c90408a3d44)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ba0020349337160f83271b683195693ef0b4f440)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/aee7b93a4d0b0bb0b9c987704c1cde82612e4445)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5e0e7d107b2c9f4aeeda3a7757213e41ac573798)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/172528ea548174fd7be62d0ab2f9816566447a61)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2727d274ef650fb0b4d25786d42f0ee5f72e9730)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/697e592d8225f4e0853a0ea72a598d10a18c832d)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c2987cbee54f04e7d44eec421b2417be5e7d716e)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f358dba691fb39757003326209a232cefce53adf)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7b7de65c2718eccc1ff0eeb2800973cd440c85a7)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8bf4343369e6b12f6ec28a104512cb3ab392e834)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3de63bdf9e5a365e3b3e295f2a305ad66b512917)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b9ad4ebdeee6700d9edf95bf051dabda5923e01a)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c119bf08869d51d5fe23f9a0fb78fd8325b35248)
-- :memo: Docs for interoperability with Firebase (#1693) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cebb6403143047192462f30c22b9510a8c6dbe21)
-- fix headline (#1685) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e2e7993544eed544eb7286868b60e2e3efb6275d)
-- Fix changelog date [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3140b2b00388785f8056632376b50a1d1ef67b96)
-- :arrow_up: update pluginpub to 0.0.8 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cfab7d91556a38ee81550fe47e13f2662ae810db)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/027ea2c17e4b96b848ab29046efea243e6e2da27)
-- 1.10.2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b5a7d4ec6e64abaed65de00be3e9bac9ab25791e)
-- :bookmark: Bumping plugin version to 1.10.2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5b700ad9927c401081a5de49f2a6a27ba0dfaa9a)
-- :arrow_up: update pluginpub to 0.0.7 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/38564ce55e53e018c91f4063d680eedd2631b825)
-- Fix the dates on the CHANGELOG (the last 2 version) (#1676) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c0f26192c906bfc1a60390333c96d5dc07433978)
-- Vapid Support (#1675) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/384b60bade628035b21d23f07e284eb6e1557a10)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/97d618fb53084cfae78f397def48df791131358f)
-- 1.10.1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6211e8c3df8881a90d19b111a0e63f890d435df6)
-- :bookmark: Bumping plugin version to 1.10.1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6d710a06681ad84c13273fe5d20feb3033ac67b6)
-- :bug: Issue #1655: App opens on clearing notification (Android) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ff417925f6d6678f0fcd8315d5f4b4b08fbb9085)
-- :memo: Issue #1118: Problem with notifications stacking [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d669c44a863d86d0bb73b5ae086bc2fe6f8113a9)
-- :memo: Issue #1220: [Question] the hook setting seem not work [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4ef137eea370da7c225ab2a5cf63b1e97a68f4a4)
-- Set get badge count android (#1644) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/630907cf3d8802bcd5d91b6bd768c989f6ef897a)
-- Add plugin typings from DefinitelyTyped (#1654) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6ea70d9984e176a75602e72e1d26f5404c519e29)
-- :arrow_up: Issue #1560: setApplicationIconBadgeNumber not working on Android but firing success function [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/700701fd2151667905d860228cf954301186721a)
-- :memo: Issue #1618: No notification when app is closed on Android, not at all on iOS [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7f64bf0ffbddf3ef20de2fe540ec2718be5d0c23)
-- :arrow_down: Issue #1560: setApplicationIconBadgeNumber not working on Android but firing success function [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e450fd7b623f27f27858a7537ec7950aa0f618b5)
-- :arrow_up: Issue #1560: setApplicationIconBadgeNumber not working on Android but firing success function [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4af3472263a5125cab6f08bbb59b83bf957144ec)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ed25a3e3ad9fb6f2af63fd07957944f974eafaa1)
-- 1.10.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6b9b862da8566c7717dfc79dd6b32d8a7e6774d8)
-- :bookmark: Bumping plugin version to 1.10.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/626e9615fbff6ea225569ab58353ac7f58aef495)
-- :heavy_plus_sign: update pluginpub version [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c3c8058ffee888447017eb5d8c0f4f30cbcd090f)
-- Issue #1464: Create round bitmap icon for large icon image passed in from local resource or url (#1635) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0dd0d468868f0b13c8d840c78dd89fca5920cd32)
-- Receive notification only from SENDER_ID (#1484) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a0d51e54aac39b8c58e4c67080f174c0228947c9)
-- Add no-cache flag to payload (#1620) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/42f8cefbd187c36534e6ab59b6611fb7f15b91f0)
-- Add dismiss key to on notification data (#1621) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4259bb3cacfe2561ed44e9f16bd74f8d5ae45ae2)
-- return true for old android versions, since AppOpsManager is available starting at 19 (#1634) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/945aa2ad6d266e82683e0bee86f53d258f2b31b6)
-- :art: remove reference to unused String [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/75f2191632a7a51eda7510a172ae6cc9d477acb9)
-- Ability to use custom keys to find message title and text on Android (#1604) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fd366296773906c91d5f8dfa3e8ba813c7c71b85)
-- :memo: Fixed URL of apples custom sound documentation (#1600) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8c93f8622eb1c453cb0c681158a07deca32bf200)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/409020c90edf04e0a37232cff8aadb070d4ccaa9)
-- 1.9.4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2241c7431cd60a68d2f35e7b4a5bfd797d5161b6)
-- Bumping plugin version to 1.9.4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ec47932bf8fdf9cd96db076fe56306ab230048d9)
-- Issue #1591: App crashes with the latest updates of Android SDK with plugin v-1.9.2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/514c21366ab37001ca323bec58261e023edaefd7)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3a218e4c68ebc1088461c2cfec966e57eaa24089)
-- 1.9.3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/42723d6609862aa950abce67b2a637736bdd9e99)
-- :bookmark: Bumping plugin version to 1.9.3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8f7b7dc003a2bc5bab7a316b0e2b0cf475c5a449)
-- :wrench: Add valid SPDX license expression [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4274d0759acd7110ed2592ed1d2ce3bf692711d3)
-- :memo: Issue #1587: v2.0.0-rc2: .on('notification') event not fired when background notification in Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7e90853a09a2c49f29e12eed03977b08b1295387)
-- :arrow_up: Issue #1560: setApplicationIconBadgeNumber not working on Android but firing success function [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3188a3907f50dcf625b7663ecf74ea9a9209d437)
-- :memo: Issue #1557: push.on('notification') not triggered - Ionic [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b91e9420fb68c4efc943cc5f8ecbd81274ffcbec)
-- :memo: Issue #1407: Uncaught (in promise): Error: Push plugin not found! [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/adf3eabb8871980d2dead7ecb8185ad0da1d6b46)
-- Corrected merges usage to prevent possible conflicts with other plugins (#1538) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/00c67cb2c85e97dfe4f7020f28ad4d954458599f)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3a1806aaec5d3c76f7fcd30ddfd85d576fb6d197)
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/471b2aa829cb0ecc93a9a788891602ad17319a47)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7ad471ff45724828fb21630fdfbc244ba037d9d8)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b80dfb12b5053184936a4c6c881f1af55459348f)
-- :pencil2: fixing error in CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/9796292910f2d600b22d4846c128196cfb54ba7c)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/297b8d28f2d7bf04420744c445e59a527c52d502)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/41c8e66483fc0c5f21da7477d2522a2212a8017a)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/08e496fffc7fa082410f7b16e73e6afe12da194c)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/156718a5800dfe4b87593e0732f4258c7c148bea)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0add758d08657e22501612ed258033e31c394e6a)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1f2fd671ae734201b1260bc3d7878ae9ef28673c)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/70c6e04a3ba072b91b3752173ca2287d4e448b8f)
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7e07d81dbb47babe161f3204cdd06222a1e2ab3c)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f3dffdcf63c3d19b4717eed89eb911b8aecdd25a)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f5182503b241f519c03c872ae12f3489383f2b83)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/27a101f1d35217e0a1b7f0be9ad0607d31ea6c57)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c25a47bd3b5c2437ce3108656449658568f2c053)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/000bc36a8ce2a00e96212b66d69f1597dac68554)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/aa1cc247fcf8b94c4d60d26b18c9229c112e8185)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7f4bcafafe56be18f6dc64f3e634a6de594bc034)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a3f0eee774c7f9791f55f85816b0aeadc5c4fb4c)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6c796a49c3a44b47f58237d7e7760f5ebc34c371)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/10c5153672dc478dd072274c220200526c313604)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/aa6e3ce5449accd5397b4eda8a950fd5cebc4f0e)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b65fe745b5eabbb7437a46b46e747be4aaf5116a)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3b5f3c71657d8af3e4407ac9ea6c36e00988b1cf)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/89040874c530c7f86c2acbcce5c3b88b351e80fb)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a1e90013f8ca8497acc2513f4ce3df1358293d51)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0bc1ca736546242772516334f47fd4ea4f8f5e5f)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f7acf338d5bff2bc25b5c1e2fa681b7e20254cc9)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a65be290d4176c1c0b51b700d673550ae22cf777)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ed630d481b9035eb9df48738c0e77029937fafe9)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c9c53761fa3d6fc99acaa96601e9abc673a62c23)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6c46880b57aa1dee2bbcfeb5a86b497035f46ebe)
-- :penguin: android mixpanel pushnotification suport added (#1523) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/951cb6921a717d847c279ad6896c28772c70103f)
-- :memo: Making string replacement clearer [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/abdb656315bd4457c7ae43aaa52e2357df85d139)
-- :bug::penguin::memo: Issue #1433: Cordova Push V5 register () crashes App when initialized with topicList [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1d5723c81ad7a1e9d76fdce22161e8e8aa8da262)
-- :bug::penguin: Issue #1421: Notification delay caused by icon bitmap timeout [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fb4b533f2b31daebc7ed57c16228458def3d2af9)
-- :memo: Issue #1442: CocoaPods support vs requirement [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5912b1ea911fbe3b45a3a47ed005b7048a487ba6)
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/67041a994d70fd3a04149003607b88947e8cc994)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7dea689ba17ebb901ee12da62801f051a99cc368)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ea92e039b1d7640b70ca94e5f8748e7d2abbf13a)
-- :pencil2: fixing error in CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/498bb038799bd687d8c492154bd3b34d72edd322)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/74aba315b4cbb1e06c902e76891bce5582cbe690)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e2f8a62c431af26c4d2fa487daa704067a088643)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cb9839740c4cbff5711224eed4b91b55aba77612)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1bef8b37ef7bc017571924edc9e05fe09cd25e29)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ca5c281897c664b0bd98097ec2fc8c19c33b2c63)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/170d7dd43fe047c6caf84ec0f59da6c2c0cdeb6f)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fa4e36606c965504dba609940a2acf24f74ed978)
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/af6c31933e3daedf6e5a7f046e971efcf65cc1ea)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/99742021c8c6c2cd860c40b01db6a3dc18095dbb)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ff14a71b5e365f5c93159e759f989a6bbe89b40a)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/92dca439e1b0a0750a7e466bace2c4cb3acd19d8)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4cbc1cb69203c5a0fab250bd49b99a398ce86558)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7075bc8206641aa6459cf6acc4fe447fb1d57f77)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d043c5f9d7872dc4340151c0645a24716391f58f)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f7a7c5c172190acab17fdfd54ad726a7a2fad701)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/15e68b03956a1dd292fda87e0da4f1ad9700d9c0)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/54aa482fb8af6ac15a60fb06090077e1d68dee6c)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1276d538b80106dd2f3d67996a531e64e7aa4937)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/504f2dcb5b158e0b2e151b255aad28a659bc2c4d)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/97f0aeaa1099b89076b28282b2d2daac7ec62b33)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e11d89f46572d1e4430f1f6a63945d74b56e574c)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fa66ac99685f1f2b580597a45b16315ab7748028)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c539b041cbe2a2b6e9a360a91ee2a9bfdfd16b03)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/dce5e9fb70e4df45a10fd8348a7def64864fdd24)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6f0182aff86b04c22630d1586d6ac6ca617c7e61)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/562a22f45bdafa4e2887996e9c0fa295b8bac886)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f1d14b2615d7c8330afbdbf0faa1d2438473a45d)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7e4c47b5c5647866f24e6c2f47e4c98a1f8e2442)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a02580e19d470919ec61ec489cdf4ee6ca2f0d8c)
-
-## [v1.10.3](https://github.com/phonegap/phonegap-plugin-push/tree/v1.10.3) (2017-20-04)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.10.2...v1.10.3)
-
-- 1.10.3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1e072b351056d453fd1c1d40d5fcac310f3e107c)
-- :bookmark: Bumping plugin version to 1.10.3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/29df66eae54e773925e25bd92299957e4d654723)
-- :bug: Handle null in getCircleBitmap (#1705) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3acdfa338d7a8b56ec4dc73c50aa9917ecb3be7c)
-- :shirt: Issue #1702: The logging tag can be at most 23 characters, was 40 (PushPlugin_BackgroundActionButtonHandler) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2045873acda2e81d54b2da87cd2d10f056bd90f9)
-- Shortened log tag PushPlugin_BackgroundActionButtonHandler to bring u… (#1703) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/dd707122b7aa78649fa6f5f73ba9b05436799926)
-- :memo: Docs for interoperability with Firebase (#1693) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cebb6403143047192462f30c22b9510a8c6dbe21)
-- fix headline (#1685) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e2e7993544eed544eb7286868b60e2e3efb6275d)
-- Fix changelog date [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3140b2b00388785f8056632376b50a1d1ef67b96)
-- :arrow_up: update pluginpub to 0.0.8 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cfab7d91556a38ee81550fe47e13f2662ae810db)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/027ea2c17e4b96b848ab29046efea243e6e2da27)
-
-## [v1.10.2](https://github.com/phonegap/phonegap-plugin-push/tree/v1.10.2) (2017-04-12)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.10.1...v1.10.2)
-
-- 1.10.2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b5a7d4ec6e64abaed65de00be3e9bac9ab25791e)
-- :bookmark: Bumping plugin version to 1.10.2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5b700ad9927c401081a5de49f2a6a27ba0dfaa9a)
-- :arrow_up: update pluginpub to 0.0.7 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/38564ce55e53e018c91f4063d680eedd2631b825)
-- Fix the dates on the CHANGELOG (the last 2 version) (#1676) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c0f26192c906bfc1a60390333c96d5dc07433978)
-- Vapid Support (#1675) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/384b60bade628035b21d23f07e284eb6e1557a10)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/97d618fb53084cfae78f397def48df791131358f)
-
-## [v1.10.1](https://github.com/phonegap/phonegap-plugin-push/tree/v1.10.1) (2017-04-07)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.10.0...v1.10.1)
-
-- 1.10.1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6211e8c3df8881a90d19b111a0e63f890d435df6)
-- :bookmark: Bumping plugin version to 1.10.1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6d710a06681ad84c13273fe5d20feb3033ac67b6)
-- :bug: Issue #1655: App opens on clearing notification (Android) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ff417925f6d6678f0fcd8315d5f4b4b08fbb9085)
-- :memo: Issue #1118: Problem with notifications stacking [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d669c44a863d86d0bb73b5ae086bc2fe6f8113a9)
-- :memo: Issue #1220: [Question] the hook setting seem not work [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4ef137eea370da7c225ab2a5cf63b1e97a68f4a4)
-- Set get badge count android (#1644) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/630907cf3d8802bcd5d91b6bd768c989f6ef897a)
-- Add plugin typings from DefinitelyTyped (#1654) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6ea70d9984e176a75602e72e1d26f5404c519e29)
-- :arrow_up: Issue #1560: setApplicationIconBadgeNumber not working on Android but firing success function [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/700701fd2151667905d860228cf954301186721a)
-- :memo: Issue #1618: No notification when app is closed on Android, not at all on iOS [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7f64bf0ffbddf3ef20de2fe540ec2718be5d0c23)
-- :arrow_down: Issue #1560: setApplicationIconBadgeNumber not working on Android but firing success function [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e450fd7b623f27f27858a7537ec7950aa0f618b5)
-- :arrow_up: Issue #1560: setApplicationIconBadgeNumber not working on Android but firing success function [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4af3472263a5125cab6f08bbb59b83bf957144ec)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ed25a3e3ad9fb6f2af63fd07957944f974eafaa1)
-
-## [v1.10.0](https://github.com/phonegap/phonegap-plugin-push/tree/v1.10.0) (2017-03-10)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.9.4...v1.10.0)
-
-- 1.10.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6b9b862da8566c7717dfc79dd6b32d8a7e6774d8)
-- :bookmark: Bumping plugin version to 1.10.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/626e9615fbff6ea225569ab58353ac7f58aef495)
-- :heavy_plus_sign: update pluginpub version [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c3c8058ffee888447017eb5d8c0f4f30cbcd090f)
-- Issue #1464: Create round bitmap icon for large icon image passed in from local resource or url (#1635) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/0dd0d468868f0b13c8d840c78dd89fca5920cd32)
-- Receive notification only from SENDER_ID (#1484) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a0d51e54aac39b8c58e4c67080f174c0228947c9)
-- Add no-cache flag to payload (#1620) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/42f8cefbd187c36534e6ab59b6611fb7f15b91f0)
-- Add dismiss key to on notification data (#1621) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4259bb3cacfe2561ed44e9f16bd74f8d5ae45ae2)
-- return true for old android versions, since AppOpsManager is available starting at 19 (#1634) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/945aa2ad6d266e82683e0bee86f53d258f2b31b6)
-- :art: remove reference to unused String [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/75f2191632a7a51eda7510a172ae6cc9d477acb9)
-- Ability to use custom keys to find message title and text on Android (#1604) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fd366296773906c91d5f8dfa3e8ba813c7c71b85)
-- :memo: Fixed URL of apples custom sound documentation (#1600) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8c93f8622eb1c453cb0c681158a07deca32bf200)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/409020c90edf04e0a37232cff8aadb070d4ccaa9)
-
-## [v1.9.4](https://github.com/phonegap/phonegap-plugin-push/tree/v1.9.4) (2016-07-09)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.9.3...v1.9.4)
-
-- 1.9.4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2241c7431cd60a68d2f35e7b4a5bfd797d5161b6)
-- Bumping plugin version to 1.9.4 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ec47932bf8fdf9cd96db076fe56306ab230048d9)
-- Issue #1591: App crashes with the latest updates of Android SDK with plugin v-1.9.2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/514c21366ab37001ca323bec58261e023edaefd7)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3a218e4c68ebc1088461c2cfec966e57eaa24089)
-
-## [v1.9.3](https://github.com/phonegap/phonegap-plugin-push/tree/v1.9.3) (2016-07-09)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.9.2...v1.9.3)
-
-- 1.9.3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/42723d6609862aa950abce67b2a637736bdd9e99)
-- :bookmark: Bumping plugin version to 1.9.3 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8f7b7dc003a2bc5bab7a316b0e2b0cf475c5a449)
-- :wrench: Add valid SPDX license expression [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/4274d0759acd7110ed2592ed1d2ce3bf692711d3)
-- :memo: Issue #1587: v2.0.0-rc2: .on('notification') event not fired when background notification in Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7e90853a09a2c49f29e12eed03977b08b1295387)
-- :arrow_up: Issue #1560: setApplicationIconBadgeNumber not working on Android but firing success function [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/3188a3907f50dcf625b7663ecf74ea9a9209d437)
-- :memo: Issue #1557: push.on('notification') not triggered - Ionic [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b91e9420fb68c4efc943cc5f8ecbd81274ffcbec)
-- :memo: Issue #1407: Uncaught (in promise): Error: Push plugin not found! [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/adf3eabb8871980d2dead7ecb8185ad0da1d6b46)
-- Corrected merges usage to prevent possible conflicts with other plugins (#1538) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/00c67cb2c85e97dfe4f7020f28ad4d954458599f)
-- :penguin: android mixpanel pushnotification suport added (#1523) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/951cb6921a717d847c279ad6896c28772c70103f)
-- :memo: Making string replacement clearer [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/abdb656315bd4457c7ae43aaa52e2357df85d139)
-- :bug::penguin::memo: Issue #1433: Cordova Push V5 register () crashes App when initialized with topicList [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1d5723c81ad7a1e9d76fdce22161e8e8aa8da262)
-- :bug::penguin: Issue #1421: Notification delay caused by icon bitmap timeout [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fb4b533f2b31daebc7ed57c16228458def3d2af9)
-- :memo: Issue #1442: CocoaPods support vs requirement [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5912b1ea911fbe3b45a3a47ed005b7048a487ba6)
-- make google_app_id non translatable string (#1485) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d9890fa52ecdb41b344f06f1dd081d05ea784bea)
-- :penguin::bug: Issue #1474: Android: force-start starts the app in Foreground instead of Background [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2bb5f53a8478353ed1f5f97756adff336fb9a710)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e02ff6703a53cb18e53060e2d7f6f64ebc8588b6)
-
-## [v2.0.0-rc2](https://github.com/phonegap/phonegap-plugin-push/tree/v2.0.0-rc2) (2016-07-09)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v2.0.0-rc1...v2.0.0-rc2)
-
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/67041a994d70fd3a04149003607b88947e8cc994)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7dea689ba17ebb901ee12da62801f051a99cc368)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ea92e039b1d7640b70ca94e5f8748e7d2abbf13a)
-- :pencil2: fixing error in CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/498bb038799bd687d8c492154bd3b34d72edd322)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/74aba315b4cbb1e06c902e76891bce5582cbe690)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e2f8a62c431af26c4d2fa487daa704067a088643)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cb9839740c4cbff5711224eed4b91b55aba77612)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1bef8b37ef7bc017571924edc9e05fe09cd25e29)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ca5c281897c664b0bd98097ec2fc8c19c33b2c63)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/170d7dd43fe047c6caf84ec0f59da6c2c0cdeb6f)
-
-## [v2.0.0-rc1](https://github.com/phonegap/phonegap-plugin-push/tree/v2.0.0-rc1) (2016-07-09)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.9.1...v2.0.0-rc1)
-
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/46a44f92ca8f94c991a564a5a8ff1e424c4b7f7f)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b952330124ab76d6a8ec88ebdb7eac0a614f8c38)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6ec1beb2ab13d6333122b76122ae4eb2e60dfb55)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fab033596c66ee1c9594d404fec8473a4dd41e77)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/07f28d8dbc477faeb2a8dd8997fde0d088dd191a)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ba16ce363a198edd0d190e9603a5e1363289a893)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a47af30d32c6921b484c1c129cd60582e1b3047b)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c9f4a5d6d6f18082ae9e5a533a700cf3662c2739)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/368f6cbb8095fd742bb39308e02fac7f89379f18)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a3e0eefe09359612d6757d4598eba69e3d68a96b)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d6d527628f8811ab6781591b3c186ce2732c9f37)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/26b0369f148976e4227f73f5883658a726f825dd)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b4d850028b088c38bbd11c1899e28ea69b1c391e)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/417be691c8131f006a7f1bd49bc171faa36ee872)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e34ddc03b01e676382a6d70e1e750a4e64ca6d62)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/732a2bd8efbfbea696db6951439e2472d6dc8e6f)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8d44ccfdfe91831140e4e972d6879b6330a1c613)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a18d50324ab96945db382539ce2ed7a287bed840)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/72875ac0aef0f9d00de6413e0dea4d7533c5eaef)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2bd37d1b31ca0b2c76c89a04a803b22186d1f8ad)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fda1f905c4364a3ac100486dc639fdd5c3bae9ca)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b6acbfeacf851bab256962616ba2bd93150982ba)
-- :memo: Issue #1235: SecurityError: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5241a6f3868b4b15f79c6d5c0b5b5ea45e6301f9)
-- :memo: Issue #1415: What is the id in push.finish? [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2660b51da66e791ff342d027ea6afa4313281e28)
-- :memo: Issue #1420: Update PLATFORM_SUPPORT.md [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/60ad23affaf2dc4c9c2bf48b6cbb702b0217aeb7)
-- :memo: Adding more emoji for commit messages [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/eb6b7b7d52770769719392b9b5226ee9a7caef75)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f38fd3d4d9f5f4f8de602b6aa07089b706884ca5)
-
-## [v2.0.0-rc2](https://github.com/phonegap/phonegap-plugin-push/tree/v2.0.0-rc2) (2016-07-09)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v2.0.0-rc1...v2.0.0-rc2)
-
-- 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/67041a994d70fd3a04149003607b88947e8cc994)
-- Bumping plugin version to 2.0.0-rc2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/7dea689ba17ebb901ee12da62801f051a99cc368)
-- :apple::bug: Issue #1497: App crashes after refreshing when using FCM (v2) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ea92e039b1d7640b70ca94e5f8748e7d2abbf13a)
-- :pencil2: fixing error in CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/498bb038799bd687d8c492154bd3b34d72edd322)
-- :memo: Using a newer version on the examples [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/74aba315b4cbb1e06c902e76891bce5582cbe690)
-- :penguin::memo::bug: Issue #1470: Cannot install phonegap-plugin-push on master [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e2f8a62c431af26c4d2fa487daa704067a088643)
-- :bug::apple::wrench: Fixing a merge issue where aps-environment was accidentally removed [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/cb9839740c4cbff5711224eed4b91b55aba77612)
-- :bug::penguin::memo::arrow_up: #1460: Build Issue Android [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/1bef8b37ef7bc017571924edc9e05fe09cd25e29)
-- :bug::apple: Issue #1461: App crashes when initialising with topics (v2.0.0-rc1) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ca5c281897c664b0bd98097ec2fc8c19c33b2c63)
-- Fixing my merge error for PR #1378 Optional event emit instead of function call for action buttons [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/170d7dd43fe047c6caf84ec0f59da6c2c0cdeb6f)
-
-## [v2.0.0-rc1](https://github.com/phonegap/phonegap-plugin-push/tree/v2.0.0-rc1) (2016-07-09)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.9.1...v2.0.0-rc1)
-
-- 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/46a44f92ca8f94c991a564a5a8ff1e424c4b7f7f)
-- :bookmark: Bumping plugin version to 2.0.0-rc1 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b952330124ab76d6a8ec88ebdb7eac0a614f8c38)
-- :wrench: add tern to gitignore [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/6ec1beb2ab13d6333122b76122ae4eb2e60dfb55)
-- :hammer::wrench::arrow_up: Use Babel to transpile ES2015 code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fab033596c66ee1c9594d404fec8473a4dd41e77)
-- :wrench: Add browser platform back for FCM branch [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/07f28d8dbc477faeb2a8dd8997fde0d088dd191a)
-- Pin FCM to 9.8.0 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ba16ce363a198edd0d190e9603a5e1363289a893)
-- Add empty google services plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a47af30d32c6921b484c1c129cd60582e1b3047b)
-- :bug: Issue #1188: Strings.xml google_app_id conflict with google-services.json [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/c9f4a5d6d6f18082ae9e5a533a700cf3662c2739)
-- :memo: Update to using fcm-node [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/368f6cbb8095fd742bb39308e02fac7f89379f18)
-- Issue #689: Remove sender id from PushNotification init iOS options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a3e0eefe09359612d6757d4598eba69e3d68a96b)
-- Issue #689: Remove sender id from PushNotification init Android options [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/d6d527628f8811ab6781591b3c186ce2732c9f37)
-- Refactor GCMIntentService to FCMService [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/26b0369f148976e4227f73f5883658a726f825dd)
-- Fix topic subscription and unsubscription on FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b4d850028b088c38bbd11c1899e28ea69b1c391e)
-- Fix rebase errors [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/417be691c8131f006a7f1bd49bc171faa36ee872)
-- Use CocoaPods [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e34ddc03b01e676382a6d70e1e750a4e64ca6d62)
-- fixed registration and removed unused code [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/732a2bd8efbfbea696db6951439e2472d6dc8e6f)
-- Added hook and resource file to copy GoogleService-Info.plist [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/8d44ccfdfe91831140e4e972d6879b6330a1c613)
-- Changed code to work with FCM [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/a18d50324ab96945db382539ce2ed7a287bed840)
-- Added .framework files as custom frameworks [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/72875ac0aef0f9d00de6413e0dea4d7533c5eaef)
-- Removed GCM files and added FCM files [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2bd37d1b31ca0b2c76c89a04a803b22186d1f8ad)
-- Fixed empty token on android first run (#1008) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/fda1f905c4364a3ac100486dc639fdd5c3bae9ca)
-- Added partial Android FCM support (#975) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/b6acbfeacf851bab256962616ba2bd93150982ba)
-- :memo: Issue #1235: SecurityError: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/5241a6f3868b4b15f79c6d5c0b5b5ea45e6301f9)
-- :memo: Issue #1415: What is the id in push.finish? [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/2660b51da66e791ff342d027ea6afa4313281e28)
-- :memo: Issue #1420: Update PLATFORM_SUPPORT.md [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/60ad23affaf2dc4c9c2bf48b6cbb702b0217aeb7)
-- :memo: Adding more emoji for commit messages [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/eb6b7b7d52770769719392b9b5226ee9a7caef75)
-- Updating CHANGELOG [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/f38fd3d4d9f5f4f8de602b6aa07089b706884ca5)
-
-## [v1.9.2](https://github.com/phonegap/phonegap-plugin-push/tree/v1.9.2) (2016-07-09)
-[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.9.1...v1.9.2)
-
-- 1.9.2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/ef3de3281205b1fd56c57c71db31dc06a95da7a9)
-- :bookmark: Bumping plugin version to 1.9.2 [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/24650bad4db49525505e9a2624ff1b5500e6b3ef)
-- Optional event emit instead of function call for action buttons (#1378) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/e92e951e759fe64d17d01e152575b6262973380a)
-- Ensures foreground is true when inline is set to true and Android version is earlier than N (#1459) [view commit](http://github.com/phonegap/phonegap-plugin-push/commit/dd61ec34c0ca5c3fadf6797a8e192b9343324f68)
-
## [v1.9.1](https://github.com/phonegap/phonegap-plugin-push/tree/v1.9.1) (2016-07-09)
[Full Changelog](https://github.com/phonegap/phonegap-plugin-push/compare/v1.9.0...v1.9.1)
diff --git a/StoneIsland/plugins/phonegap-plugin-push/MIT-LICENSE b/StoneIsland/plugins/phonegap-plugin-push/MIT-LICENSE
index abf9a980..a017eb00 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/MIT-LICENSE
+++ b/StoneIsland/plugins/phonegap-plugin-push/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright 2012-2017 Adobe Systems
+Copyright 2012-2016 Adobe Systems
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/StoneIsland/plugins/phonegap-plugin-push/README.md b/StoneIsland/plugins/phonegap-plugin-push/README.md
index 93c2b1eb..8f9ff5e9 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/README.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/README.md
@@ -1,16 +1,12 @@
-# phonegap-plugin-push [![Build Status](https://travis-ci.org/phonegap/phonegap-plugin-push.svg)](https://travis-ci.org/phonegap/phonegap-plugin-push)
+#phonegap-plugin-push [![Build Status](https://travis-ci.org/phonegap/phonegap-plugin-push.svg)](https://travis-ci.org/phonegap/phonegap-plugin-push)
> Register and receive push notifications
-# Warning
-
-The links below take you to the version 2.x documentation which includes a number of breaking API changes from version 1.x, mostly the move from GCM to FCM. If you are using version 1.x please reference the docs in the [v1.x branch](https://github.com/phonegap/phonegap-plugin-push/tree/v1.x).
-
# What is this?
-This plugin offers support to receive and handle native push notifications with a **single unified API**.
+This plugin offers support to receive and handle native push notifications with a **single unified API**.
-Starting with version `2.0.0`, this plugin will support `CocoaPods` installation of the `Firebase Cloud Messaging` library. More details are available in the [Installation](docs/INSTALLATION.md#cocoapods) documentation.
+Starting with version `1.9.0`, this plugin will support `CocoaPods` installation of the `Google Cloud Messaging` library. More details are available in the [Installation](docs/INSTALLATION.md#cocoapods) documentation.
- [Reporting Issues](docs/ISSUES.md)
- [Installation](docs/INSTALLATION.md)
diff --git a/StoneIsland/plugins/phonegap-plugin-push/docs/API.md b/StoneIsland/plugins/phonegap-plugin-push/docs/API.md
index 866fd28c..e0481af8 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/docs/API.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/docs/API.md
@@ -11,7 +11,7 @@
- [push.subscribe()](#pushsubscribetopic-successhandler-errorhandler)
- [push.unsubscribe()](#pushunsubscribetopic-successhandler-errorhandler)
- [push.setApplicationIconBadgeNumber() - iOS & Android only](#pushsetapplicationiconbadgenumbersuccesshandler-errorhandler-count---ios--android-only)
-- [push.getApplicationIconBadgeNumber() - iOS & Android only](#pushgetapplicationiconbadgenumbersuccesshandler-errorhandler---ios--android-only)
+- [push.getApplicationIconBadgeNumber() - iOS only](#pushgetapplicationiconbadgenumbersuccesshandler-errorhandler---ios-only)
- [push.finish() - iOS only](#pushfinishsuccesshandler-errorhandler-id---ios-only)
- [push.clearAllNotifications() - iOS & Android only](#pushclearallnotificationssuccesshandler-errorhandler---ios--android-only)
@@ -39,6 +39,7 @@ All available option attributes are described bellow. Currently, there are no Wi
Attribute | Type | Default | Description
--------- | ---- | ------- | -----------
+`android.senderID` | `string` | | Maps to the project number in the Google Developer Console.
`android.icon` | `string` | | Optional. The name of a drawable resource to use as the small-icon. The name should not include the extension.
`android.iconColor` | `string` | | Optional. Sets the background color of the small icon on Android 5.0 and greater. [Supported Formats](http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String))
`android.sound` | `boolean` | `true` | Optional. If `true` it plays the sound specified in the push data or the default system sound.
@@ -46,16 +47,13 @@ Attribute | Type | Default | Description
`android.clearBadge` | `boolean` | `false` | Optional. If `true` the icon badge will be cleared on init and before push messages are processed.
`android.clearNotifications` | `boolean` | `true` | Optional. If `true` the app clears all pending notifications when it is closed.
`android.forceShow` | `boolean` | `false` | Optional. Controls the behavior of the notification when app is in foreground. If `true` and app is in foreground, it will show a notification in the notification drawer, the same way as when the app is in background (and `on('notification')` callback will be called *only when the user clicks the notification*). When `false` and app is in foreground, the `on('notification')` callback will be called immediately.
-`android.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a FcmPubSub topic.
-`android.messageKey` | `string` | `message` | Optional. The key to search for text of notification.
-`android.titleKey` | `string` | `'title'` | Optional. The key to search for title of notification.
+`android.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic.
#### Browser
Attribute | Type | Default | Description
--------- | ---- | ------- | -----------
`browser.pushServiceURL` | `string` | `http://push.api.phonegap.com/v1/push` | Optional. URL for the push server you want to use.
-`browser.applicationServerKey` | `string` | `` | Optional. Your GCM API key if you are using VAPID keys.
#### iOS
@@ -75,9 +73,9 @@ The following properties are used if you want use GCM on iOS.
Attribute | Type | Default | Description
--------- | ---- | ------- | -----------
-`ios.fcmSandbox` | `boolean` | `false` | Whether to use prod or sandbox GCM setting. Defaults to false.
-options
-`ios.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a FcmPubSub topic.
+`ios.senderID` | `string` | `undefined` (Native) | Maps to the project number in the Google Developer Console. Setting this uses GCM for notifications instead of native
+`ios.gcmSandbox` | `boolean` | `false` | Whether to use prod or sandbox GCM setting. Defaults to false.
+`ios.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic. Note: only usable in conjunction with `senderID`.
##### How GCM on iOS works.
@@ -87,12 +85,12 @@ What happens is on the device side is that it registers with APNS, then that reg
When you send a message to GCM using that ID, what it does is look up the APNS registration ID on it's side and forward the message you sent to GCM on to APSN to deliver to your iOS device.
-Make sure that the certificate you build with matches your `fcmSandbox` value.
+Make sure that the certificate you build with matches your `gcmSandbox` value.
-- If you build your app as development and set `fcmSandbox: false` it will fail.
-- If you build your app as production and set `fcmSandbox: true` it will fail.
-- If you build your app as development and set `fcmSandbox: true` but haven't uploaded the development certs to Google it will fail.
-- If you build your app as production and set `fcmSandbox: false` but haven't uploaded the production certs to Google it will fail.
+- If you build your app as development and set `gcmSandbox: false` it will fail.
+- If you build your app as production and set `gcmSandbox: true` it will fail.
+- If you build your app as development and set `gcmSandbox: true` but haven't uploaded the development certs to Google it will fail.
+- If you build your app as production and set `gcmSandbox: false` but haven't uploaded the production certs to Google it will fail.
> Note: The integration between GCM and APNS is a bit finicky. Personally, I feel it is much better to send pushes to Android using GCM and pushes to iOS using APNS which this plugin does support.
@@ -101,6 +99,7 @@ Make sure that the certificate you build with matches your `fcmSandbox` value.
```javascript
var push = PushNotification.init({
android: {
+ senderID: "12345679"
},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
@@ -160,14 +159,12 @@ The event `registration` will be triggered on each successful registration with
Parameter | Type | Description
--------- | ---- | -----------
`data.registrationId` | `string` | The registration ID provided by the 3rd party remote push service.
-`data.registrationType` | `string` | The registration type of the 3rd party remote push service. Either FCM or APNS.
### Example
```javascript
push.on('registration', function(data) {
- console.log(data.registrationId);
- console.log(data.registrationType);
+ console.log(data.registrationId);
});
```
@@ -206,7 +203,6 @@ Parameter | Type | Description
`data.additionalData` | `Object` | An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
`data.additionalData.foreground` | `boolean` | Whether the notification was received while the app was in the foreground
`data.additionalData.coldstart` | `boolean` | Will be `true` if the application is started by clicking on the push notification, `false` if the app is already started.
-`data.additionalData.dismissed` | `boolean` | Is set to `true` if the notification was dismissed by the user
### Example
@@ -356,7 +352,7 @@ push.setApplicationIconBadgeNumber(function() {
}, 2);
```
-## push.getApplicationIconBadgeNumber(successHandler, errorHandler) - iOS & Android only
+## push.getApplicationIconBadgeNumber(successHandler, errorHandler) - iOS only
Get the current badge count visible when the app is not running
diff --git a/StoneIsland/plugins/phonegap-plugin-push/docs/EXAMPLES.md b/StoneIsland/plugins/phonegap-plugin-push/docs/EXAMPLES.md
index 32bc2e5f..8481e7bc 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/docs/EXAMPLES.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/docs/EXAMPLES.md
@@ -11,6 +11,7 @@ phonegap create my-app --template phonegap-template-push
```javascript
var push = PushNotification.init({
android: {
+ senderID: "12345679"
},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
diff --git a/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md b/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md
index ea8f6918..830bbdd7 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/docs/INSTALLATION.md
@@ -4,7 +4,6 @@
- [Android details](#android-details)
- [Compilation](#compilation)
- [Co-existing with Facebook Plugin](#co-existing-with-facebook-plugin)
- - [Co-existing with plugins that use Firebase](#co-existing-with-plugins-that-use-firebase)
- [Common errors](#common-errors)
- [minSdkVersion === 14](#minsdkversion--14)
- [Multidex](#multidex)
@@ -17,65 +16,52 @@
- [Bitcode](#bitcode)
- [CocoaPods](#cocoapods)
- [Common CocoaPod Installation issues](#common-cocoapod-installation-issues)
- - [CocoaPod Disk Space](#cocoapod-disk-space)
- - [Library not found for -lPods-Appname](#library-not-found-for--lPods-Appname)
- - [Library not found for -lGoogleToolboxForMac](#library-not-found-for--lPods-Appname)
- [Additional Resources](#additional-resources)
## Installation Requirements
Plugin version | Cordova CLI | Cordova Android | Cordova iOS | CocoaPods
---- | ---- | ---- | ---- | ----
-2.0.0 | 7.0.0 | 6.2.1 | 4.4.0 | 1.1.1
1.9.0 | 6.4.0 | 6.0.0 | 4.3.0 | 1.1.1
1.8.0 | 3.6.3 | 4.0.0 | 4.1.0 | N/A
To install from the command line:
```
-phonegap plugin add phonegap-plugin-push
+phonegap plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
```
or
```
-cordova plugin add phonegap-plugin-push
+cordova plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
```
It is also possible to install via repo url directly ( unstable )
```
-phonegap plugin add https://github.com/phonegap/phonegap-plugin-push
+phonegap plugin add https://github.com/phonegap/phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
```
or
```
-cordova plugin add https://github.com/phonegap/phonegap-plugin-push
+cordova plugin add https://github.com/phonegap/phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
```
-As of version 2.0.0 the SENDER_ID parameter has been removed at install time. Instead you put your google-services.json (Android) and/or GoogleService-Info.plist in the root folder of your project and then add the following lines into your config.xml.
+Where the `XXXXXXX` in `SENDER_ID="XXXXXXX"` maps to the project number in the [Google Developer Console](https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwikqt3nyPjMAhXJ5iYKHR0qDcsQFggbMAA&url=https%3A%2F%2Fconsole.developers.google.com%2F&usg=AFQjCNF0eH059mv86nMIlRmfsf42kde-wA&sig2=BQ2BJpchw1CpGt87sk5p6w&bvm=bv.122852650,d.eWE). To find the project number login to the Google Developer Console, select your project and click the menu item in the screen shot below to display your project number.
-In the platform tag for Android add the resource-file tag:
+![zzns8](https://cloud.githubusercontent.com/assets/353180/15588897/2fc14db2-235e-11e6-9326-f97fe0ec15ab.png)
-```
-<platform name="android">
- <resource-file src="google-services.json" target="google-services.json" />
-</platform>
-```
-
-In the platform tag for iOS add the resource-file tag:
-
-```
-<platform name="ios">
- <resource-file src="GoogleService-Info.plist" />
-</platform>
-```
+If you are not creating an Android application you can put in anything for this value.
> Note: if you are using Ionic you may need to specify the SENDER_ID variable in your package.json.
```
"cordovaPlugins": [
{
+ "variables": {
+ "SENDER_ID": "XXXXXXX"
+ },
"locator": "phonegap-plugin-push"
}
]
@@ -84,17 +70,23 @@ In the platform tag for iOS add the resource-file tag:
> Note: You need to specify the SENDER_ID variable in your config.xml if you plan on installing/restoring plugins using the prepare method. The prepare method will skip installing the plugin otherwise.
```
-<plugin name="phonegap-plugin-push" spec="2.0.0" />
+<plugin name="phonegap-plugin-push" spec="1.6.0">
+ <param name="SENDER_ID" value="XXXXXXX" />
+</plugin>
```
## Android details
### Compilation
-As of version 2.0.0 the plugin has been switched to using pinned version of Gradle libraries. You will need to ensure that you have installed the following items through the Android SDK Manager:
+As of version 1.3.0 the plugin has been switched to using Gradle/Maven for building.
+
+You will need to ensure that you have installed the following items through the Android SDK Manager:
-- Android Support Library version 25.1.0
-- FirebaseMessaging Library version 9.8.0
+- Android Support Library version 23 or greater
+- Local Maven repository for Support Libraries (formerly Android Support Repository) version 20 or greater
+- Google Play Services version 27 or greater
+- Google Repository version 22 or greater
![android support library](https://cloud.githubusercontent.com/assets/353180/10230226/0627931e-684a-11e5-9a6b-72d72997f655.png)
@@ -121,30 +113,6 @@ or
cordova plugin add --save cordova-plugin-facebook4 --variable APP_ID="App ID" --variable APP_NAME="App Name"
```
-### Co-existing with plugins that use Firebase
-
-Problems may arise when push plugin is used along plugins that implement Firebase functionality (cordova-plugin-firebase-analytics, for example). Firebase uses `@string/google_app_id`, as does the push plugin, though the value format differs, causing problems like this: `Invalid google_app_id. Firebase Analytics disabled`.
-
-To make the two work together, you need to migrate your GCM project from Google console to Firebase console:
-
-1) In Firebase console - [import your existing GCM project](https://firebase.google.com/support/guides/google-android#migrate_your_console_project), don't create a new one.
-2) Set your `SENDER_ID` variable to match the id of your imported Firebase project. In case of cordova, your `config.xml` would look something like this:
-```xml
-<plugin name="phonegap-plugin-push" spec="~1.10.0">
- <variable name="SENDER_ID" value="1:956432534015:android:df201d13e7261425" />
-</plugin>
-```
-3) In your JavaScript, when you init the PushPlugin, senderID remains the same format as before:
-```javascript
-PushNotification.init({
- android: {
- senderID: 956432534015
- }
-});
-```
-
-*Note:* No changes on the back-end side are needed: [even though recommended](https://developers.google.com/cloud-messaging/android/android-migrate-fcm#update_server_endpoints), it isn't yet required and sending messages through GCM gateway should work just fine.
-
### Common errors
#### minSdkVersion === 14
@@ -255,21 +223,11 @@ cordova platform update ios@4.0.0
### CocoaPods
-Required `cordova-cli` minimum version: `6.4.0`
-
-Required `cordova-ios` minimum version: `4.3.0`
-
-Required `CocoaPods` minimum version: `1.0.1`
+Required `cordova-cli` version: `6.4.0`
+Required `cordova-ios` version: `4.3.0`
-To install CocoaPods, please follow the installation instructions [here](https://guides.cocoapods.org/using/getting-started). After installing CocoaPods, please run:
-
- pod setup
-
-This will clone the required CocoaPods specs-repo into your home folder at `~/.cocoapods/repos`, so it might take a while. See the [CocoaPod Disk Space](#cocoapod-disk-space) section below for more information.
-
-
-Version `2.0.0` (and above) of this plugin supports [CocoaPods](https://cocoapods.org) installation of the [Firebase Cloud Messaging](https://cocoapods.org/pods/FirebaseMessaging) library.
+Version `1.9.0` (and above) of this plugin supports [CocoaPods](https://cocoapods.org) installation of the [Google Cloud Messaging](https://cocoapods.org/pods/GoogleCloudMessaging) library.
If you are installing this plugin using `npm`, and you are using version `6.1.0` or greater of the `cordova-cli`, it will automatically download the right version of this plugin for both your platform and cli.
@@ -297,55 +255,59 @@ Failed to install 'phonegap-plugin-push':Error: pod: Command failed with exit co
Error: pod: Command failed with exit code 1
```
-Please run the command `pod repo update` and re-install the plugin. You would only run `pod repo update` if you have the specs-repo already cloned on your machine through `pod setup`.
-
-##### CocoaPod Disk Space
-
-Running `pod setup` can take over 1 GB of disk space and that can take quite some time to download over a slow internet connection. If you are having issues with disk space/network try this neat hack from @VinceOPS.
+Please run the command `pod repo update` and re-install the plugin.
-```
-git clone --verbose --depth=1 https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master
-pod setup --verbose
-```
+## Additional Resources
-##### Library not found for -lPods-Appname
+The push plugin enables you to play sounds and display different icons during push (Android only). These additional resources need to be added to your projects `platforms` directory in order for them to be included into your final application binary. One way of doing it is to create a hook to do the copying for you on each build.
-If you open the app in Xcode and you get an error like:
+First create a `scripts` directory in the root of your project. Next add a file to the scripts directory called `copy_resource_files.js`. The contents of the file will look something like this:
-```
-ld: library not found for -lPods-Appname
-clang: error: linker command failed with exit code 1
-```
+```javascript
+#!/usr/bin/env node
-Then you are opening the .xcodeproj file when you should be opening the .xcworkspace file.
+// each object in the array consists of a key which refers to the source and
+// the value which is the destination.
+var filestocopy = [{
+ "resources/android/images/logo.png":
+ "platforms/android/res/drawable/logo.png"
+}, {
+ "resources/android/sounds/ring.mp3":
+ "platforms/android/res/raw/ring.mp3"
+}, {
+ "resources/ios/sounds/ring.caf":
+ "platforms/ios/YourAppName/ring.caf"
+}, ];
-##### Library not found for -lGoogleToolboxForMac
+var fs = require('fs');
+var path = require('path');
-Trying to build for iOS using the latest cocoapods (1.2.1) but failed with the following error (from terminal running cordova build ios):
+// no need to configure below
+var rootdir = process.argv[2];
+filestocopy.forEach(function(obj) {
+ Object.keys(obj).forEach(function(key) {
+ var val = obj[key];
+ var srcfile = path.join(rootdir, key);
+ var destfile = path.join(rootdir, val);
+ //console.log("copying "+srcfile+" to "+destfile);
+ var destdir = path.dirname(destfile);
+ if (fs.existsSync(srcfile) && fs.existsSync(destdir)) {
+ fs.createReadStream(srcfile).pipe(
+ fs.createWriteStream(destfile));
+ }
+ });
+});
```
-ld: library not found for -lGoogleToolboxForMac
-```
-
-Workarounds are to add the platform first and install the plugins later, or to manually run pod install on projectName/platforms/ios.
-## Additional Resources
-
-The push plugin enables you to play sounds and display different icons during push (Android only). These additional resources need to be added to your projects `platforms` directory in order for them to be included into your final application binary.
+Obviously, you'll need to modify the `filestocopy` variable to suit your needs. Pay attention to the destination path on iOS where you will need to replace `YourAppName`.
-You can now use the `resource-file` tag to deliver the image and sound files to your application. For example if you wanted to include an extra image file for only your Android build you would add the `resource-file` tag to your android `platform` tag:
+Next open up your `config.xml` file and add the following line:
+```xml
+<hook type="before_build" src="scripts/copy_resource_files.js" />
```
-<platform name="android">
- <resource-file src="myImage.png" target="res/drawable/myImage.png" />
-</platform>
-```
-
-or if you wanted to include a sound file for iOS:
+Now, when you build your app the files will get copied into your platforms directory for you.
-```
-<platform name="ios">
- <resource-file src="mySound.caf" />
-</platform>
-```
+If you are using PhoneGap Build check out these instructions on [Additional Resources](PHONEGAP_BUILD.md#additional-resources)
diff --git a/StoneIsland/plugins/phonegap-plugin-push/docs/PAYLOAD.md b/StoneIsland/plugins/phonegap-plugin-push/docs/PAYLOAD.md
index 431b5a4e..b446612e 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/docs/PAYLOAD.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/docs/PAYLOAD.md
@@ -3,7 +3,6 @@
- [Background Events](#push-message-arrives-with-app-in-background)
- [Tap Events](#user-clicks-on-notification-in-notification-center)
- [Android Behaviour](#android-behaviour)
- - [Notification vs Data Payloads](#notification-vs-data-payloads)
- [Localization](#localization)
- [Images](#images)
- [Sound](#sound)
@@ -16,14 +15,12 @@
- [Priority in Notifications](#priority-in-notifications)
- [Picture Messages](#picture-messages)
- [Background Notifications](#background-notifications)
- - [Use of content_available: true](#use-of-content-available-true)
- - [Caching](#caching)
+ - [Use of content-available: true](#use-of-content-available-true)
- [Huawei and Xiaomi Phones](#huawei-and-xiaomi-phones)
- [Application force closed](#application-force-closed)
- [Visibility](#visibility-of-notifications)
- [Badges](#badges)
- [Support for Twilio Notify](#support-for-twilio-notify)
- - [Notification ID](#notification-id)
- [iOS Behaviour](#ios-behaviour)
- [Sound](#sound-1)
- [Background Notifications](#background-notifications-1)
@@ -70,66 +67,6 @@ Some ways to handle this *double* event are:
# Android Behaviour
-## Notification vs Data Payloads
-
-Notifications behave differently depending on the foreground/background state of the receiving app and the payload you send to the app.
-
-For instance if you send the following payload:
-
-```
-{
- "notification": {
- "title": "Test Notification",
- "body": "This offer expires at 11:30 or whatever",
- "notId": 10
- }
-}
-```
-
-When your app is in the foreground any `on('notification')` handlers you have registered will be called. However if your app is in the background the notification will show up in the system tray. Clicking on the notification in the system tray will start the app but your `on('notification')` handler will not be called as messages with only `notification` payloads will not cause the plugins `onMessageReceived` method to be called.
-
-If you send a payload with a mix of `notification` & `data` objects like this:
-
-```
-{
- "notification": {
- "title": "Test Notification",
- "body": "This offer expires at 11:30 or whatever",
- "notId": 10
- },
- "data" : {
- "surveyID": "ewtawgreg-gragrag-rgarhthgbad"
- }
-}
-```
-
-When your app is in the foreground any `on('notification')` handlers you have registered will be called. If your app is in the background the notification will show up in the system tray. Clicking on the notification in the system tray will start the app and your `on('notification')` handler will not be called as messages with only `notification` payloads will not cause the plugins `onMessageReceived` method to be called.
-
-My recommended format for your push payload when using this plugin (while it differs from Google's docs) works 100% of the time:
-
-```
-{
- "data" : {
- "title": "Test Notification",
- "body": "This offer expires at 11:30 or whatever",
- "notId": 10,
- "surveyID": "ewtawgreg-gragrag-rgarhthgbad"
- }
-}
-```
-
-When your app is in the foreground any `on('notification')` handlers you have registered will be called. If your app is in the background the notification will show up in the system tray. Clicking on the notification in the system tray will start the app and your `on('notification')` handler will be called and the event received by your `on('notification')` handler will get the following data:
-
-```
-{
- "message": "This offer expires at 11:30 or whatever",
- "title": "Test Notification",
- "additionalData": {
- "surveyID": "ewtawgreg-gragrag-rgarhthgbad"
- }
-}
-```
-
## Localization
Plugin supported localization from resources for: title, message and summaryText.
@@ -158,32 +95,22 @@ Or use localization with formatted constants.
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: {"locKey": "push_app_title"},
- message: 'Simple non-localizable text for message!'
- // Constant with formatted params
- // message: {"locKey": "push_message_fox", "locData": ["fox", "dog"]});
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', {"locKey": "push_app_title"});
+message.addData('message', 'Simple non-localizable text for message!');
+// Constant with formatted params
+// message.addData('message', {"locKey": "push_message_fox", "locData": ["fox", "dog"]});
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -202,8 +129,9 @@ By default the icon displayed in your push notification will be your apps icon.
```javascript
var push = PushNotification.init({
"android": {
+ "senderID": "12345679"
},
- "browser": {
+ browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
},
"ios": {
@@ -226,10 +154,11 @@ In order to get a better user experience you can specify an alternate icon and b
```javascript
var push = PushNotification.init({
"android": {
+ "senderID": "123456789",
"icon": "phonegap",
"iconColor": "blue"
},
- "browser": {
+ browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
},
"ios": {
@@ -241,8 +170,7 @@ var push = PushNotification.init({
});
```
-Where *icon* is the name of an `.png` image file in the Android `res/drawable` folder. For example: `platforms/android/res/drawable/phonegap.png`
-Writing a hook to describe how to copy an image to the Android `res/drawable` folder is out of scope for this README but there is an [excellent tutorial](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) that you can copy.
+Where *icon* is the name of an image in the Android *drawables* folder. Writing a hook to describe how to copy an image to the Android *drawables* folder is out of scope for this README but there is an [excellent tutorial](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) that you can copy.
*iconColor* is one of the supported formats #RRGGBB or #AARRGGBB or one of the following names: 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow', 'lightgray', 'darkgray', 'grey', 'lightgrey', 'darkgrey', 'aqua', 'fuchsia', 'lime', 'maroon', 'navy', 'olive', 'purple', 'silver', 'teal'. *iconColor* is supported on Android 5.0 and greater.
@@ -252,48 +180,38 @@ Please follow the [Android icon design guidelines](https://www.google.com/design
Additionally, each push can include a large icon which is used to personalize each push. The location of the image may one of three types.
-The first is the `res/drawable` folder in your app. This JSON sent from GCM:
+The first is the *drawables* folder in your app. This JSON sent from GCM:
```javascript
{
"registration_ids": ["my device id"],
"data": {
"title": "Large Icon",
- "message": "Loaded from drawable folder",
+ "message": "Loaded from drawables folder",
"image": "twitter"
}
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Large Icon',
- message: 'Loaded from drawables folder.',
- image: 'twitter'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Large Icon');
+message.addData('message', 'Loaded from drawables folder.');
+message.addData('image', 'twitter');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
-Would look for the *twitter* image in the `res/drawable` folder and produce the following notification.
+Would look for the *twitter* image in the drawables folder and produce the following notification.
![2015-07-24 02 34 41](https://cloud.githubusercontent.com/assets/353180/8866903/2df48028-3190-11e5-8176-fe8b3f7c5aab.png)
@@ -310,35 +228,25 @@ The second is the *assets* folder in your app. This JSON sent from GCM:
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Large Icon',
- message: 'Loaded from assets folder.',
- image: 'www/image/logo.png'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Large Icon');
+message.addData('message', 'Loaded from assets folder.');
+message.addData('image', 'www/image/logo.png');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
-Would look for the *logo.png* file in the assets/www/img folder. Since your apps www folder gets copied into the Android assets folder it is an excellent spot to store the images without needing to write a hook to copy them to the `res/drawable` folder. It produces the following notification.
+Would look for the *logo.png* file in the assets/www/img folder. Since your apps www folder gets copied into the Android assets folder it is an excellent spot to store the images without needing to write a hook to copy them to the *drawables* folder. It produces the following notification.
![2015-07-24 02 20 02](https://cloud.githubusercontent.com/assets/353180/8866901/2df19052-3190-11e5-8c16-a355c59209f3.png)
@@ -356,52 +264,6 @@ The third is the remote *URL*. This JSON sent from GCM:
}
```
-Here is an example using fcm-node that sends the above JSON:
-
-```javascript
-var FCM = require('fcm-node');
-// Replace these with your own values.
-var apiKey = "replace with API key";
-var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Large Icon',
- message: 'Loaded from URL',
- image: 'https://dl.dropboxusercontent.com/u/887989/antshot.png'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
-});
-```
-
-Produces the following notification.
-
-![2015-07-24 02 17 55](https://cloud.githubusercontent.com/assets/353180/8866900/2df0ab06-3190-11e5-9a81-fdb85bb0f5a4.png)
-
-Finally the Material UI guidelines recommend using a circular icon for the large icon if the subject of the image is a person. This JSON sent from GCM:
-
-```javascript
-{
- "registration_ids": ["my device id"],
- "data": {
- "title": "Large Circular Icon",
- "message": "Loaded from URL",
- "image": "https://pbs.twimg.com/profile_images/837060031895896065/VHIQ4oUf_400x400.jpg",
- "image-type": "circle"
- }
-}
-```
-
Here is an example using node-gcm that sends the above JSON:
```javascript
@@ -411,10 +273,9 @@ var apiKey = "replace with API key";
var deviceID = "my device id";
var service = new gcm.Sender(apiKey);
var message = new gcm.Message();
-message.addData('title', 'Large Circular Icon');
+message.addData('title', 'Large Icon');
message.addData('message', 'Loaded from URL');
-message.addData('image', 'https://pbs.twimg.com/profile_images/837060031895896065/VHIQ4oUf_400x400.jpg');
-message.addData('image-type', 'circular');
+message.addData('image', 'https://dl.dropboxusercontent.com/u/887989/antshot.png');
service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
if(err) console.error(err);
else console.log(response);
@@ -423,7 +284,7 @@ service.send(message, { registrationTokens: [ deviceID ] }, function (err, respo
Produces the following notification.
-![screenshot_20170308-214947](https://cloud.githubusercontent.com/assets/353180/23733917/902a4650-0449-11e7-924e-d45a38030c74.png)
+![2015-07-24 02 17 55](https://cloud.githubusercontent.com/assets/353180/8866900/2df0ab06-3190-11e5-9a81-fdb85bb0f5a4.png)
## Sound
@@ -478,31 +339,21 @@ In order for your your notification to play a custom sound you will need to add
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Sound Test',
- message: 'Loaded res/raw',
- soundname: 'test'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Sound Test');
+message.addData('message', 'Loaded res/raw');
+message.addData('soundname', 'test');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -524,30 +375,20 @@ If you want to see multiple notifications in the shade you will need to provide
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Test Push',
- message: 'Push number 1'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Test Push');
+message.addData('message', 'Push number 1');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -563,30 +404,20 @@ Followed by:
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Test Push',
- message: 'Push number 2'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Test Push');
+message.addData('message', 'Push number 2');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -603,31 +434,21 @@ You will only see "Push number 2" in the shade. However, if you send:
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Test Push',
- message: 'Push number 1',
- notId: 1
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Test Push');
+message.addData('message', 'Push number 1');
+message.addData('notId', 1);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -644,31 +465,21 @@ and:
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Test Push',
- message: 'Push number 2',
- notId: 2
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Test Push');
+message.addData('message', 'Push number 2');
+message.addData('notId', 2);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -690,32 +501,22 @@ A better alternative to stacking your notifications is to use the inbox style to
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'My Title',
- message: 'My first message',
- style: 'inbox',
- summaryText: 'There are %n% notifications'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'My Title');
+message.addData('message', 'My first message');
+message.addData('style', 'inbox');
+message.addData('summaryText', 'There are %n% notifications');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -737,32 +538,22 @@ But, if you follow it up with subsequent notifications like:
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'My Title',
- message: 'My second message',
- style: 'inbox',
- summaryText: 'There are %n% notifications'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'My Title');
+message.addData('message', 'My second message');
+message.addData('style', 'inbox');
+message.addData('summaryText', 'There are %n% notifications');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -790,34 +581,24 @@ Your notification can include a maximum of three action buttons. If you wish to
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'AUX Scrum',
- message: 'Scrum: Daily touchbase @ 10am Please be on time so we can cover everything on the agenda.',
- actions: [
- { icon: "emailGuests", title: "EMAIL GUESTS", callback: "app.emailGuests", foreground: true},
- { icon: "snooze", title: "SNOOZE", callback: "app.snooze", foreground: false},
- ]
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'AUX Scrum');
+message.addData('message', 'Scrum: Daily touchbase @ 10am Please be on time so we can cover everything on the agenda.');
+message.addData('actions', [
+ { "icon": "emailGuests", "title": "EMAIL GUESTS", "callback": "app.emailGuests", "foreground": true},
+ { "icon": "snooze", "title": "SNOOZE", "callback": "app.snooze", "foreground": false},
+]);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -847,34 +628,24 @@ Your notification can include action buttons. If you wish to include an icon alo
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'AUX Scrum',
- message: 'Scrum: Daily touchbase @ 10am Please be on time so we can cover everything on the agenda.',
- actions: [
- { "icon": "emailGuests", "title": "EMAIL GUESTS", "callback": "app.emailGuests", "foreground": false, "inline": true},
- { "icon": "snooze", "title": "SNOOZE", "callback": "app.snooze", "foreground": false},
- ]
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'AUX Scrum');
+message.addData('message', 'Scrum: Daily touchbase @ 10am Please be on time so we can cover everything on the agenda.');
+message.addData('actions', [
+ { "icon": "emailGuests", "title": "EMAIL GUESTS", "callback": "app.emailGuests", "foreground": false, "inline": true},
+ { "icon": "snooze", "title": "SNOOZE", "callback": "app.snooze", "foreground": false},
+]);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -941,31 +712,21 @@ You can use a Led notifcation and choose the color of it. Just add a `ledColor`
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Green LED',
- message: 'This is my message with a Green LED',
- ledColor: [0, 0, 255, 0]
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Green LED');
+message.addData('message', 'This is my message with a Green LED');
+message.addData('ledColor', [0, 0, 255, 0]);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -984,31 +745,21 @@ You can set a Vibration Pattern for your notifications. Just add a `vibrationPat
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Vibration Pattern',
- message: 'Device should wait for 2 seconds, vibrate for 1 second then be silent for 500 ms then vibrate for 500 ms',
- vibrationPattern: [2000, 1000, 500, 500]
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Vibration Pattern');
+message.addData('message', 'Device should wait for 2 seconds, vibrate for 1 second then be silent for 500 ms then vibrate for 500 ms');
+message.addData('vibrationPattern', [2000, 1000, 500, 500]);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -1027,31 +778,21 @@ You can set a priority parameter for your notifications. This priority value det
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'This is a maximum priority Notification',
- message: 'This notification should appear in front of all others',
- priority: 2
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'This is a maximum priority Notification');
+message.addData('message', 'This notification should appear in front of all others');
+message.addData('priority', 2);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -1074,32 +815,23 @@ Perhaps you want to include a large picture in the notification that you are sen
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Big Picture',
- message: 'This is my big picture message',
- picture: 'http://36.media.tumblr.com/c066cc2238103856c9ac506faa6f3bc2/tumblr_nmstmqtuo81tssmyno1_1280.jpg',
- summaryText: 'The internet is built on cat pictures'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Big Picture');
+message.addData('message', 'This is my big picture message');
+message.addData('style', 'picture');
+message.addData('picture', 'http://36.media.tumblr.com/c066cc2238103856c9ac506faa6f3bc2/tumblr_nmstmqtuo81tssmyno1_1280.jpg');
+message.addData('summaryText', 'The internet is built on cat pictures');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -1127,32 +859,22 @@ First the JSON you send from GCM will need to include `"content-available": "1"`
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- "to": deviceID,
- "data": {
- "title": 'Test Push',
- "message": 'Push number 1',
- "info": 'super secret info',
- "content-available": '1'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Test Push');
+message.addData('message', 'Push number 1');
+message.addData('info', 'super secret info');
+message.addData('content-available', '1');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -1169,38 +891,28 @@ or if you want the payload to be delivered directly to your app without anything
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- "to": deviceID,
- "data": {
- "info": 'super secret info',
- "content-available": '1'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('info', 'super secret info');
+message.addData('content-available', '1');
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
If do not want this type of behaviour just omit `"content-available": 1` from your push data and your `on('notification')` event handler will not be called.
-### Use of content_available: true
+### Use of content-available: true
-The [GCM docs](https://developers.google.com/cloud-messaging/http-server-ref#downstream-http-messages-json) will tell you to send a data payload of:
+The GCM docs will tell you to send a data payload of:
```javascript
{
@@ -1214,9 +926,9 @@ The [GCM docs](https://developers.google.com/cloud-messaging/http-server-ref#dow
}
```
-Where the `content_available` property is part of the main payload object. Setting the property in this part of the payload will result in the PushPlugin not getting the data correctly. Setting `content_available: true` will cause the Android OS to handle the push payload for you and not pass the data to the PushPlugin.
+Where the `content-available` property is part of the main payload object. Setting the property in this part of the payload will result in the PushPlugin not getting the data correctly. Setting `content-available: true` will cause the Android OS to handle the push payload for you and not pass the data to the PushPlugin.
-Instead move `content_available: true` into the `data` object of the payload. The property name changes slightly to use a `-` instead of an `_`. So, `content_available` becomes `content-available` and `true` becomes `1` as per the example below:
+Instead move `content-available: true` into the `data` object of the payload and set it to `1` as per the example below:
```javascript
{
@@ -1235,8 +947,7 @@ Instead move `content_available: true` into the `data` object of the payload. Th
These phones have a particular quirk that when the app is force closed that you will no longer be able to receive notifications until the app is restarted. In order for you to receive background notifications:
- On your Huawei device go to Settings > Protected apps > check "My App" where.
-- On your Xiaomi make sure your phone has the "Auto-start" property enabled for your app.
-- On your Asus make sure your phone has the "Auto-start" property enabled for your app.
+- On your Xiaomi makes sure your phone has the "Auto-start" property enabled for your app.
### Application force closed
@@ -1282,50 +993,24 @@ If you add `force-start: 1` to the data payload the application will be restarte
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- "data": {
- "title": 'Force Start',
- "message": 'This notification should restart the app',
- "force-start": '1'
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Force Start');
+message.addData('message', 'This notification should restart the app');
+message.addData('force-start', 1);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
-### Caching
-
-By default, when a notification arrives and 'content-available' is set to '1', the plugin will try to deliver the data payload even if the app is not running. In that case, the payload is cached and may be delivered when the app is started again. To disable this behavior, you can set a `no-cache` flag in the notification payload. 0: caching enabled (default), 1: caching disabled.
-
-```javascript
-{
- "registration_ids": ["my device id"],
- "data": {
- "title": "Push without cache",
- "message": "When the app is closed, this notification will not be cached",
- "content-available": "1",
- "no-cache": "1"
- }
-}
-```
-
## Visibility of Notifications
You can set a visibility parameter for your notifications. Just add a `visibility` field in your notification. -1: secret, 0: private (default), 1: public. `Secret` shows only the most minimal information, excluding even the notification's icon. `Private` shows basic information about the existence of this notification, including its icon and the name of the app that posted it. The rest of the notification's details are not displayed. `Public` Shows the notification's full content.
@@ -1341,31 +1026,21 @@ You can set a visibility parameter for your notifications. Just add a `visibilit
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'This is a public Notification',
- message: 'You should be able to read this notification on your lock screen',
- visibility: 1
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'This is a public Notification');
+message.addData('message', 'You should be able to read this notification on your lock screen');
+message.addData('visibility', 1);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -1386,31 +1061,21 @@ In order to set the badge number you will need to include the `badge` property i
}
```
-Here is an example using fcm-node that sends the above JSON:
+Here is an example using node-gcm that sends the above JSON:
```javascript
-var FCM = require('fcm-node');
+var gcm = require('node-gcm');
// Replace these with your own values.
var apiKey = "replace with API key";
var deviceID = "my device id";
-var fcm = new FCM(apiKey);
-
-var message = {
- to: deviceID,
- data: {
- title: 'Badge Test',
- message: 'Badges, we don\'t need no stinking badges',
- badge: 7
- }
-};
-
-fcm.send(message, function(err, response){
- if (err) {
- console.log(err);
- console.log("Something has gone wrong!");
- } else {
- console.log("Successfully sent with response: ", response);
- }
+var service = new gcm.Sender(apiKey);
+var message = new gcm.Message();
+message.addData('title', 'Badge Test');
+message.addData('message', 'Badges, we don\'t need no stinking badges');
+message.addData('badge', 7);
+service.send(message, { registrationTokens: [ deviceID ] }, function (err, response) {
+ if(err) console.error(err);
+ else console.log(response);
});
```
@@ -1448,17 +1113,11 @@ The JSON received by your app will comply with the standards described in the se
Note: "sound" and "soundname" are equivalent and are considered to be the same by the plugin.
-## Notification ID
-
-When setting the notification ID or `notId` please make sure that you are not exceeding the [MAX_INT](https://developer.android.com/reference/java/lang/Integer.html#MAX_VALUE) value for Android. Using a value larger than MAX_INT will throw an exception which will be caught by the plugin and it will use a default value of `0`.
-
-This means you can't use the JavaScript's `Date.getMilliseconds()` or Java's `System.currentTimeMillis()` as they will give you a value greater than MAX_INT.
-
# iOS Behaviour
## Sound
-In order for your notification to play a custom sound you will need to add the files to root of your iOS project. The files must be in the proper format. See the [Local and Remote Notification Programming Guide](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SupportingNotificationsinYourApp.html#//apple_ref/doc/uid/TP40008194-CH4-SW10) for more info on proper file formats and how to convert existing sound files.
+In order for your notification to play a custom sound you will need to add the files to root of your iOS project. The files must be in the proper format. See the [Local and Remote Notification Programming Guide](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW6) for more info on proper file formats and how to convert existing sound files.
Then send the follow JSON from APNS:
diff --git a/StoneIsland/plugins/phonegap-plugin-push/docs/PHONEGAP_BUILD.md b/StoneIsland/plugins/phonegap-plugin-push/docs/PHONEGAP_BUILD.md
index 7f460738..8a95d6a1 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/docs/PHONEGAP_BUILD.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/docs/PHONEGAP_BUILD.md
@@ -4,20 +4,19 @@
- [Including the plugin](#including-the-plugin)
- [Adding Resources](#adding-resources)
- [IntelXDK Support](#intelxdk-support)
-- [Ionic Cloud Build](#ionic-cloud-build)
## PhoneGap Build Support
-> PhoneGap Build now support version 1.9.0 of the plugin.
+> Currently PhoneGap Build does not support version 1.9.0 of the plugin. Updates are being made to PGB to support the latest release.
### Including the plugin
-Including this plugin in a project that is built by PhoneGap Build is as easy as adding (replacing `123456789` with your own, that is):
+Including this plugin in a project that is built by PhoneGap Build is as easy as adding:
```xml
<preference name="android-build-tool" value="gradle" />
<plugin name="phonegap-plugin-push" source="npm">
- <param name="SENDER_ID" value="123456789" />
+ <param name="SENDER_ID" value="<Your Sender ID>" />
</plugin>
```
@@ -92,25 +91,3 @@ f. you probably need to install the required gem (`gem install pushmeup`)
g. send the notification (`ruby pushAPNS.rb`)
10. See notification on device!
-
-## Ionic Cloud Build
-
-Users have reported issues with Ionic Cloud Build. Apparently there are some differences in the way variables are handled. If your app has an issue where the `PushNotification` object can't be found try the following.
-
-1. Remove the inclusion of `phonegap-plugin-push` from config.xml. That is delete lines that look like this:
-
-```
-<plugin name="phonegap-plugin-push" spec="~1.9.1">
- <variable name="SENDER_ID" value="xxx"/>
-</plugin>
-```
-2. Add the following lines into `package.json` in the `cordovaPlugins` array.
-
-```
-{
- "variables": {
- "SENDER_ID": "xxx"
- },
- "locator": "phonegap-plugin-push"
-}
-```
diff --git a/StoneIsland/plugins/phonegap-plugin-push/docs/TYPESCRIPT.md b/StoneIsland/plugins/phonegap-plugin-push/docs/TYPESCRIPT.md
index 53d215b3..37117d16 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/docs/TYPESCRIPT.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/docs/TYPESCRIPT.md
@@ -1,7 +1,7 @@
# Typescript definition file
For those of you who use typescript, we're glad to say that we have the complete definition file available at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped).
-Search for `phonegap-plugin-push` there, or simply grab it directly [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/phonegap-plugin-push/index.d.ts).
+Search for `phonegap-plugin-push` there, or simply grab it directly [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/phonegap-plugin-push/phonegap-plugin-push.d.ts).
## Example usage
@@ -11,6 +11,7 @@ All available attributes and properties will have autocomplete support and type
```typescript
let push = PushNotification.init({
android: {
+ senderID: "12345679"
},
ios: {
alert: "true",
@@ -68,4 +69,4 @@ push.on('notification', (data: my.custom.NotificationEventResponse) => {
## Outdated definitions
Is our definition file at DefinitelyTyped outdated? Is there any improvements that could be done?
-We welcome any contribution, and they should be done through issues created [there](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/new).
+We welcome any contribution, and they should be done through issues created [there](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/new). \ No newline at end of file
diff --git a/StoneIsland/plugins/phonegap-plugin-push/hooks/windows/setToastCapable.js b/StoneIsland/plugins/phonegap-plugin-push/hooks/windows/setToastCapable.js
index 5b784582..b8cbcbc0 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/hooks/windows/setToastCapable.js
+++ b/StoneIsland/plugins/phonegap-plugin-push/hooks/windows/setToastCapable.js
@@ -1,13 +1,7 @@
module.exports = function(context) {
- console.log('Updating appxmanifests with ToastCapable=true ...');
+ console.log('Updating appxmanifests with ToastCapable=true...');
var path = require('path');
- var fs = require('fs');
-
var platformProjPath = path.join(context.opts.projectRoot, 'platforms/windows');
- if (!fs.existsSync(platformProjPath)) {
- platformProjPath = context.opts.projectRoot;
- }
-
var AppxManifest = require(path.join(platformProjPath, 'cordova/lib/AppxManifest'));
['package.phone.appxmanifest', 'package.windows.appxmanifest'].forEach(function(manifestPath) {
diff --git a/StoneIsland/plugins/phonegap-plugin-push/package.json b/StoneIsland/plugins/phonegap-plugin-push/package.json
index 14f757b2..01287217 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/package.json
+++ b/StoneIsland/plugins/phonegap-plugin-push/package.json
@@ -1,28 +1,28 @@
{
- "_from": "phonegap-plugin-push@2.0.0",
- "_id": "phonegap-plugin-push@2.0.0",
+ "_from": "phonegap-plugin-push@1.9.2",
+ "_id": "phonegap-plugin-push@1.9.2",
"_inBundle": false,
- "_integrity": "sha1-FhKJtP3r0LUqTVoQUg0VYIPuz3M=",
+ "_integrity": "sha1-3PktbNuZLcs3iUCyIbfwjoKcn8E=",
"_location": "/phonegap-plugin-push",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
- "raw": "phonegap-plugin-push@2.0.0",
+ "raw": "phonegap-plugin-push@1.9.2",
"name": "phonegap-plugin-push",
"escapedName": "phonegap-plugin-push",
- "rawSpec": "2.0.0",
+ "rawSpec": "1.9.2",
"saveSpec": null,
- "fetchSpec": "2.0.0"
+ "fetchSpec": "1.9.2"
},
"_requiredBy": [
"#USER",
"/"
],
- "_resolved": "https://registry.npmjs.org/phonegap-plugin-push/-/phonegap-plugin-push-2.0.0.tgz",
- "_shasum": "161289b4fdebd0b52a4d5a10520d156083eecf73",
- "_spec": "phonegap-plugin-push@2.0.0",
- "_where": "/Users/user/Sites/stone-island/StoneIsland/node_modules",
+ "_resolved": "https://registry.npmjs.org/phonegap-plugin-push/-/phonegap-plugin-push-1.9.2.tgz",
+ "_shasum": "dcf92d6cdb992dcb378940b221b7f08e829c9fc1",
+ "_spec": "phonegap-plugin-push@1.9.2",
+ "_where": "/Users/user/Sites/stone-island/StoneIsland",
"author": {
"name": "Adobe PhoneGap Team"
},
@@ -39,25 +39,11 @@
"browser"
]
},
- "dependencies": {
- "babel-plugin-add-header-comment": "^1.0.3",
- "install": "^0.8.2"
- },
"deprecated": false,
"description": "Register and receive push notifications.",
"devDependencies": {
- "babel-cli": "^6.10.1",
- "babel-core": "^6.10.4",
- "babel-eslint": "^6.1.0",
- "babel-preset-es2015": "^6.9.0",
- "eslint": "^2.13.1",
- "eslint-config-airbnb": "^9.0.1",
- "eslint-plugin-import": "^1.9.2",
- "eslint-plugin-jsx-a11y": "^1.5.3",
- "eslint-plugin-react": "^5.2.2",
"jasmine-node": "1.14.5",
- "nodemon": "^1.9.2",
- "pluginpub": "^0.0.8"
+ "pluginpub": "^0.0.5"
},
"engines": {
"cordovaDependencies": {
@@ -66,15 +52,13 @@
"cordova-android": ">=4.0.0",
"cordova-ios": ">=4.1.0"
},
- "2.0.0": {
- "cordova": ">=7.0.0",
- "cordova-android": ">=6.2.1",
- "cordova-ios": ">=4.4.0"
- },
- "<2.0.0": {
+ "1.9.0": {
"cordova": ">=6.4.0",
"cordova-android": ">=6.0.0",
"cordova-ios": ">=4.3.0"
+ },
+ "2.0.0": {
+ "cordova": ">100"
}
}
},
@@ -89,18 +73,14 @@
"cordova-wp8",
"cordova-browser"
],
- "license": "MIT",
+ "license": "APL",
"name": "phonegap-plugin-push",
"repository": {
"type": "git",
"url": "git://github.com/phonegap/phonegap-plugin-push.git"
},
"scripts": {
- "build": "babel src/js --out-dir www",
- "build:watch": "nodemon -w ./src/js -e js -x npm run build",
- "jasmine": "jasmine-node --color spec",
- "test": "npm run build && npm run jasmine"
+ "test": "jasmine-node --color spec"
},
- "types": "./types/index.d.ts",
- "version": "2.0.0"
+ "version": "1.9.2"
}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/plugin.xml b/StoneIsland/plugins/phonegap-plugin-push/plugin.xml
index 2c507e4d..bf9c659a 100755
--- a/StoneIsland/plugins/phonegap-plugin-push/plugin.xml
+++ b/StoneIsland/plugins/phonegap-plugin-push/plugin.xml
@@ -1,60 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads" xmlns:rim="http://www.blackberry.com/ns/widgets" id="phonegap-plugin-push" version="2.0.0">
+<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads" xmlns:rim="http://www.blackberry.com/ns/widgets" id="phonegap-plugin-push" version="1.9.2">
<name>PushPlugin</name>
<description>
- This plugin allows your application to receive push notifications on Android, iOS and Windows devices.
- Android uses Firebase Cloud Messaging.
+ This plugin allows your application to receive push notifications on Android, iOS and Windows devices.
+ Android uses Google Cloud Messaging.
iOS uses Apple APNS Notifications.
Windows uses Microsoft WNS Notifications.
- </description>
+ </description>
<license>MIT</license>
<js-module src="www/push.js" name="PushNotification">
<clobbers target="PushNotification"/>
</js-module>
<engines>
- <engine name="cordova" version=">=7.0.0"/>
- <engine name="cordova-android" version=">=6.2.1"/>
- <engine name="cordova-ios" version=">=4.4.0"/>
+ <engine name="cordova" version=">=6.4.0"/>
+ <engine name="cordova-android" version=">=6.0.0"/>
+ <engine name="cordova-ios" version=">=4.3.0"/>
</engines>
+ <preference name="SENDER_ID" default="85075801930"/>
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="PushNotification">
<param name="android-package" value="com.adobe.phonegap.push.PushPlugin"/>
</feature>
</config-file>
+ <config-file target="res/values/strings.xml" parent="/resources">
+ <string name="google_app_id">$SENDER_ID</string>
+ </config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.VIBRATE"/>
+ <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
+ <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>
+ <uses-permission android:name="${applicationId}.permission.PushHandlerActivity"/>
+ <permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
+ <permission android:name="${applicationId}.permission.PushHandlerActivity" android:protectionLevel="signature"/>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.adobe.phonegap.push.PushHandlerActivity" android:exported="true" android:permission="${applicationId}.permission.PushHandlerActivity"/>
<receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler"/>
- <receiver android:name="com.adobe.phonegap.push.PushDismissedHandler"/>
- <service android:name="com.adobe.phonegap.push.FCMService">
+ <receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
+ <intent-filter>
+ <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
+ <category android:name="${applicationId}"/>
+ </intent-filter>
+ </receiver>
+ <service android:name="com.adobe.phonegap.push.GCMIntentService" android:exported="false">
<intent-filter>
- <action android:name="com.google.firebase.MESSAGING_EVENT"/>
+ <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
</service>
- <service android:name="com.adobe.phonegap.push.PushInstanceIDListenerService">
+ <service android:name="com.adobe.phonegap.push.PushInstanceIDListenerService" android:exported="false">
<intent-filter>
- <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
+ <action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
+ <service android:name="com.adobe.phonegap.push.RegistrationIntentService" android:exported="false"/>
</config-file>
- <framework src="com.android.support:support-v13:25.1.0"/>
- <framework src="me.leolin:ShortcutBadger:1.1.17@aar"/>
- <framework src="com.google.firebase:firebase-messaging:11.0.1"/>
<framework src="push.gradle" custom="true" type="gradleReference"/>
- <source-file src="src/android/com/adobe/phonegap/push/FCMService.java" target-dir="src/com/adobe/phonegap/push/"/>
+ <framework src="com.android.support:support-v13:23+"/>
+ <framework src="com.google.android.gms:play-services-gcm:9.8+"/>
+ <framework src="me.leolin:ShortcutBadger:1.1.11@aar"/>
+ <source-file src="src/android/com/adobe/phonegap/push/GCMIntentService.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushConstants.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushHandlerActivity.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushPlugin.java" target-dir="src/com/adobe/phonegap/push/"/>
+ <source-file src="src/android/com/adobe/phonegap/push/RegistrationIntentService.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PermissionUtils.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/BackgroundActionButtonHandler.java" target-dir="src/com/adobe/phonegap/push/"/>
- <source-file src="src/android/com/adobe/phonegap/push/PushDismissedHandler.java" target-dir="src/com/adobe/phonegap/push/"/>
</platform>
<platform name="browser">
<js-module src="www/browser/push.js" name="BrowserPush">
@@ -74,6 +89,12 @@
<string>remote-notification</string>
</array>
</config-file>
+ <config-file target="*-Info.plist" parent="GCM_SENDER_ID">
+ <string>$SENDER_ID</string>
+ </config-file>
+ <config-file target="*-Info.plist" parent="IS_GCM_ENABLED">
+ <true/>
+ </config-file>
<config-file target="*-Debug.plist" parent="aps-environment">
<string>development</string>
</config-file>
@@ -84,12 +105,16 @@
<source-file src="src/ios/PushPlugin.m"/>
<header-file src="src/ios/AppDelegate+notification.h"/>
<header-file src="src/ios/PushPlugin.h"/>
- <framework src="FirebaseMessaging" type="podspec" spec="~> 2.0.0"/>
+ <framework src="AddressBook.framework"/>
+ <framework src="libsqlite3.tbd"/>
+ <framework src="libz.tbd"/>
+ <framework src="GoogleCloudMessaging" type="podspec" spec="~> 1.2.0"/>
+ <framework src="GGLInstanceID" type="podspec" spec="~> 1.2.1"/>
</platform>
<platform name="windows">
<hook type="after_plugin_install" src="hooks/windows/setToastCapable.js"/>
<js-module src="src/windows/PushPluginProxy.js" name="PushPlugin">
- <runs/>
+ <merges target=""/>
</js-module>
<config-file target="config.xml" parent="/*">
<preference name="WindowsToastCapable" value="true"/>
diff --git a/StoneIsland/plugins/phonegap-plugin-push/push.gradle b/StoneIsland/plugins/phonegap-plugin-push/push.gradle
index 1506191b..11e735ae 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/push.gradle
+++ b/StoneIsland/plugins/phonegap-plugin-push/push.gradle
@@ -16,24 +16,6 @@ android {
}
defaultConfig {
- multiDexEnabled true
applicationId = doExtractStringFromManifest("package")
}
}
-
-buildscript {
- repositories {
- jcenter()
- mavenLocal()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:+'
- classpath 'com.google.gms:google-services:3.0.0'
- }
-}
-
-// apply plugin: 'com.google.gms.google-services'
-// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
-ext.postBuildExtras = {
- apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
-}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/spec/index.spec.js b/StoneIsland/plugins/phonegap-plugin-push/spec/index.spec.js
index e41accd2..8e1c2665 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/spec/index.spec.js
+++ b/StoneIsland/plugins/phonegap-plugin-push/spec/index.spec.js
@@ -193,7 +193,7 @@ describe('phonegap-plugin-push', function () {
push.off('notification', eventHandler);
- expect(push.handlers.notification.indexOf(eventHandler)).toEqual(-1);
+ expect(push._handlers.notification.indexOf(eventHandler)).toEqual(-1);
done();
});
});
@@ -208,7 +208,7 @@ describe('phonegap-plugin-push', function () {
push.off('registration', eventHandler);
- expect(push.handlers.registration.indexOf(eventHandler)).toEqual(-1);
+ expect(push._handlers.registration.indexOf(eventHandler)).toEqual(-1);
done();
});
});
@@ -222,7 +222,7 @@ describe('phonegap-plugin-push', function () {
push.on('error', eventHandler);
push.off('error', eventHandler);
- expect(push.handlers.error.indexOf(eventHandler)).toEqual(-1);
+ expect(push._handlers.error.indexOf(eventHandler)).toEqual(-1);
done();
});
});
@@ -233,19 +233,19 @@ describe('phonegap-plugin-push', function () {
eventHandler = function () {
};
- expect(push.handlers.registration.length).toEqual(0);
+ expect(push._handlers.registration.length).toEqual(0);
push.on('registration',eventHandler);
- expect(push.handlers.registration.length).toEqual(1);
- expect(push.handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.registration.length).toEqual(1);
+ expect(push._handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);
execSpy.andCallFake(function (win, fail, service, id, args) {
win();
});
push.unregister(function() {
- expect(push.handlers.registration.length).toEqual(0);
- expect(push.handlers.registration.indexOf(eventHandler)).toEqual(-1);
+ expect(push._handlers.registration.length).toEqual(0);
+ expect(push._handlers.registration.indexOf(eventHandler)).toEqual(-1);
done();
});
});
@@ -255,19 +255,19 @@ describe('phonegap-plugin-push', function () {
eventHandler = function () {
};
- expect(push.handlers.notification.length).toEqual(0);
+ expect(push._handlers.notification.length).toEqual(0);
push.on('notification', eventHandler);
- expect(push.handlers.notification.length).toEqual(1);
- expect(push.handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.notification.length).toEqual(1);
+ expect(push._handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);
execSpy.andCallFake(function (win, fail, service, id, args) {
win();
});
push.unregister(function() {
- expect(push.handlers.notification.length).toEqual(0);
- expect(push.handlers.notification.indexOf(eventHandler)).toEqual(-1);
+ expect(push._handlers.notification.length).toEqual(0);
+ expect(push._handlers.notification.indexOf(eventHandler)).toEqual(-1);
done();
});
});
@@ -277,19 +277,19 @@ describe('phonegap-plugin-push', function () {
eventHandler = function () {
};
- expect(push.handlers.error.length).toEqual(0);
+ expect(push._handlers.error.length).toEqual(0);
push.on('error', eventHandler);
- expect(push.handlers.error.length).toEqual(1);
- expect(push.handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.error.length).toEqual(1);
+ expect(push._handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);
execSpy.andCallFake(function (win, fail, service, id, args) {
win();
});
push.unregister(function() {
- expect(push.handlers.error.length).toEqual(0);
- expect(push.handlers.error.indexOf(eventHandler)).toEqual(-1);
+ expect(push._handlers.error.length).toEqual(0);
+ expect(push._handlers.error.indexOf(eventHandler)).toEqual(-1);
done();
});
});
@@ -301,21 +301,21 @@ describe('phonegap-plugin-push', function () {
eventHandler = function () {
};
- expect(push.handlers.registration.length).toEqual(0);
+ expect(push._handlers.registration.length).toEqual(0);
push.on('registration',eventHandler);
- expect(push.handlers.registration.length).toEqual(1);
- expect(push.handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.registration.length).toEqual(1);
+ expect(push._handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);
execSpy.andCallFake(function (win, fail, service, id, args) {
win();
});
push.unregister(function() {
- expect(push.handlers.registration.length).toEqual(1);
- expect(push.handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.registration.length).toEqual(1);
+ expect(push._handlers.registration.indexOf(eventHandler)).toBeGreaterThan(-1);
done();
- }, function() {}, ['foo', 'bar']);
+ }, null, ['foo', 'bar']);
});
it('should not clear "notification" event handlers', function (done) {
@@ -323,21 +323,21 @@ describe('phonegap-plugin-push', function () {
eventHandler = function () {
};
- expect(push.handlers.notification.length).toEqual(0);
+ expect(push._handlers.notification.length).toEqual(0);
push.on('notification', eventHandler);
- expect(push.handlers.notification.length).toEqual(1);
- expect(push.handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.notification.length).toEqual(1);
+ expect(push._handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);
execSpy.andCallFake(function (win, fail, service, id, args) {
win();
});
push.unregister(function() {
- expect(push.handlers.notification.length).toEqual(1);
- expect(push.handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.notification.length).toEqual(1);
+ expect(push._handlers.notification.indexOf(eventHandler)).toBeGreaterThan(-1);
done();
- }, function() {}, ['foo', 'bar']);
+ }, null, ['foo', 'bar']);
});
it('should not clear "error" event handlers', function (done) {
@@ -345,21 +345,21 @@ describe('phonegap-plugin-push', function () {
eventHandler = function () {
};
- expect(push.handlers.error.length).toEqual(0);
+ expect(push._handlers.error.length).toEqual(0);
push.on('error', eventHandler);
- expect(push.handlers.error.length).toEqual(1);
- expect(push.handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.error.length).toEqual(1);
+ expect(push._handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);
execSpy.andCallFake(function (win, fail, service, id, args) {
win();
});
push.unregister(function() {
- expect(push.handlers.error.length).toEqual(1);
- expect(push.handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);
+ expect(push._handlers.error.length).toEqual(1);
+ expect(push._handlers.error.indexOf(eventHandler)).toBeGreaterThan(-1);
done();
- }, function() {}, ['foo', 'bar']);
+ }, null, ['foo', 'bar']);
});
});
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/BackgroundActionButtonHandler.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/BackgroundActionButtonHandler.java
index 4456f525..3ccea6cb 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/BackgroundActionButtonHandler.java
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/BackgroundActionButtonHandler.java
@@ -9,7 +9,7 @@ import android.util.Log;
import android.support.v4.app.RemoteInput;
public class BackgroundActionButtonHandler extends BroadcastReceiver implements PushConstants {
- private static String LOG_TAG = "Push_BGActionButton";
+ private static String LOG_TAG = "PushPlugin_BackgroundActionButtonHandler";
@Override
public void onReceive(Context context, Intent intent) {
@@ -19,7 +19,7 @@ public class BackgroundActionButtonHandler extends BroadcastReceiver implements
int notId = intent.getIntExtra(NOT_ID, 0);
Log.d(LOG_TAG, "not id = " + notId);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.cancel(FCMService.getAppName(context), notId);
+ notificationManager.cancel(GCMIntentService.getAppName(context), notId);
if (extras != null) {
Bundle originalExtras = extras.getBundle(PUSH_BUNDLE);
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/FCMService.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java
index af328fb2..e1a2b75c 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/FCMService.java
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/GCMIntentService.java
@@ -13,23 +13,17 @@ import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.Paint;
-import android.graphics.Canvas;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
+import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.NotificationCompat.WearableExtender;
import android.support.v4.app.RemoteInput;
import android.text.Html;
import android.text.Spanned;
import android.util.Log;
-import com.google.firebase.messaging.FirebaseMessagingService;
-import com.google.firebase.messaging.RemoteMessage;
+import com.google.android.gms.gcm.GcmListenerService;
import org.json.JSONArray;
import org.json.JSONException;
@@ -42,13 +36,12 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import java.util.Random;
@SuppressLint("NewApi")
-public class FCMService extends FirebaseMessagingService implements PushConstants {
+public class GCMIntentService extends GcmListenerService implements PushConstants {
- private static final String LOG_TAG = "Push_FCMService";
+ private static final String LOG_TAG = "PushPlugin_GCMIntentService";
private static HashMap<Integer, ArrayList<String>> messageMap = new HashMap<Integer, ArrayList<String>>();
public void setNotification(int notId, String message){
@@ -66,31 +59,17 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
}
@Override
- public void onMessageReceived(RemoteMessage message){
-
- String from = message.getFrom();
+ public void onMessageReceived(String from, Bundle extras) {
Log.d(LOG_TAG, "onMessage - from: " + from);
- Bundle extras = new Bundle();
-
- if (message.getNotification()!=null) {
- extras.putString(TITLE,message.getNotification().getTitle());
- extras.putString(MESSAGE,message.getNotification().getBody());
- }
- for (Map.Entry<String, String> entry : message.getData().entrySet()) {
- extras.putString(entry.getKey(), entry.getValue());
- }
-
- if (extras != null && isAvailableSender(from)) {
+ if (extras != null) {
Context applicationContext = getApplicationContext();
SharedPreferences prefs = applicationContext.getSharedPreferences(PushPlugin.COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE);
boolean forceShow = prefs.getBoolean(FORCE_SHOW, false);
boolean clearBadge = prefs.getBoolean(CLEAR_BADGE, false);
- String messageKey = prefs.getString(MESSAGE_KEY, MESSAGE);
- String titleKey = prefs.getString(TITLE_KEY, TITLE);
- extras = normalizeExtras(applicationContext, extras, messageKey, titleKey);
+ extras = normalizeExtras(applicationContext, extras);
if (clearBadge) {
PushPlugin.setApplicationIconBadgeNumber(getApplicationContext(), 0);
@@ -188,10 +167,10 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
/*
* Replace alternate keys with our canonical value
*/
- private String normalizeKey(String key, String messageKey, String titleKey) {
- if (key.equals(BODY) || key.equals(ALERT) || key.equals(MP_MESSAGE) || key.equals(GCM_NOTIFICATION_BODY) || key.equals(TWILIO_BODY) || key.equals(messageKey)) {
+ private String normalizeKey(String key) {
+ if (key.equals(BODY) || key.equals(ALERT) || key.equals(GCM_NOTIFICATION_BODY) || key.equals(TWILIO_BODY)) {
return MESSAGE;
- } else if (key.equals(TWILIO_TITLE) || key.equals(SUBJECT) || key.equals(titleKey)) {
+ } else if (key.equals(TWILIO_TITLE)) {
return TITLE;
}else if (key.equals(MSGCNT) || key.equals(BADGE)) {
return COUNT;
@@ -212,7 +191,7 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
/*
* Parse bundle into normalized keys.
*/
- private Bundle normalizeExtras(Context context, Bundle extras, String messageKey, String titleKey) {
+ private Bundle normalizeExtras(Context context, Bundle extras) {
Log.d(LOG_TAG, "normalize extras");
Iterator<String> it = extras.keySet().iterator();
Bundle newExtras = new Bundle();
@@ -224,7 +203,7 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
// If normalizeKeythe key is "data" or "message" and the value is a json object extract
// This is to support parse.com and other services. Issue #147 and pull #218
- if (key.equals(PARSE_COM_DATA) || key.equals(MESSAGE) || key.equals(messageKey)) {
+ if (key.equals(PARSE_COM_DATA) || key.equals(MESSAGE)) {
Object json = extras.get(key);
// Make sure data is json object stringified
if ( json instanceof String && ((String) json).startsWith("{") ) {
@@ -232,8 +211,7 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
try {
// If object contains message keys promote each value to the root of the bundle
JSONObject data = new JSONObject((String) json);
- if ( data.has(ALERT) || data.has(MESSAGE) || data.has(BODY) || data.has(TITLE) ||
- data.has(messageKey) || data.has(titleKey) ) {
+ if ( data.has(ALERT) || data.has(MESSAGE) || data.has(BODY) || data.has(TITLE) ) {
Iterator<String> jsonIter = data.keys();
while (jsonIter.hasNext()) {
String jsonKey = jsonIter.next();
@@ -241,7 +219,7 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
Log.d(LOG_TAG, "key = data/" + jsonKey);
String value = data.getString(jsonKey);
- jsonKey = normalizeKey(jsonKey, messageKey, titleKey);
+ jsonKey = normalizeKey(jsonKey);
value = localizeKey(context, jsonKey, value);
newExtras.putString(jsonKey, value);
@@ -250,10 +228,6 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
} catch( JSONException e) {
Log.e(LOG_TAG, "normalizeExtras: JSON exception");
}
- } else {
- String newKey = normalizeKey(key, messageKey, titleKey);
- Log.d(LOG_TAG, "replace key " + key + " with " + newKey);
- replaceKey(context, key, newKey, extras, newExtras);
}
} else if (key.equals(("notification"))) {
Bundle value = extras.getBundle(key);
@@ -262,7 +236,7 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
String notifkey = iterator.next();
Log.d(LOG_TAG, "notifkey = " + notifkey);
- String newKey = normalizeKey(notifkey, messageKey, titleKey);
+ String newKey = normalizeKey(notifkey);
Log.d(LOG_TAG, "replace key " + notifkey + " with " + newKey);
String valueData = value.getString(notifkey);
@@ -271,17 +245,12 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
newExtras.putString(newKey, valueData);
}
continue;
- // In case we weren't working on the payload data node or the notification node,
- // normalize the key.
- // This allows to have "message" as the payload data key without colliding
- // with the other "message" key (holding the body of the payload)
- // See issue #1663
- } else {
- String newKey = normalizeKey(key, messageKey, titleKey);
- Log.d(LOG_TAG, "replace key " + key + " with " + newKey);
- replaceKey(context, key, newKey, extras, newExtras);
}
+ String newKey = normalizeKey(key);
+ Log.d(LOG_TAG, "replace key " + key + " with " + newKey);
+ replaceKey(context, key, newKey, extras, newExtras);
+
} // while
return newExtras;
@@ -332,15 +301,15 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
createNotification(context, extras);
}
- if(!PushPlugin.isActive() && "1".equals(forceStart)){
+ if(!PushPlugin.isActive() && "1".equals(forceStart)){
Log.d(LOG_TAG, "app is not running but we should start it and put in background");
- Intent intent = new Intent(this, PushHandlerActivity.class);
+ Intent intent = new Intent(this, PushHandlerActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(PUSH_BUNDLE, extras);
- intent.putExtra(START_IN_BACKGROUND, true);
+ intent.putExtra(START_IN_BACKGROUND, true);
intent.putExtra(FOREGROUND, false);
startActivity(intent);
- } else if ("1".equals(contentAvailable)) {
+ } else if ("1".equals(contentAvailable)) {
Log.d(LOG_TAG, "app is not running and content available true");
Log.d(LOG_TAG, "send notification event");
PushPlugin.sendExtras(extras);
@@ -362,22 +331,12 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
int requestCode = new Random().nextInt();
PendingIntent contentIntent = PendingIntent.getActivity(this, requestCode, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
- Intent dismissedNotificationIntent = new Intent(this, PushDismissedHandler.class);
- dismissedNotificationIntent.putExtra(PUSH_BUNDLE, extras);
- dismissedNotificationIntent.putExtra(NOT_ID, notId);
- dismissedNotificationIntent.putExtra(DISMISSED, true);
- dismissedNotificationIntent.setAction(PUSH_DISMISSED);
-
- requestCode = new Random().nextInt();
- PendingIntent deleteIntent = PendingIntent.getBroadcast(this, requestCode, dismissedNotificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
-
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
.setWhen(System.currentTimeMillis())
.setContentTitle(fromHtml(extras.getString(TITLE)))
.setTicker(fromHtml(extras.getString(TITLE)))
.setContentIntent(contentIntent)
- .setDeleteIntent(deleteIntent)
.setAutoCancel(true);
SharedPreferences prefs = context.getSharedPreferences(PushPlugin.COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE);
@@ -731,46 +690,11 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
}
}
- private Bitmap getCircleBitmap(Bitmap bitmap) {
- if (bitmap == null) {
- return null;
- }
-
- final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
- final Canvas canvas = new Canvas(output);
- final int color = Color.RED;
- final Paint paint = new Paint();
- final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
- final RectF rectF = new RectF(rect);
-
- paint.setAntiAlias(true);
- canvas.drawARGB(0, 0, 0, 0);
- paint.setColor(color);
- float cx = bitmap.getWidth()/2;
- float cy = bitmap.getHeight()/2;
- float radius = cx < cy ? cx : cy;
- canvas.drawCircle(cx,cy,radius,paint);
-
- paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
- canvas.drawBitmap(bitmap, rect, rect, paint);
-
- bitmap.recycle();
-
- return output;
- }
-
private void setNotificationLargeIcon(Bundle extras, String packageName, Resources resources, NotificationCompat.Builder mBuilder) {
String gcmLargeIcon = extras.getString(IMAGE); // from gcm
- String imageType = extras.getString(IMAGE_TYPE, IMAGE_TYPE_SQUARE);
if (gcmLargeIcon != null && !"".equals(gcmLargeIcon)) {
if (gcmLargeIcon.startsWith("http://") || gcmLargeIcon.startsWith("https://")) {
- Bitmap bitmap = getBitmapFromURL(gcmLargeIcon);
- if (IMAGE_TYPE_SQUARE.equalsIgnoreCase(imageType)) {
- mBuilder.setLargeIcon(bitmap);
- } else {
- Bitmap bm = getCircleBitmap(bitmap);
- mBuilder.setLargeIcon(bm);
- }
+ mBuilder.setLargeIcon(getBitmapFromURL(gcmLargeIcon));
Log.d(LOG_TAG, "using remote large-icon from gcm");
} else {
AssetManager assetManager = getAssets();
@@ -778,12 +702,7 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
try {
istr = assetManager.open(gcmLargeIcon);
Bitmap bitmap = BitmapFactory.decodeStream(istr);
- if (IMAGE_TYPE_SQUARE.equalsIgnoreCase(imageType)) {
- mBuilder.setLargeIcon(bitmap);
- } else {
- Bitmap bm = getCircleBitmap(bitmap);
- mBuilder.setLargeIcon(bm);
- }
+ mBuilder.setLargeIcon(bitmap);
Log.d(LOG_TAG, "using assets large-icon from gcm");
} catch (IOException e) {
int largeIconId = 0;
@@ -843,7 +762,6 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
try {
URL url = new URL(strURL);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setConnectTimeout(15000);
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
@@ -881,11 +799,4 @@ public class FCMService extends FirebaseMessagingService implements PushConstant
else
return null;
}
-
- private boolean isAvailableSender(String from) {
- SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(PushPlugin.COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE);
- String savedSenderID = sharedPref.getString(SENDER_ID, "");
-
- return from.equals(savedSenderID) || from.startsWith("/topics/");
- }
}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PermissionUtils.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PermissionUtils.java
index 41bc6a6f..6aa5c9bf 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PermissionUtils.java
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PermissionUtils.java
@@ -10,12 +10,8 @@ import java.lang.reflect.Method;
public class PermissionUtils {
private static final String CHECK_OP_NO_THROW = "checkOpNoThrow";
- private static final int MIN_API_LEVEL = 19; // required by AppOpsManager
public static boolean hasPermission(Context appContext, String appOpsServiceId) throws UnknownError {
- if (android.os.Build.VERSION.SDK_INT < MIN_API_LEVEL) {
- return true;
- }
ApplicationInfo appInfo = appContext.getApplicationInfo();
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushConstants.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushConstants.java
index e3aa217c..37874e04 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushConstants.java
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushConstants.java
@@ -3,7 +3,6 @@ package com.adobe.phonegap.push;
public interface PushConstants {
public static final String COM_ADOBE_PHONEGAP_PUSH = "com.adobe.phonegap.push";
public static final String REGISTRATION_ID = "registrationId";
- public static final String REGISTRATION_TYPE = "registrationType";
public static final String FOREGROUND = "foreground";
public static final String TITLE = "title";
public static final String NOT_ID = "notId";
@@ -56,11 +55,10 @@ public interface PushConstants {
public static final String FROM = "from";
public static final String COLLAPSE_KEY = "collapse_key";
public static final String FORCE_SHOW = "forceShow";
- public static final String FCM = "FCM";
+ public static final String GCM = "GCM";
public static final String CONTENT_AVAILABLE = "content-available";
public static final String TOPICS = "topics";
public static final String SET_APPLICATION_ICON_BADGE_NUMBER = "setApplicationIconBadgeNumber";
- public static final String GET_APPLICATION_ICON_BADGE_NUMBER = "getApplicationIconBadgeNumber";
public static final String CLEAR_ALL_NOTIFICATIONS = "clearAllNotifications";
public static final String VISIBILITY = "visibility";
public static final String INLINE_REPLY = "inlineReply";
@@ -69,18 +67,6 @@ public interface PushConstants {
public static final String TWILIO_BODY = "twi_body";
public static final String TWILIO_TITLE = "twi_title";
public static final String TWILIO_SOUND = "twi_sound";
- public static final String MP_MESSAGE = "mp_message";
public static final String START_IN_BACKGROUND = "cdvStartInBackground";
public static final String FORCE_START = "force-start";
- public static final String MESSAGE_KEY = "messageKey";
- public static final String TITLE_KEY = "titleKey";
- public static final String NO_CACHE = "no-cache";
- public static final String DISMISSED = "dismissed";
- public static final String IMAGE_TYPE = "image-type";
- public static final String IMAGE_TYPE_SQUARE = "square";
- public static final String IMAGE_TYPE_CIRCLE = "circle";
- public static final String SUBJECT = "subject";
- public static final String GOOGLE_APP_ID = "google_app_id";
- public static final String GCM_DEFAULT_SENDER_ID = "gcm_defaultSenderId";
- public static final String PUSH_DISMISSED = "push_dismissed";
}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushDismissedHandler.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushDismissedHandler.java
deleted file mode 100644
index a517bc1e..00000000
--- a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushDismissedHandler.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.adobe.phonegap.push;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.util.Log;
-
-public class PushDismissedHandler extends BroadcastReceiver implements PushConstants {
- private static String LOG_TAG = "Push_DismissedHandler";
-
- @Override
- public void onReceive(Context context, Intent intent) {
- Bundle extras = intent.getExtras();
- FCMService fcm = new FCMService();
- String action = intent.getAction();
- int notID = intent.getIntExtra(NOT_ID, 0);
-
- if (action.equals(PUSH_DISMISSED)) {
- Log.d(LOG_TAG, "PushDismissedHandler = " + extras);
- Log.d(LOG_TAG, "not id = " + notID);
-
- fcm.setNotification(notID, "");
- }
- }
-}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushHandlerActivity.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushHandlerActivity.java
index 0d399a61..23682ac8 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushHandlerActivity.java
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushHandlerActivity.java
@@ -11,7 +11,7 @@ import android.support.v4.app.RemoteInput;
public class PushHandlerActivity extends Activity implements PushConstants {
- private static String LOG_TAG = "Push_HandlerActivity";
+ private static String LOG_TAG = "PushPlugin_PushHandlerActivity";
/*
* this activity will be started if the user touches a notification that we own.
@@ -21,7 +21,7 @@ public class PushHandlerActivity extends Activity implements PushConstants {
*/
@Override
public void onCreate(Bundle savedInstanceState) {
- FCMService gcm = new FCMService();
+ GCMIntentService gcm = new GCMIntentService();
Intent intent = getIntent();
@@ -34,18 +34,16 @@ public class PushHandlerActivity extends Activity implements PushConstants {
Log.d(LOG_TAG, "callback = " + callback);
boolean foreground = getIntent().getExtras().getBoolean("foreground", true);
boolean startOnBackground = getIntent().getExtras().getBoolean(START_IN_BACKGROUND, false);
- boolean dismissed = getIntent().getExtras().getBoolean(DISMISSED, false);
- Log.d(LOG_TAG, "dismissed = " + dismissed);
if(!startOnBackground){
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.cancel(FCMService.getAppName(this), notId);
+ notificationManager.cancel(GCMIntentService.getAppName(this), notId);
}
boolean isPushPluginActive = PushPlugin.isActive();
boolean inline = processPushBundle(isPushPluginActive, intent);
- if(inline && android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.N && !startOnBackground){
+ if(inline && android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.N){
foreground = true;
}
@@ -53,17 +51,15 @@ public class PushHandlerActivity extends Activity implements PushConstants {
finish();
- if(!dismissed) {
- Log.d(LOG_TAG, "isPushPluginActive = " + isPushPluginActive);
- if (!isPushPluginActive && foreground && inline) {
- Log.d(LOG_TAG, "forceMainActivityReload");
- forceMainActivityReload(false);
- } else if(startOnBackground) {
- Log.d(LOG_TAG, "startOnBackgroundTrue");
- forceMainActivityReload(true);
- } else {
- Log.d(LOG_TAG, "don't want main activity");
- }
+ Log.d(LOG_TAG, "isPushPluginActive = " + isPushPluginActive);
+ if (!isPushPluginActive && foreground && inline) {
+ Log.d(LOG_TAG, "forceMainActivityReload");
+ forceMainActivityReload(false);
+ } else if(startOnBackground) {
+ Log.d(LOG_TAG, "startOnBackgroundTrue");
+ forceMainActivityReload(true);
+ } else {
+ Log.d(LOG_TAG, "don't want main activity");
}
}
@@ -80,9 +76,7 @@ public class PushHandlerActivity extends Activity implements PushConstants {
originalExtras.putBoolean(FOREGROUND, false);
originalExtras.putBoolean(COLDSTART, !isPushPluginActive);
- originalExtras.putBoolean(DISMISSED, extras.getBoolean(DISMISSED));
originalExtras.putString(ACTION_CALLBACK, extras.getString(CALLBACK));
- originalExtras.remove(NO_CACHE);
remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput != null) {
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java
index 176b7419..eaa39a48 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java
@@ -5,22 +5,23 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
-import com.google.firebase.iid.FirebaseInstanceId;
-import com.google.firebase.iid.FirebaseInstanceIdService;
+import com.google.android.gms.iid.InstanceID;
+import com.google.android.gms.iid.InstanceIDListenerService;
import org.json.JSONException;
import java.io.IOException;
-public class PushInstanceIDListenerService extends FirebaseInstanceIdService implements PushConstants {
- public static final String LOG_TAG = "Push_InsIdService";
+public class PushInstanceIDListenerService extends InstanceIDListenerService implements PushConstants {
+ public static final String LOG_TAG = "PushPlugin_PushInstanceIDListenerService";
@Override
public void onTokenRefresh() {
- // Get updated InstanceID token.
- String refreshedToken = FirebaseInstanceId.getInstance().getToken();
- Log.d(LOG_TAG, "Refreshed token: " + refreshedToken);
- // TODO: Implement this method to send any registration to your app's servers.
- //sendRegistrationToServer(refreshedToken);
+ SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE);
+ String senderID = sharedPref.getString(SENDER_ID, "");
+ if (!"".equals(senderID)) {
+ Intent intent = new Intent(this, RegistrationIntentService.class);
+ startService(intent);
+ }
}
}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushPlugin.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushPlugin.java
index 32f72bf3..f6faaa2b 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushPlugin.java
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/PushPlugin.java
@@ -1,14 +1,13 @@
package com.adobe.phonegap.push;
-import android.app.Activity;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
-import com.google.firebase.iid.FirebaseInstanceId;
-import com.google.firebase.messaging.FirebaseMessaging;
+import com.google.android.gms.gcm.GcmPubSub;
+import com.google.android.gms.iid.InstanceID;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
@@ -30,7 +29,7 @@ import me.leolin.shortcutbadger.ShortcutBadger;
public class PushPlugin extends CordovaPlugin implements PushConstants {
- public static final String LOG_TAG = "Push_Plugin";
+ public static final String LOG_TAG = "PushPlugin";
private static CallbackContext pushContext;
private static CordovaWebView gWebView;
@@ -60,7 +59,6 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
Log.v(LOG_TAG, "execute: data=" + data.toString());
SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE);
- String token = null;
String senderID = null;
try {
@@ -68,19 +66,15 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
Log.v(LOG_TAG, "execute: jo=" + jo.toString());
- senderID = getStringResourceByName(GCM_DEFAULT_SENDER_ID);
+ senderID = jo.getString(SENDER_ID);
Log.v(LOG_TAG, "execute: senderID=" + senderID);
- token = FirebaseInstanceId.getInstance().getToken();
+ String savedSenderID = sharedPref.getString(SENDER_ID, "");
+ registration_id = InstanceID.getInstance(getApplicationContext()).getToken(senderID, GCM);
- if (token == null) {
- token = FirebaseInstanceId.getInstance().getToken(senderID,FCM);
- }
-
- if (!"".equals(token)) {
- JSONObject json = new JSONObject().put(REGISTRATION_ID, token);
- json.put(REGISTRATION_TYPE, FCM);
+ if (!"".equals(registration_id)) {
+ JSONObject json = new JSONObject().put(REGISTRATION_ID, registration_id);
Log.v(LOG_TAG, "onRegistered: " + json.toString());
@@ -89,14 +83,14 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
PushPlugin.sendEvent( json );
} else {
- callbackContext.error("Empty registration ID received from FCM");
+ callbackContext.error("Empty registration ID received from GCM");
return;
}
} catch (JSONException e) {
Log.e(LOG_TAG, "execute: Got JSON Exception " + e.getMessage());
callbackContext.error(e.getMessage());
} catch (IOException e) {
- Log.e(LOG_TAG, "execute: Got IO Exception " + e.getMessage());
+ Log.e(LOG_TAG, "execute: Got JSON Exception " + e.getMessage());
callbackContext.error(e.getMessage());
}
@@ -124,8 +118,6 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
editor.putBoolean(CLEAR_NOTIFICATIONS, jo.optBoolean(CLEAR_NOTIFICATIONS, true));
editor.putBoolean(FORCE_SHOW, jo.optBoolean(FORCE_SHOW, false));
editor.putString(SENDER_ID, senderID);
- editor.putString(MESSAGE_KEY, jo.optString(MESSAGE_KEY));
- editor.putString(TITLE_KEY, jo.optString(TITLE_KEY));
editor.commit();
}
@@ -151,7 +143,7 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
if (topics != null && !"".equals(registration_id)) {
unsubscribeFromTopics(topics, registration_id);
} else {
- FirebaseInstanceId.getInstance().deleteInstanceId();
+ InstanceID.getInstance(getApplicationContext()).deleteInstanceID();
Log.v(LOG_TAG, "UNREGISTER");
// Remove shared prefs
@@ -202,13 +194,6 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
callbackContext.success();
}
});
- } else if (GET_APPLICATION_ICON_BADGE_NUMBER.equals(action)) {
- cordova.getThreadPool().execute(new Runnable() {
- public void run() {
- Log.v(LOG_TAG, "getApplicationIconBadgeNumber");
- callbackContext.success(getApplicationIconBadgeNumber(getApplicationContext()));
- }
- });
} else if (CLEAR_ALL_NOTIFICATIONS.equals(action)) {
cordova.getThreadPool().execute(new Runnable() {
public void run() {
@@ -227,6 +212,8 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
callbackContext.success();
} catch (JSONException e) {
callbackContext.error(e.getMessage());
+ } catch (IOException e) {
+ callbackContext.error(e.getMessage());
}
}
});
@@ -240,6 +227,8 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
callbackContext.success();
} catch (JSONException e) {
callbackContext.error(e.getMessage());
+ } catch (IOException e) {
+ callbackContext.error(e.getMessage());
}
}
});
@@ -270,41 +259,25 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
/*
* Sends the pushbundle extras to the client application.
- * If the client application isn't currently active and the no-cache flag is not set, it is cached for later processing.
+ * If the client application isn't currently active, it is cached for later processing.
*/
public static void sendExtras(Bundle extras) {
if (extras != null) {
- String noCache = extras.getString(NO_CACHE);
if (gWebView != null) {
sendEvent(convertBundleToJson(extras));
- } else if(!"1".equals(noCache)){
+ } else {
Log.v(LOG_TAG, "sendExtras: caching extras to send at a later time.");
gCachedExtras.add(extras);
}
}
}
- /*
- * Retrives badge count from SharedPreferences
- */
- public static int getApplicationIconBadgeNumber(Context context){
- SharedPreferences settings = context.getSharedPreferences(BADGE, Context.MODE_PRIVATE);
- return settings.getInt(BADGE, 0);
- }
-
- /*
- * Sets badge count on application icon and in SharedPreferences
- */
public static void setApplicationIconBadgeNumber(Context context, int badgeCount) {
if (badgeCount > 0) {
ShortcutBadger.applyCount(context, badgeCount);
- }else{
+ } else {
ShortcutBadger.removeCount(context);
}
-
- SharedPreferences.Editor editor = context.getSharedPreferences(BADGE, Context.MODE_PRIVATE).edit();
- editor.putInt(BADGE, Math.max(badgeCount, 0));
- editor.apply();
}
@Override
@@ -342,7 +315,23 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
notificationManager.cancelAll();
}
- private void subscribeToTopics(JSONArray topics, String registrationToken) {
+ /**
+ * Transform `topic name` to `topic path`
+ * Normally, the `topic` inputed from end-user is `topic name` only.
+ * We should convert them to GCM `topic path`
+ * Example:
+ * when topic name = 'my-topic'
+ * then topic path = '/topics/my-topic'
+ *
+ * @param String topic The topic name
+ * @return The topic path
+ */
+ private String getTopicPath(String topic)
+ {
+ return "/topics/" + topic;
+ }
+
+ private void subscribeToTopics(JSONArray topics, String registrationToken) throws IOException {
if (topics != null) {
String topic = null;
for (int i=0; i<topics.length(); i++) {
@@ -352,10 +341,16 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
}
}
- private void subscribeToTopic(String topic, String registrationToken) {
- if (topic != null) {
- Log.d(LOG_TAG, "Subscribing to topic: " + topic);
- FirebaseMessaging.getInstance().subscribeToTopic(topic);
+ private void subscribeToTopic(String topic, String registrationToken) throws IOException
+ {
+ try {
+ if (topic != null) {
+ Log.d(LOG_TAG, "Subscribing to topic: " + topic);
+ GcmPubSub.getInstance(getApplicationContext()).subscribe(registrationToken, getTopicPath(topic), null);
+ }
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "Failed to subscribe to topic: " + topic, e);
+ throw e;
}
}
@@ -363,20 +358,29 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
if (topics != null) {
String topic = null;
for (int i=0; i<topics.length(); i++) {
- topic = topics.optString(i, null);
- unsubscribeFromTopic(topic, registrationToken);
- if (topic != null) {
- Log.d(LOG_TAG, "Unsubscribing to topic: " + topic);
- FirebaseMessaging.getInstance().unsubscribeFromTopic(topic);
+ try {
+ topic = topics.optString(i, null);
+ if (topic != null) {
+ Log.d(LOG_TAG, "Unsubscribing to topic: " + topic);
+ GcmPubSub.getInstance(getApplicationContext()).unsubscribe(registrationToken, getTopicPath(topic));
+ }
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "Failed to unsubscribe to topic: " + topic, e);
}
}
}
}
- private void unsubscribeFromTopic(String topic, String registrationToken) {
- if (topic != null) {
- Log.d(LOG_TAG, "Unsubscribing to topic: " + topic);
- FirebaseMessaging.getInstance().unsubscribeFromTopic(topic);
+ private void unsubscribeFromTopic(String topic, String registrationToken) throws IOException
+ {
+ try {
+ if (topic != null) {
+ Log.d(LOG_TAG, "Unsubscribing to topic: " + topic);
+ GcmPubSub.getInstance(getApplicationContext()).unsubscribe(registrationToken, getTopicPath(topic));
+ }
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "Failed to unsubscribe to topic: " + topic, e);
+ throw e;
}
}
@@ -409,9 +413,6 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
else if (key.equals(FOREGROUND)) {
additionalData.put(key, extras.getBoolean(FOREGROUND));
}
- else if (key.equals(DISMISSED)) {
- additionalData.put(key, extras.getBoolean(DISMISSED));
- }
else if ( value instanceof String ) {
String strValue = (String)value;
try {
@@ -443,13 +444,6 @@ public class PushPlugin extends CordovaPlugin implements PushConstants {
return null;
}
- private String getStringResourceByName(String aString) {
- Activity activity = cordova.getActivity();
- String packageName = activity.getPackageName();
- int resId = activity.getResources().getIdentifier(aString, "string", packageName);
- return activity.getString(resId);
- }
-
public static boolean isInForeground() {
return gForeground;
}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/RegistrationIntentService.java b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/RegistrationIntentService.java
new file mode 100644
index 00000000..b181e88e
--- /dev/null
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/android/com/adobe/phonegap/push/RegistrationIntentService.java
@@ -0,0 +1,38 @@
+package com.adobe.phonegap.push;
+
+import android.content.Context;
+
+import android.app.IntentService;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.util.Log;
+
+import com.google.android.gms.gcm.GoogleCloudMessaging;
+import com.google.android.gms.iid.InstanceID;
+
+import java.io.IOException;
+
+public class RegistrationIntentService extends IntentService implements PushConstants {
+ public static final String LOG_TAG = "PushPlugin_RegistrationIntentService";
+
+ public RegistrationIntentService() {
+ super(LOG_TAG);
+ }
+
+ @Override
+ protected void onHandleIntent(Intent intent) {
+ SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE);
+
+ try {
+ InstanceID instanceID = InstanceID.getInstance(this);
+ String senderID = sharedPreferences.getString(SENDER_ID, "");
+ String token = instanceID.getToken(senderID,
+ GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
+ PushPlugin.setRegistrationID(token);
+ Log.i(LOG_TAG, "new GCM Registration Token: " + token);
+
+ } catch (Exception e) {
+ Log.d(LOG_TAG, "Failed to complete token refresh", e);
+ }
+ }
+}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/browser/manifest.json b/StoneIsland/plugins/phonegap-plugin-push/src/browser/manifest.json
index eff52c74..ce8390ab 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/browser/manifest.json
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/browser/manifest.json
@@ -1,4 +1,4 @@
{
"name": "Push Demo",
- "gcm_sender_id": "996231231186"
+ "gcm_sender_id": "85075801930"
}
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.h b/StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.h
index 4cc1dcb0..276a0080 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.h
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.h
@@ -29,7 +29,7 @@
@protocol GGLInstanceIDDelegate;
@protocol GCMReceiverDelegate;
-@interface PushPlugin : CDVPlugin
+@interface PushPlugin : CDVPlugin<GGLInstanceIDDelegate, GCMReceiverDelegate>
{
NSDictionary *notificationMessage;
BOOL isInline;
@@ -68,12 +68,13 @@
- (void)didSendDataMessageWithID:(NSString *)messageID;
- (void)didDeleteMessagesOnServer;
-// FCM Features
-@property(nonatomic, assign) BOOL usesFCM;
-@property(nonatomic, strong) NSNumber *fcmSandbox;
-@property(nonatomic, strong) NSString *fcmSenderId;
-@property(nonatomic, strong) NSDictionary *fcmRegistrationOptions;
-@property(nonatomic, strong) NSString *fcmRegistrationToken;
-@property(nonatomic, strong) NSArray *fcmTopics;
+// GCM Features
+@property(nonatomic, assign) BOOL usesGCM;
+@property(nonatomic, strong) NSNumber* gcmSandbox;
+@property(nonatomic, strong) NSString *gcmSenderId;
+@property(nonatomic, strong) NSDictionary *gcmRegistrationOptions;
+@property(nonatomic, strong) void (^gcmRegistrationHandler) (NSString *registrationToken, NSError *error);
+@property(nonatomic, strong) NSString *gcmRegistrationToken;
+@property(nonatomic, strong) NSArray *gcmTopics;
@end
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.m b/StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.m
index 90475d10..a176b9af 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.m
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/ios/PushPlugin.m
@@ -27,9 +27,8 @@
#define GMP_NO_MODULES true
#import "PushPlugin.h"
-@import FirebaseInstanceID;
-@import FirebaseMessaging;
-@import FirebaseAnalytics;
+#import "GoogleCloudMessaging.h"
+#import "GGLInstanceIDHeaders.h"
@implementation PushPlugin : CDVPlugin
@@ -43,62 +42,78 @@
@synthesize clearBadge;
@synthesize handlerObj;
-@synthesize usesFCM;
-@synthesize fcmSandbox;
-@synthesize fcmSenderId;
-@synthesize fcmRegistrationOptions;
-@synthesize fcmRegistrationToken;
-@synthesize fcmTopics;
+@synthesize usesGCM;
+@synthesize gcmSandbox;
+@synthesize gcmSenderId;
+@synthesize gcmRegistrationOptions;
+@synthesize gcmRegistrationHandler;
+@synthesize gcmRegistrationToken;
+@synthesize gcmTopics;
--(void)initRegistration;
+-(void)initGCMRegistrationHandler;
{
- NSString * registrationToken = [[FIRInstanceID instanceID] token];
+ __weak __block PushPlugin *weakSelf = self;
+ gcmRegistrationHandler = ^(NSString *registrationToken, NSError *error){
+ if (registrationToken != nil) {
+ NSLog(@"GCM Registration Token: %@", registrationToken);
+ [weakSelf setGcmRegistrationToken: registrationToken];
- if (registrationToken != nil) {
- NSLog(@"FCM Registration Token: %@", registrationToken);
- [self setFcmRegistrationToken: registrationToken];
-
- id topics = [self fcmTopics];
- if (topics != nil) {
- for (NSString *topic in topics) {
- NSLog(@"subscribe to topic: %@", topic);
- id pubSub = [FIRMessaging messaging];
- [pubSub subscribeToTopic:topic];
+ id topics = [weakSelf gcmTopics];
+ if (topics != nil) {
+ for (NSString *topic in topics) {
+ NSLog(@"subscribe from topic: %@", topic);
+ id pubSub = [GCMPubSub sharedInstance];
+ [pubSub subscribeWithToken: [weakSelf gcmRegistrationToken]
+ topic:[NSString stringWithFormat:@"/topics/%@", topic]
+ options:nil
+ handler:^void(NSError *error) {
+ if (error) {
+ if (error.code == 3001) {
+ NSLog(@"Already subscribed to %@", topic);
+ } else {
+ NSLog(@"Failed to subscribe to topic %@: %@", topic, error);
+ }
+ }
+ else {
+ NSLog(@"Successfully subscribe to topic %@", topic);
+ }
+ }];
+ }
}
- }
-
- [self registerWithToken:registrationToken];
- } else {
- NSLog(@"FCM token is null");
- }
+ [weakSelf registerWithToken:registrationToken];
+ } else {
+ NSLog(@"Registration to GCM failed with error: %@", error.localizedDescription);
+ [weakSelf failWithMessage:self.callbackId withMsg:@"" withError:error];
+ }
+ };
}
-// FCM refresh token
+// GCM refresh token
// Unclear how this is testable under normal circumstances
- (void)onTokenRefresh {
#if !TARGET_IPHONE_SIMULATOR
// A rotation of the registration tokens is happening, so the app needs to request a new token.
- NSLog(@"The FCM registration token needs to be changed.");
- [[FIRInstanceID instanceID] token];
- [self initRegistration];
+ NSLog(@"The GCM registration token needs to be changed.");
+ [[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:[self gcmSenderId]
+ scope:kGGLInstanceIDScopeGCM
+ options:[self gcmRegistrationOptions]
+ handler:[self gcmRegistrationHandler]];
#endif
}
-// contains error info
-- (void)sendDataMessageFailure:(NSNotification *)notification {
- NSLog(@"sendDataMessageFailure");
-}
-- (void)sendDataMessageSuccess:(NSNotification *)notification {
- NSLog(@"sendDataMessageSuccess");
-}
-
-- (void)didSendDataMessageWithID:messageID {
- NSLog(@"didSendDataMessageWithID");
+- (void)willSendDataMessageWithID:(NSString *)messageID error:(NSError *)error {
+ NSLog(@"willSendDataMessageWithID");
+ if (error) {
+ // Failed to send the message.
+ } else {
+ // Will send message, you can save the messageID to track the message
+ }
}
-- (void)willSendDataMessageWithID:messageID error:error {
+- (void)didSendDataMessageWithID:(NSString *)messageID {
NSLog(@"willSendDataMessageWithID");
+ // Did successfully send message identified by messageID
}
- (void)didDeleteMessagesOnServer {
@@ -113,10 +128,20 @@
NSArray* topics = [command argumentAtIndex:0];
if (topics != nil) {
- id pubSub = [FIRMessaging messaging];
+ id pubSub = [GCMPubSub sharedInstance];
for (NSString *topic in topics) {
NSLog(@"unsubscribe from topic: %@", topic);
- [pubSub unsubscribeFromTopic:topic];
+ [pubSub unsubscribeWithToken: [self gcmRegistrationToken]
+ topic:[NSString stringWithFormat:@"/topics/%@", topic]
+ options:nil
+ handler:^void(NSError *error) {
+ if (error) {
+ NSLog(@"Failed to unsubscribe from topic %@: %@", topic, error);
+ }
+ else {
+ NSLog(@"Successfully unsubscribe from topic %@", topic);
+ }
+ }];
}
} else {
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
@@ -130,10 +155,25 @@
if (topic != nil) {
NSLog(@"subscribe from topic: %@", topic);
- id pubSub = [FIRMessaging messaging];
- [pubSub subscribeToTopic:topic];
- NSLog(@"Successfully subscribe to topic %@", topic);
- [self successWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Successfully subscribe to topic %@", topic]];
+ id pubSub = [GCMPubSub sharedInstance];
+ [pubSub subscribeWithToken: [self gcmRegistrationToken]
+ topic:[NSString stringWithFormat:@"/topics/%@", topic]
+ options:nil
+ handler:^void(NSError *error) {
+ if (error) {
+ if (error.code == 3001) {
+ NSLog(@"Already subscribed to %@", topic);
+ [self successWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Already subscribed to %@", topic]];
+ } else {
+ NSLog(@"Failed to subscribe to topic %@: %@", topic, error);
+ [self failWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Failed to subscribe to topic %@", topic] withError:error];
+ }
+ }
+ else {
+ NSLog(@"Successfully subscribe to topic %@", topic);
+ [self successWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Successfully subscribe to topic %@", topic]];
+ }
+ }];
} else {
NSLog(@"There is no topic to subscribe");
[self successWithMessage:command.callbackId withMsg:@"There is no topic to subscribe"];
@@ -146,10 +186,19 @@
if (topic != nil) {
NSLog(@"unsubscribe from topic: %@", topic);
- id pubSub = [FIRMessaging messaging];
- [pubSub unsubscribeFromTopic:topic];
- NSLog(@"Successfully unsubscribe from topic %@", topic);
- [self successWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Successfully unsubscribe from topic %@", topic]];
+ id pubSub = [GCMPubSub sharedInstance];
+ [pubSub unsubscribeWithToken: [self gcmRegistrationToken]
+ topic:[NSString stringWithFormat:@"/topics/%@", topic]
+ options:nil
+ handler:^void(NSError *error) {
+ if (error) {
+ NSLog(@"Failed to unsubscribe to topic %@: %@", topic, error);
+ [self failWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Failed to unsubscribe to topic %@", topic] withError:error];
+ } else {
+ NSLog(@"Successfully unsubscribe to topic %@", topic);
+ [self successWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Successfully unsubscribe to topic %@", topic]];
+ }
+ }];
} else {
NSLog(@"There is no topic to unsubscribe");
[self successWithMessage:command.callbackId withMsg:@"There is no topic to unsubscribe"];
@@ -158,22 +207,6 @@
- (void)init:(CDVInvokedUrlCommand*)command;
{
- [[NSNotificationCenter defaultCenter]
- addObserver:self selector:@selector(onTokenRefresh)
- name:kFIRInstanceIDTokenRefreshNotification object:nil];
-
- [[NSNotificationCenter defaultCenter]
- addObserver:self selector:@selector(sendDataMessageFailure:)
- name:FIRMessagingSendErrorNotification object:nil];
-
- [[NSNotificationCenter defaultCenter]
- addObserver:self selector:@selector(sendDataMessageSuccess:)
- name:FIRMessagingSendSuccessNotification object:nil];
-
- [[NSNotificationCenter defaultCenter]
- addObserver:self selector:@selector(didDeleteMessagesOnServer)
- name:FIRMessagingMessagesDeletedNotification object:nil];
-
[self.commandDelegate runInBackground:^ {
NSLog(@"Push Plugin register called");
@@ -182,10 +215,13 @@
NSMutableDictionary* options = [command.arguments objectAtIndex:0];
NSMutableDictionary* iosOptions = [options objectForKey:@"ios"];
- NSArray* topics = [iosOptions objectForKey:@"topics"];
- [self setFcmTopics:topics];
+ NSArray* topics = [iosOptions objectForKey:@"topics"];
+ [self setGcmTopics:topics];
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone;
+#endif
+ UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone;
id badgeArg = [iosOptions objectForKey:@"badge"];
id soundArg = [iosOptions objectForKey:@"sound"];
@@ -194,20 +230,32 @@
if (([badgeArg isKindOfClass:[NSString class]] && [badgeArg isEqualToString:@"true"]) || [badgeArg boolValue])
{
+ notificationTypes |= UIRemoteNotificationTypeBadge;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeBadge;
+#endif
}
if (([soundArg isKindOfClass:[NSString class]] && [soundArg isEqualToString:@"true"]) || [soundArg boolValue])
{
+ notificationTypes |= UIRemoteNotificationTypeSound;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeSound;
+#endif
}
if (([alertArg isKindOfClass:[NSString class]] && [alertArg isEqualToString:@"true"]) || [alertArg boolValue])
{
+ notificationTypes |= UIRemoteNotificationTypeAlert;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationTypeAlert;
+#endif
}
+ notificationTypes |= UIRemoteNotificationTypeNewsstandContentAvailability;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UserNotificationTypes |= UIUserNotificationActivationModeBackground;
+#endif
if (clearBadgeArg == nil || ([clearBadgeArg isKindOfClass:[NSString class]] && [clearBadgeArg isEqualToString:@"false"]) || ![clearBadgeArg boolValue]) {
NSLog(@"PushPlugin.register: setting badge to false");
@@ -219,8 +267,12 @@
}
NSLog(@"PushPlugin.register: clear badge is set to %d", clearBadge);
+ if (notificationTypes == UIRemoteNotificationTypeNone)
+ NSLog(@"PushPlugin.register: Push notification type is set to none");
+
isInline = NO;
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
NSLog(@"PushPlugin.register: better button setup");
// setup action buttons
NSMutableSet *categories = [[NSMutableSet alloc] init];
@@ -277,46 +329,45 @@
}
}
+#else
+ NSLog(@"PushPlugin.register: action buttons only supported on iOS8 and above");
+#endif
+
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
if ([[UIApplication sharedApplication]respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UserNotificationTypes categories:categories];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
+ } else {
+ [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
+ (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
-
- // Read GoogleService-Info.plist
- NSString *path = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
-
- // Load the file content and read the data into arrays
- NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
- fcmSenderId = [dict objectForKey:@"GCM_SENDER_ID"];
- BOOL isGcmEnabled = [[dict valueForKey:@"IS_GCM_ENABLED"] boolValue];
-
- NSLog(@"FCM Sender ID %@", fcmSenderId);
+#else
+ [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
+ (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
+#endif
// GCM options
- [self setFcmSenderId: fcmSenderId];
- if(isGcmEnabled && [[self fcmSenderId] length] > 0) {
- NSLog(@"Using FCM Notification");
- [self setUsesFCM: YES];
- dispatch_async(dispatch_get_main_queue(), ^{
- if([FIRApp defaultApp] == nil)
- [FIRApp configure];
- [self initRegistration];
- });
+ [self setGcmSenderId: [iosOptions objectForKey:@"senderID"]];
+ NSLog(@"GCM Sender ID %@", gcmSenderId);
+ if([[self gcmSenderId] length] > 0) {
+ NSLog(@"Using GCM Notification");
+ [self setUsesGCM: YES];
+ [self initGCMRegistrationHandler];
} else {
NSLog(@"Using APNS Notification");
- [self setUsesFCM:NO];
+ [self setUsesGCM:NO];
}
- id fcmSandboxArg = [iosOptions objectForKey:@"fcmSandbox"];
+ id gcmSandBoxArg = [iosOptions objectForKey:@"gcmSandbox"];
- [self setFcmSandbox:@NO];
- if ([self usesFCM] &&
- (([fcmSandboxArg isKindOfClass:[NSString class]] && [fcmSandboxArg isEqualToString:@"true"]) ||
- [fcmSandboxArg boolValue]))
+ [self setGcmSandbox:@NO];
+ if ([self usesGCM] &&
+ (([gcmSandBoxArg isKindOfClass:[NSString class]] && [gcmSandBoxArg isEqualToString:@"true"]) ||
+ [gcmSandBoxArg boolValue]))
{
- NSLog(@"Using FCM Sandbox");
- [self setFcmSandbox:@YES];
+ NSLog(@"Using GCM Sandbox");
+ [self setGcmSandbox:@YES];
}
if (notificationMessage) { // if there is a pending startup notification
@@ -371,8 +422,14 @@
[results setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] forKey:@"appVersion"];
// Check what Notifications the user has turned on. We registered for all three, but they may have manually disabled some or all of them.
+#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
- NSUInteger rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
+ NSUInteger rntypes;
+ if (!SYSTEM_VERSION_LESS_THAN(@"8.0")) {
+ rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
+ } else {
+ rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
+ }
// Set the defaults to disabled unless we find otherwise...
NSString *pushBadge = @"disabled";
@@ -383,13 +440,13 @@
// one is actually disabled. So we are literally checking to see if rnTypes matches what is turned on, instead of by number. The "tricky" part is that the
// single notification types will only match if they are the ONLY one enabled. Likewise, when we are checking for a pair of notifications, it will only be
// true if those two notifications are on. This is why the code is written this way
- if(rntypes & UIUserNotificationTypeBadge){
+ if(rntypes & UIRemoteNotificationTypeBadge){
pushBadge = @"enabled";
}
- if(rntypes & UIUserNotificationTypeAlert) {
+ if(rntypes & UIRemoteNotificationTypeAlert) {
pushAlert = @"enabled";
}
- if(rntypes & UIUserNotificationTypeSound) {
+ if(rntypes & UIRemoteNotificationTypeSound) {
pushSound = @"enabled";
}
@@ -403,7 +460,24 @@
[results setValue:dev.model forKey:@"deviceModel"];
[results setValue:dev.systemVersion forKey:@"deviceSystemVersion"];
- if(![self usesFCM]) {
+ if([self usesGCM]) {
+ GGLInstanceIDConfig *instanceIDConfig = [GGLInstanceIDConfig defaultConfig];
+ instanceIDConfig.delegate = self;
+ [[GGLInstanceID sharedInstance] startWithConfig:instanceIDConfig];
+
+ [self setGcmRegistrationOptions: @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
+ kGGLInstanceIDAPNSServerTypeSandboxOption:[self gcmSandbox]}];
+
+ [[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:[self gcmSenderId]
+ scope:kGGLInstanceIDScopeGCM
+ options:[self gcmRegistrationOptions]
+ handler:[self gcmRegistrationHandler]];
+
+ GCMConfig *gcmConfig = [GCMConfig defaultConfig];
+ gcmConfig.receiverDelegate = self;
+ [[GCMService sharedInstance] startWithConfig:gcmConfig];
+
+ } else {
[self registerWithToken: token];
}
#endif
@@ -536,36 +610,31 @@
[self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
}
--(void)successWithMessage:(NSString *)myCallbackId withMsg:(NSString *)message
+-(void)successWithMessage:(NSString *)callbackId withMsg:(NSString *)message
{
- if (myCallbackId != nil)
+ if (callbackId != nil)
{
CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
- [self.commandDelegate sendPluginResult:commandResult callbackId:myCallbackId];
+ [self.commandDelegate sendPluginResult:commandResult callbackId:callbackId];
}
}
-(void)registerWithToken:(NSString*)token; {
// Send result to trigger 'registration' event but keep callback
- NSMutableDictionary* message = [NSMutableDictionary dictionaryWithCapacity:2];
+ NSMutableDictionary* message = [NSMutableDictionary dictionaryWithCapacity:1];
[message setObject:token forKey:@"registrationId"];
- if ([self usesFCM]) {
- [message setObject:@"FCM" forKey:@"registrationType"];
- } else {
- [message setObject:@"APNS" forKey:@"registrationType"];
- }
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message];
[pluginResult setKeepCallbackAsBool:YES];
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
}
--(void)failWithMessage:(NSString *)myCallbackId withMsg:(NSString *)message withError:(NSError *)error
+-(void)failWithMessage:(NSString *)callbackId withMsg:(NSString *)message withError:(NSError *)error
{
NSString *errorMessage = (error) ? [NSString stringWithFormat:@"%@ - %@", message, [error localizedDescription]] : message;
CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMessage];
- [self.commandDelegate sendPluginResult:commandResult callbackId:myCallbackId];
+ [self.commandDelegate sendPluginResult:commandResult callbackId:callbackId];
}
-(void) finish:(CDVInvokedUrlCommand*)command
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/js/push.js b/StoneIsland/plugins/phonegap-plugin-push/src/js/push.js
deleted file mode 100644
index 150af344..00000000
--- a/StoneIsland/plugins/phonegap-plugin-push/src/js/push.js
+++ /dev/null
@@ -1,316 +0,0 @@
-/* global cordova:false */
-/* globals window */
-
-/*!
- * Module dependencies.
- */
-
-const exec = cordova.require('cordova/exec');
-
-class PushNotification {
- /**
- * PushNotification constructor.
- *
- * @param {Object} options to initiate Push Notifications.
- * @return {PushNotification} instance that can be monitored and cancelled.
- */
- constructor(options) {
- this.handlers = {
- registration: [],
- notification: [],
- error: [],
- };
-
- // require options parameter
- if (typeof options === 'undefined') {
- throw new Error('The options argument is required.');
- }
-
- // store the options to this object instance
- this.options = options;
-
- // triggered on registration and notification
- const success = (result) => {
- if (result && typeof result.registrationId !== 'undefined') {
- this.emit('registration', result);
- } else if (result && result.additionalData &&
- typeof result.additionalData.actionCallback !== 'undefined') {
- const executeFuctionOrEmitEventByName = (functionName, context, ...args) => {
- const namespaces = functionName.split('.');
- const func = namespaces.pop();
- for (let i = 0; i < namespaces.length; i++) {
- context = context[namespaces[i]];
- }
-
- if (typeof context[func] === 'function') {
- context[func].call(context, args);
- } else {
- this.emit(functionName, args);
- }
- };
-
- executeFuctionOrEmitEventByName(result.additionalData.actionCallback, window, result);
- } else if (result) {
- this.emit('notification', result);
- }
- };
-
- // triggered on error
- const fail = (msg) => {
- const e = (typeof msg === 'string') ? new Error(msg) : msg;
- this.emit('error', e);
- };
-
- // wait at least one process tick to allow event subscriptions
- setTimeout(() => {
- exec(success, fail, 'PushNotification', 'init', [options]);
- }, 10);
- }
-
- /**
- * Unregister from push notifications
- */
- unregister(successCallback, errorCallback = () => {}, options) {
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.unregister failure: failure parameter not a function');
- return;
- }
-
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.unregister failure: success callback parameter ' +
- ' must be a function');
- return;
- }
-
- const cleanHandlersAndPassThrough = () => {
- if (!options) {
- this.handlers = {
- registration: [],
- notification: [],
- error: [],
- };
- }
- successCallback();
- };
-
- exec(cleanHandlersAndPassThrough, errorCallback, 'PushNotification', 'unregister', [options]);
- }
-
- /**
- * subscribe to a topic
- * @param {String} topic topic to subscribe
- * @param {Function} successCallback success callback
- * @param {Function} errorCallback error callback
- * @return {void}
- */
- subscribe(topic, successCallback, errorCallback = () => {}) {
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.subscribe failure: ' +
- 'failure parameter not a function');
- return;
- }
-
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.subscribe failure: ' +
- 'success callback parameter must be a function');
- return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'subscribe', [topic]);
- }
-
- /**
- * unsubscribe to a topic
- * @param {String} topic topic to unsubscribe
- * @param {Function} successCallback success callback
- * @param {Function} errorCallback error callback
- * @return {void}
- */
- unsubscribe(topic, successCallback, errorCallback = () => {}) {
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.unsubscribe failure: failure parameter not a function');
- return;
- }
-
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.unsubscribe failure: ' +
- 'success callback parameter must be a function');
- return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'unsubscribe', [topic]);
- }
-
-
- /**
- * Call this to set the application icon badge
- */
- setApplicationIconBadgeNumber(successCallback, errorCallback = () => {}, badge) {
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.setApplicationIconBadgeNumber failure: failure ' +
- 'parameter not a function');
- return;
- }
-
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.setApplicationIconBadgeNumber failure: success ' +
- 'callback parameter must be a function');
- return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification',
- 'setApplicationIconBadgeNumber', [{ badge }]);
- }
-
- /**
- * Get the application icon badge
- */
-
- getApplicationIconBadgeNumber(successCallback, errorCallback = () => {}) {
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.getApplicationIconBadgeNumber failure: failure ' +
- 'parameter not a function');
- return;
- }
-
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.getApplicationIconBadgeNumber failure: success ' +
- 'callback parameter must be a function');
- return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'getApplicationIconBadgeNumber', []);
- }
-
- /**
- * Clear all notifications
- */
-
- clearAllNotifications(successCallback = () => {}, errorCallback = () => {}) {
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.clearAllNotifications failure: failure parameter ' +
- 'not a function');
- return;
- }
-
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.clearAllNotifications failure: success callback ' +
- 'parameter must be a function');
- return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'clearAllNotifications', []);
- }
- /**
- * Listen for an event.
- *
- * The following events are supported:
- *
- * - registration
- * - notification
- * - error
- *
- * @param {String} eventName to subscribe to.
- * @param {Function} callback triggered on the event.
- */
-
- on(eventName, callback) {
- if (!this.handlers.hasOwnProperty(eventName)) {
- this.handlers[eventName] = [];
- }
- this.handlers[eventName].push(callback);
- }
-
- /**
- * Remove event listener.
- *
- * @param {String} eventName to match subscription.
- * @param {Function} handle function associated with event.
- */
-
- off(eventName, handle) {
- if (this.handlers.hasOwnProperty(eventName)) {
- const handleIndex = this.handlers[eventName].indexOf(handle);
- if (handleIndex >= 0) {
- this.handlers[eventName].splice(handleIndex, 1);
- }
- }
- }
-
- /**
- * Emit an event.
- *
- * This is intended for internal use only.
- *
- * @param {String} eventName is the event to trigger.
- * @param {*} all arguments are passed to the event listeners.
- *
- * @return {Boolean} is true when the event is triggered otherwise false.
- */
-
- emit(...args) {
- const eventName = args.shift();
-
- if (!this.handlers.hasOwnProperty(eventName)) {
- return false;
- }
-
- for (let i = 0, length = this.handlers[eventName].length; i < length; i++) {
- const callback = this.handlers[eventName][i];
- if (typeof callback === 'function') {
- callback.apply(undefined, args);
- } else {
- console.log(`event handler: ${eventName} must be a function`);
- }
- }
-
- return true;
- }
-
- finish(successCallback = () => {}, errorCallback = () => {}, id = 'handler') {
- if (typeof successCallback !== 'function') {
- console.log('finish failure: success callback parameter must be a function');
- return;
- }
-
- if (typeof errorCallback !== 'function') {
- console.log('finish failure: failure parameter not a function');
- return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'finish', [id]);
- }
-}
-
-/*!
- * Push Notification Plugin.
- */
-
-module.exports = {
- /**
- * Register for Push Notifications.
- *
- * This method will instantiate a new copy of the PushNotification object
- * and start the registration process.
- *
- * @param {Object} options
- * @return {PushNotification} instance
- */
-
- init: (options) => {
- return new PushNotification(options);
- },
-
- hasPermission: (successCallback, errorCallback) => {
- exec(successCallback, errorCallback, 'PushNotification', 'hasPermission', []);
- },
-
- /**
- * PushNotification Object.
- *
- * Expose the PushNotification object for direct use
- * and testing. Typically, you should use the
- * .init helper method.
- */
- PushNotification,
-};
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/windows/PushPluginProxy.js b/StoneIsland/plugins/phonegap-plugin-push/src/windows/PushPluginProxy.js
index eb552dc0..ac04f39d 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/src/windows/PushPluginProxy.js
+++ b/StoneIsland/plugins/phonegap-plugin-push/src/windows/PushPluginProxy.js
@@ -88,12 +88,6 @@ module.exports = {
} catch(ex) {
onFail(ex);
}
- },
- subscribe: function() {
- console.log("Subscribe is unsupported");
- },
- unsubscribe: function() {
- console.log("Subscribe is unsupported");
}
};
require("cordova/exec/proxy").add("PushNotification", module.exports);
diff --git a/StoneIsland/plugins/phonegap-plugin-push/types/index.d.ts b/StoneIsland/plugins/phonegap-plugin-push/types/index.d.ts
deleted file mode 100644
index b47335c2..00000000
--- a/StoneIsland/plugins/phonegap-plugin-push/types/index.d.ts
+++ /dev/null
@@ -1,302 +0,0 @@
-// Type definitions for phonegap-plugin-push
-// Project: https://github.com/phonegap/phonegap-plugin-push
-// Definitions by: Frederico Galvão <https://github.com/fredgalvao>
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-declare namespace PhonegapPluginPush {
- type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error
-
- interface PushNotification {
- /**
- * The event registration will be triggered on each successful registration with the 3rd party push service.
- * @param event
- * @param callback
- */
- on(event: "registration", callback: (response: RegistrationEventResponse) => any): void
- /**
- * The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
- * @param event
- * @param callback
- */
- on(event: "notification", callback: (response: NotificationEventResponse) => any): void
- /**
- * The event error will trigger when an internal error occurs and the cache is aborted.
- * @param event
- * @param callback
- */
- on(event: "error", callback: (response: Error) => any): void
- /**
- *
- * @param event Name of the event to listen to. See below(above) for all the event names.
- * @param callback is called when the event is triggered.
- * @param event
- * @param callback
- */
- on(event: string, callback: (response: EventResponse) => any): void
-
- off(event: "registration", callback: (response: RegistrationEventResponse) => any): void
- off(event: "notification", callback: (response: NotificationEventResponse) => any): void
- off(event: "error", callback: (response: Error) => any): void
- /**
- * As stated in the example, you will have to store your event handler if you are planning to remove it.
- * @param event Name of the event type. The possible event names are the same as for the push.on function.
- * @param callback handle to the function to get removed.
- * @param event
- * @param callback
- */
- off(event: string, callback: (response: EventResponse) => any): void
-
- /**
- * The unregister method is used when the application no longer wants to receive push notifications.
- * Beware that this cleans up all event handlers previously registered,
- * so you will need to re-register them if you want them to function again without an application reload.
- * @param successHandler
- * @param errorHandler
- * @param topics
- */
- unregister(successHandler: () => any, errorHandler?: () => any, topics?: string[]): void
-
- /**
- * The subscribe method is used when the application wants to subscribe a new topic to receive push notifications.
- * @param topic Topic to subscribe to.
- * @param successHandler Is called when the api successfully unregisters.
- * @param errorHandler Is called when the api encounters an error while unregistering.
- */
- subscribe(topic: string, successHandler: () => any, errorHandler: () => any): void;
-
- /**
- * The unsubscribe method is used when the application no longer wants to receive push notifications
- * from a specific topic but continue to receive other push messages.
- * @param topic Topic to unsubscribe from.
- * @param successHandler Is called when the api successfully unregisters.
- * @param errorHandler Is called when the api encounters an error while unregistering.
- */
- unsubscribe(topic: string, successHandler: () => any, errorHandler: () => any): void;
-
- /*TODO according to js source code, "errorHandler" is optional, but is "count" also optional? I can't read objetive-C code (can anyone at all? I wonder...)*/
- /**
- * Set the badge count visible when the app is not running
- *
- * The count is an integer indicating what number should show up in the badge.
- * Passing 0 will clear the badge.
- * Each notification event contains a data.count value which can be used to set the badge to correct number.
- * @param successHandler
- * @param errorHandler
- * @param count
- */
- setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count: number): void
-
- /**
- * Get the current badge count visible when the app is not running
- * successHandler gets called with an integer which is the current badge count
- * @param successHandler
- * @param errorHandler
- */
- getApplicationIconBadgeNumber(successHandler: (count: number) => any, errorHandler: () => any): void
-
- /**
- * iOS only
- * Tells the OS that you are done processing a background push notification.
- * successHandler gets called when background push processing is successfully completed.
- * @param successHandler
- * @param errorHandler
- * @param id
- */
- finish(successHandler?: () => any, errorHandler?: () => any, id?: string): void
-
- /**
- * Tells the OS to clear all notifications from the Notification Center
- * @param successHandler Is called when the api successfully clears the notifications.
- * @param errorHandler Is called when the api encounters an error when attempting to clears the notifications.
- */
- clearAllNotifications(successHandler: () => any, errorHandler: () => any): void
- }
-
- /**
- * platform specific initialization options.
- */
- interface InitOptions {
- /**
- * Android specific initialization options.
- */
- android?: {
- /**
- * Maps to the project number in the Google Developer Console.
- */
- senderID: string
- /**
- * The name of a drawable resource to use as the small-icon. The name should not include the extension.
- */
- icon?: string
- /**
- * Sets the background color of the small icon on Android 5.0 and greater.
- * Supported Formats - http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String)
- */
- iconColor?: string
- /**
- * If true it plays the sound specified in the push data or the default system sound. Default is true.
- */
- sound?: boolean
- /**
- * If true the device vibrates on receipt of notification. Default is true.
- */
- vibrate?: boolean
- /**
- * If true the app clears all pending notifications when it is closed. Default is true.
- */
- clearNotifications?: boolean
- /**
- * If true will always show a notification, even when the app is on the foreground. Default is false.
- */
- forceShow?: boolean
- /**
- * If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic.
- */
- topics?: string[]
- }
-
- /**
- * iOS specific initialization options.
- */
- ios?: {
- /**
- * If true|"true" the device sets the badge number on receipt of notification.
- * Default is false|"false".
- * Note: the value you set this option to the first time you call the init method will be how the application always acts.
- * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name.
- * This is normal iOS behaviour.
- */
- badge?: boolean | string
- /**
- * If true|"true" the device plays a sound on receipt of notification.
- * Default is false|"false".
- * Note: the value you set this option to the first time you call the init method will be how the application always acts.
- * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name.
- * This is normal iOS behaviour.
- */
- sound?: boolean | string
- /**
- * If true|"true" the device shows an alert on receipt of notification.
- * Default is false|"false".
- * Note: the value you set this option to the first time you call the init method will be how the application always acts.
- * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name.
- * This is normal iOS behaviour.
- */
- alert?: boolean | string
- /**
- * If true|"true" the badge will be cleared on app startup. Default is false|"false".
- */
- clearBadge?: boolean | string
- /**
- * The data required in order to enable Action Buttons for iOS.
- * Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1
- */
- categories?: CategoryArray
- /**
- * Maps to the project number in the Google Developer Console. Setting this uses GCM for notifications instead of native
- */
- senderID?: string
- /**
- * Whether to use prod or sandbox GCM setting. Defaults to false.
- */
- gcmSandbox?: boolean
- /**
- * If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic. Note: only usable in conjunction with senderID
- */
- topics?: string[]
- }
-
- /**
- * Windows specific initialization options.
- */
- windows?: {
-
- }
- }
-
- interface CategoryArray {
- [name: string]: CategoryAction
- }
-
- interface CategoryAction {
- yes?: CategoryActionData
- no?: CategoryActionData
- maybe?: CategoryActionData
- }
-
- interface CategoryActionData {
- callback: string
- title: string
- foreground: boolean
- destructive: boolean
- }
-
- interface RegistrationEventResponse {
- /**
- * The registration ID provided by the 3rd party remote push service.
- */
- registrationId: string
- }
-
- interface NotificationEventResponse {
- /**
- * The text of the push message sent from the 3rd party service.
- */
- message: string
- /**
- * The optional title of the push message sent from the 3rd party service.
- */
- title?: string
- /**
- * The number of messages to be displayed in the badge iOS or message count in the notification shade in Android.
- * For windows, it represents the value in the badge notification which could be a number or a status glyph.
- */
- count: string
- /**
- * The name of the sound file to be played upon receipt of the notification.
- */
- sound: string
- /**
- * The path of the image file to be displayed in the notification.
- */
- image: string
- /**
- * An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
- */
- additionalData: NotificationEventAdditionalData
- }
-
- /**
- * TODO: document all possible properties (I only got the android ones)
- *
- * Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation
- *
- * Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one
- * so that he could specify any custom code without having to use array notation (map['prop']) for all of them.
- */
- interface NotificationEventAdditionalData {
- [name: string]: any
-
- /**
- * Whether the notification was received while the app was in the foreground
- */
- foreground?: boolean
- /**
- * Will be true if the application is started by clicking on the push notification, false if the app is already started. (Android/iOS only)
- */
- coldstart?: boolean
- collapse_key?: string
- from?: string
- notId?: string
- }
-
- interface PushNotificationStatic {
- init(options: InitOptions): PushNotification
- new (options: InitOptions): PushNotification
- }
-}
-
-interface Window {
- PushNotification: PhonegapPluginPush.PushNotificationStatic
-}
-declare var PushNotification: PhonegapPluginPush.PushNotificationStatic; \ No newline at end of file
diff --git a/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js b/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js
index 1badd77b..9b74d8a4 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js
+++ b/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js
@@ -29,12 +29,6 @@ var PushNotification = function(options) {
// store the options to this object instance
this.options = options;
- // subscription options
- var subOptions = {userVisibleOnly: true};
- if (this.options.browser && this.options.browser.applicationServerKey) {
- subOptions.applicationServerKey = urlBase64ToUint8Array(this.options.browser.applicationServerKey);
- }
-
// triggered on registration and notification
var that = this;
@@ -56,7 +50,7 @@ var PushNotification = function(options) {
})
.then(function(reg) {
serviceWorker = reg;
- reg.pushManager.subscribe(subOptions).then(function(sub) {
+ reg.pushManager.subscribe({userVisibleOnly: true}).then(function(sub) {
subscription = sub;
result = { 'registrationId': sub.endpoint.substring(sub.endpoint.lastIndexOf('/') + 1) };
that.emit('registration', result);
@@ -328,29 +322,6 @@ PushNotification.prototype.finish = function(successCallback, errorCallback, id)
* Push Notification Plugin.
*/
-/**
- * Converts the server key to an Uint8Array
- *
- * @param base64String
- *
- * @returns {Uint8Array}
- */
-function urlBase64ToUint8Array(base64String) {
- const padding = '='.repeat((4 - base64String.length % 4) % 4);
- const base64 = (base64String + padding)
- .replace(/\-/g, '+')
- .replace(/_/g, '/');
-
- const rawData = window.atob(base64);
- const outputArray = new Uint8Array(rawData.length);
-
- for (var i = 0; i < rawData.length; ++i) {
- outputArray[i] = rawData.charCodeAt(i);
- }
- return outputArray;
-}
-
-
module.exports = {
/**
* Register for Push Notifications.
diff --git a/StoneIsland/plugins/phonegap-plugin-push/www/push.js b/StoneIsland/plugins/phonegap-plugin-push/www/push.js
index 03f02e64..58c686d3 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/www/push.js
+++ b/StoneIsland/plugins/phonegap-plugin-push/www/push.js
@@ -1,15 +1,3 @@
-/**
-* This file has been generated by Babel.
-*
-* DO NOT EDIT IT DIRECTLY
-*
-* Edit the JS source file src/js/push.js
-**/'use strict';
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
/* global cordova:false */
/* globals window */
@@ -19,357 +7,320 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var exec = cordova.require('cordova/exec');
-var PushNotification = function () {
- /**
- * PushNotification constructor.
- *
- * @param {Object} options to initiate Push Notifications.
- * @return {PushNotification} instance that can be monitored and cancelled.
- */
- function PushNotification(options) {
- var _this = this;
-
- _classCallCheck(this, PushNotification);
+/**
+ * PushNotification constructor.
+ *
+ * @param {Object} options to initiate Push Notifications.
+ * @return {PushNotification} instance that can be monitored and cancelled.
+ */
- this.handlers = {
- registration: [],
- notification: [],
- error: []
+var PushNotification = function(options) {
+ this._handlers = {
+ 'registration': [],
+ 'notification': [],
+ 'error': []
};
// require options parameter
if (typeof options === 'undefined') {
- throw new Error('The options argument is required.');
+ throw new Error('The options argument is required.');
}
// store the options to this object instance
this.options = options;
// triggered on registration and notification
- var success = function success(result) {
- if (result && typeof result.registrationId !== 'undefined') {
- _this.emit('registration', result);
- } else if (result && result.additionalData && typeof result.additionalData.actionCallback !== 'undefined') {
- var executeFuctionOrEmitEventByName = function executeFuctionOrEmitEventByName(functionName, context) {
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
- args[_key - 2] = arguments[_key];
- }
-
- var namespaces = functionName.split('.');
- var func = namespaces.pop();
- for (var i = 0; i < namespaces.length; i++) {
- context = context[namespaces[i]];
- }
+ var that = this;
+ var success = function(result) {
+ if (result && typeof result.registrationId !== 'undefined') {
+ that.emit('registration', result);
+ } else if (result && result.additionalData && typeof result.additionalData.actionCallback !== 'undefined') {
+ var executeFuctionOrEmitEventByName = function(callbackName, context, arg) {
+ var namespaces = callbackName.split('.');
+ var func = namespaces.pop();
+ for (var i = 0; i < namespaces.length; i++) {
+ context = context[namespaces[i]];
+ }
- if (typeof context[func] === 'function') {
- context[func].call(context, args);
- } else {
- _this.emit(functionName, args);
- }
- };
+ if (typeof context[func] === 'function') {
+ context[func].call(context, arg);
+ } else {
+ that.emit(callbackName, arg);
+ }
+ };
- executeFuctionOrEmitEventByName(result.additionalData.actionCallback, window, result);
- } else if (result) {
- _this.emit('notification', result);
- }
+ executeFuctionOrEmitEventByName(result.additionalData.actionCallback, window, result);
+ } else if (result) {
+ that.emit('notification', result);
+ }
};
// triggered on error
- var fail = function fail(msg) {
- var e = typeof msg === 'string' ? new Error(msg) : msg;
- _this.emit('error', e);
+ var fail = function(msg) {
+ var e = (typeof msg === 'string') ? new Error(msg) : msg;
+ that.emit('error', e);
};
// wait at least one process tick to allow event subscriptions
- setTimeout(function () {
- exec(success, fail, 'PushNotification', 'init', [options]);
+ setTimeout(function() {
+ exec(success, fail, 'PushNotification', 'init', [options]);
}, 10);
- }
-
- /**
- * Unregister from push notifications
- */
-
+};
- _createClass(PushNotification, [{
- key: 'unregister',
- value: function unregister(successCallback) {
- var _this2 = this;
+/**
+ * Unregister from push notifications
+ */
- var errorCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
- var options = arguments[2];
+PushNotification.prototype.unregister = function(successCallback, errorCallback, options) {
+ if (!errorCallback) { errorCallback = function() {}; }
- if (typeof errorCallback !== 'function') {
+ if (typeof errorCallback !== 'function') {
console.log('PushNotification.unregister failure: failure parameter not a function');
return;
- }
+ }
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.unregister failure: success callback parameter ' + ' must be a function');
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.unregister failure: success callback parameter must be a function');
return;
- }
+ }
- var cleanHandlersAndPassThrough = function cleanHandlersAndPassThrough() {
+ var that = this;
+ var cleanHandlersAndPassThrough = function() {
if (!options) {
- _this2.handlers = {
- registration: [],
- notification: [],
- error: []
- };
+ that._handlers = {
+ 'registration': [],
+ 'notification': [],
+ 'error': []
+ };
}
successCallback();
- };
-
- exec(cleanHandlersAndPassThrough, errorCallback, 'PushNotification', 'unregister', [options]);
- }
+ };
- /**
- * subscribe to a topic
- * @param {String} topic topic to subscribe
- * @param {Function} successCallback success callback
- * @param {Function} errorCallback error callback
- * @return {void}
- */
+ exec(cleanHandlersAndPassThrough, errorCallback, 'PushNotification', 'unregister', [options]);
+};
- }, {
- key: 'subscribe',
- value: function subscribe(topic, successCallback) {
- var errorCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
+/**
+ * subscribe to a topic
+ * @param {String} topic topic to subscribe
+ * @param {Function} successCallback success callback
+ * @param {Function} errorCallback error callback
+ * @return {void}
+ */
+PushNotification.prototype.subscribe = function(topic, successCallback, errorCallback) {
+ if (!errorCallback) { errorCallback = function() {}; }
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.subscribe failure: ' + 'failure parameter not a function');
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.subscribe failure: failure parameter not a function');
return;
- }
+ }
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.subscribe failure: ' + 'success callback parameter must be a function');
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.subscribe failure: success callback parameter must be a function');
return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'subscribe', [topic]);
}
- /**
- * unsubscribe to a topic
- * @param {String} topic topic to unsubscribe
- * @param {Function} successCallback success callback
- * @param {Function} errorCallback error callback
- * @return {void}
- */
+ exec(successCallback, errorCallback, 'PushNotification', 'subscribe', [topic]);
+};
- }, {
- key: 'unsubscribe',
- value: function unsubscribe(topic, successCallback) {
- var errorCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
+/**
+ * unsubscribe to a topic
+ * @param {String} topic topic to unsubscribe
+ * @param {Function} successCallback success callback
+ * @param {Function} errorCallback error callback
+ * @return {void}
+ */
+PushNotification.prototype.unsubscribe = function(topic, successCallback, errorCallback) {
+ if (!errorCallback) { errorCallback = function() {}; }
- if (typeof errorCallback !== 'function') {
+ if (typeof errorCallback !== 'function') {
console.log('PushNotification.unsubscribe failure: failure parameter not a function');
return;
- }
+ }
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.unsubscribe failure: ' + 'success callback parameter must be a function');
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.unsubscribe failure: success callback parameter must be a function');
return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'unsubscribe', [topic]);
}
- /**
- * Call this to set the application icon badge
- */
+ exec(successCallback, errorCallback, 'PushNotification', 'unsubscribe', [topic]);
+};
+
+/**
+ * Call this to set the application icon badge
+ */
- }, {
- key: 'setApplicationIconBadgeNumber',
- value: function setApplicationIconBadgeNumber(successCallback) {
- var errorCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
- var badge = arguments[2];
+PushNotification.prototype.setApplicationIconBadgeNumber = function(successCallback, errorCallback, badge) {
+ if (!errorCallback) { errorCallback = function() {}; }
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.setApplicationIconBadgeNumber failure: failure ' + 'parameter not a function');
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.setApplicationIconBadgeNumber failure: failure parameter not a function');
return;
- }
+ }
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.setApplicationIconBadgeNumber failure: success ' + 'callback parameter must be a function');
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.setApplicationIconBadgeNumber failure: success callback parameter must be a function');
return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'setApplicationIconBadgeNumber', [{ badge: badge }]);
}
- /**
- * Get the application icon badge
- */
+ exec(successCallback, errorCallback, 'PushNotification', 'setApplicationIconBadgeNumber', [{badge: badge}]);
+};
- }, {
- key: 'getApplicationIconBadgeNumber',
- value: function getApplicationIconBadgeNumber(successCallback) {
- var errorCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
+/**
+ * Get the application icon badge
+ */
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.getApplicationIconBadgeNumber failure: failure ' + 'parameter not a function');
- return;
- }
+PushNotification.prototype.getApplicationIconBadgeNumber = function(successCallback, errorCallback) {
+ if (!errorCallback) { errorCallback = function() {}; }
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.getApplicationIconBadgeNumber failure: success ' + 'callback parameter must be a function');
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.getApplicationIconBadgeNumber failure: failure parameter not a function');
return;
- }
+ }
- exec(successCallback, errorCallback, 'PushNotification', 'getApplicationIconBadgeNumber', []);
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.getApplicationIconBadgeNumber failure: success callback parameter must be a function');
+ return;
}
- /**
- * Clear all notifications
- */
+ exec(successCallback, errorCallback, 'PushNotification', 'getApplicationIconBadgeNumber', []);
+};
- }, {
- key: 'clearAllNotifications',
- value: function clearAllNotifications() {
- var successCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
- var errorCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
+/**
+ * Get the application icon badge
+ */
- if (typeof errorCallback !== 'function') {
- console.log('PushNotification.clearAllNotifications failure: failure parameter ' + 'not a function');
- return;
- }
+PushNotification.prototype.clearAllNotifications = function(successCallback, errorCallback) {
+ if (!successCallback) { successCallback = function() {}; }
+ if (!errorCallback) { errorCallback = function() {}; }
- if (typeof successCallback !== 'function') {
- console.log('PushNotification.clearAllNotifications failure: success callback ' + 'parameter must be a function');
+ if (typeof errorCallback !== 'function') {
+ console.log('PushNotification.clearAllNotifications failure: failure parameter not a function');
return;
- }
+ }
- exec(successCallback, errorCallback, 'PushNotification', 'clearAllNotifications', []);
+ if (typeof successCallback !== 'function') {
+ console.log('PushNotification.clearAllNotifications failure: success callback parameter must be a function');
+ return;
}
- /**
- * Listen for an event.
- *
- * The following events are supported:
- *
- * - registration
- * - notification
- * - error
- *
- * @param {String} eventName to subscribe to.
- * @param {Function} callback triggered on the event.
- */
- }, {
- key: 'on',
- value: function on(eventName, callback) {
- if (!this.handlers.hasOwnProperty(eventName)) {
- this.handlers[eventName] = [];
- }
- this.handlers[eventName].push(callback);
+ exec(successCallback, errorCallback, 'PushNotification', 'clearAllNotifications', []);
+};
+
+/**
+ * Listen for an event.
+ *
+ * Any event is supported, but the following are built-in:
+ *
+ * - registration
+ * - notification
+ * - error
+ *
+ * @param {String} eventName to subscribe to.
+ * @param {Function} callback triggered on the event.
+ */
+
+PushNotification.prototype.on = function(eventName, callback) {
+ if (!this._handlers.hasOwnProperty(eventName)) {
+ this._handlers[eventName] = [];
}
+ this._handlers[eventName].push(callback);
+};
- /**
- * Remove event listener.
- *
- * @param {String} eventName to match subscription.
- * @param {Function} handle function associated with event.
- */
+/**
+ * Remove event listener.
+ *
+ * @param {String} eventName to match subscription.
+ * @param {Function} handle function associated with event.
+ */
- }, {
- key: 'off',
- value: function off(eventName, handle) {
- if (this.handlers.hasOwnProperty(eventName)) {
- var handleIndex = this.handlers[eventName].indexOf(handle);
+PushNotification.prototype.off = function (eventName, handle) {
+ if (this._handlers.hasOwnProperty(eventName)) {
+ var handleIndex = this._handlers[eventName].indexOf(handle);
if (handleIndex >= 0) {
- this.handlers[eventName].splice(handleIndex, 1);
+ this._handlers[eventName].splice(handleIndex, 1);
}
- }
}
+};
- /**
- * Emit an event.
- *
- * This is intended for internal use only.
- *
- * @param {String} eventName is the event to trigger.
- * @param {*} all arguments are passed to the event listeners.
- *
- * @return {Boolean} is true when the event is triggered otherwise false.
- */
-
- }, {
- key: 'emit',
- value: function emit() {
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
+/**
+ * Emit an event.
+ *
+ * This is intended for internal use only.
+ *
+ * @param {String} eventName is the event to trigger.
+ * @param {*} all arguments are passed to the event listeners.
+ *
+ * @return {Boolean} is true when the event is triggered otherwise false.
+ */
- var eventName = args.shift();
+PushNotification.prototype.emit = function() {
+ var args = Array.prototype.slice.call(arguments);
+ var eventName = args.shift();
- if (!this.handlers.hasOwnProperty(eventName)) {
+ if (!this._handlers.hasOwnProperty(eventName)) {
return false;
- }
+ }
- for (var i = 0, length = this.handlers[eventName].length; i < length; i++) {
- var callback = this.handlers[eventName][i];
+ for (var i = 0, length = this._handlers[eventName].length; i < length; i++) {
+ var callback = this._handlers[eventName][i];
if (typeof callback === 'function') {
- callback.apply(undefined, args);
+ callback.apply(undefined,args);
} else {
- console.log('event handler: ' + eventName + ' must be a function');
+ console.log('event handler: ' + eventName + ' must be a function');
}
- }
-
- return true;
}
- }, {
- key: 'finish',
- value: function finish() {
- var successCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
- var errorCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
- var id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'handler';
- if (typeof successCallback !== 'function') {
+ return true;
+};
+
+PushNotification.prototype.finish = function(successCallback, errorCallback, id) {
+ if (!successCallback) { successCallback = function() {}; }
+ if (!errorCallback) { errorCallback = function() {}; }
+ if (!id) { id = 'handler'; }
+
+ if (typeof successCallback !== 'function') {
console.log('finish failure: success callback parameter must be a function');
return;
- }
+ }
- if (typeof errorCallback !== 'function') {
+ if (typeof errorCallback !== 'function') {
console.log('finish failure: failure parameter not a function');
return;
- }
-
- exec(successCallback, errorCallback, 'PushNotification', 'finish', [id]);
}
- }]);
- return PushNotification;
-}();
+ exec(successCallback, errorCallback, 'PushNotification', 'finish', [id]);
+};
/*!
* Push Notification Plugin.
*/
module.exports = {
- /**
- * Register for Push Notifications.
- *
- * This method will instantiate a new copy of the PushNotification object
- * and start the registration process.
- *
- * @param {Object} options
- * @return {PushNotification} instance
- */
+ /**
+ * Register for Push Notifications.
+ *
+ * This method will instantiate a new copy of the PushNotification object
+ * and start the registration process.
+ *
+ * @param {Object} options
+ * @return {PushNotification} instance
+ */
+
+ init: function(options) {
+ return new PushNotification(options);
+ },
- init: function init(options) {
- return new PushNotification(options);
- },
+ hasPermission: function(successCallback, errorCallback) {
+ exec(successCallback, errorCallback, 'PushNotification', 'hasPermission', []);
+ },
- hasPermission: function hasPermission(successCallback, errorCallback) {
- exec(successCallback, errorCallback, 'PushNotification', 'hasPermission', []);
- },
+ /**
+ * PushNotification Object.
+ *
+ * Expose the PushNotification object for direct use
+ * and testing. Typically, you should use the
+ * .init helper method.
+ */
- /**
- * PushNotification Object.
- *
- * Expose the PushNotification object for direct use
- * and testing. Typically, you should use the
- * .init helper method.
- */
- PushNotification: PushNotification
-}; \ No newline at end of file
+ PushNotification: PushNotification
+};