@capacitor-community/fcm 2.0.2 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/CapacitorCommunityFcm.podspec +1 -1
  3. package/README.md +63 -34
  4. package/android/build.gradle +13 -14
  5. package/android/src/main/java/com/getcapacitor/community/fcm/FCMPlugin.java +12 -0
  6. package/dist/esm/definitions.d.ts +15 -0
  7. package/dist/esm/definitions.js.map +1 -1
  8. package/dist/esm/index.js.map +1 -1
  9. package/dist/esm/web.d.ts +3 -0
  10. package/dist/esm/web.js +4 -1
  11. package/dist/esm/web.js.map +1 -1
  12. package/dist/plugin.cjs.js +49 -0
  13. package/dist/plugin.cjs.js.map +1 -0
  14. package/dist/plugin.js +52 -0
  15. package/dist/plugin.js.map +1 -0
  16. package/ios/Plugin/Plugin/Plugin.swift +15 -0
  17. package/ios/Plugin/Podfile +1 -1
  18. package/package.json +61 -33
  19. package/android/.DS_Store +0 -0
  20. package/android/.gradle/5.6.4/fileChanges/last-build.bin +0 -0
  21. package/android/.gradle/5.6.4/fileHashes/fileHashes.bin +0 -0
  22. package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
  23. package/android/.gradle/5.6.4/gc.properties +0 -0
  24. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  25. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  26. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  27. package/android/.gradle/vcs-1/gc.properties +0 -0
  28. package/android/.idea/codeStyles/Project.xml +0 -113
  29. package/android/.idea/gradle.xml +0 -19
  30. package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_0_0_jar.xml +0 -13
  31. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_0_0_jar.xml +0 -11
  32. package/android/.idea/libraries/Gradle__androidx_test_core_1_2_0_aar.xml +0 -14
  33. package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_2_0_aar.xml +0 -14
  34. package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_2_0_aar.xml +0 -14
  35. package/android/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_1_aar.xml +0 -14
  36. package/android/.idea/libraries/Gradle__androidx_test_monitor_1_2_0_aar.xml +0 -14
  37. package/android/.idea/libraries/Gradle__androidx_test_runner_1_2_0_aar.xml +0 -14
  38. package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml +0 -9
  39. package/android/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml +0 -13
  40. package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml +0 -13
  41. package/android/.idea/libraries/Gradle__junit_junit_4_12_jar.xml +0 -13
  42. package/android/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml +0 -13
  43. package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml +0 -13
  44. package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml +0 -13
  45. package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml +0 -13
  46. package/android/.idea/misc.xml +0 -9
  47. package/android/.idea/modules.xml +0 -9
  48. package/android/.idea/runConfigurations.xml +0 -12
  49. package/android/.idea/vcs.xml +0 -6
  50. package/android/.idea/workspace.xml +0 -89
  51. package/android/.npmignore +0 -1
  52. package/android/android-capacitor-community-fcm.iml +0 -264
  53. package/android/android.iml +0 -108
  54. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  55. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  56. package/android/gradle.properties +0 -21
  57. package/android/gradlew +0 -160
  58. package/android/gradlew.bat +0 -90
  59. package/android/local.properties +0 -8
  60. package/android/proguard-rules.pro +0 -21
  61. package/android/settings.gradle +0 -2
  62. package/android/src/.DS_Store +0 -0
  63. package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +0 -27
  64. package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +0 -17
  65. package/ios/.DS_Store +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.0.1](https://github.com/capacitor-community/fcm/compare/v3.0.0...v3.0.1) (2022-11-08)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add sponsor ([e2270f6](https://github.com/capacitor-community/fcm/commit/e2270f607287fa1440c5150de57e93f4d52f42d6))
11
+ * **android:** update firebaseMessagingVersion default value ([445b8ac](https://github.com/capacitor-community/fcm/commit/445b8ac805daf3ac52c3ccf0e4b89ed0e93a012d))
12
+ * readme ([1cbc83c](https://github.com/capacitor-community/fcm/commit/1cbc83c7825395ea7310814fa70ed1fd0ca809bb))
13
+
5
14
  ### [2.0.2](https://github.com/capacitor-community/fcm/compare/v2.0.1...v2.0.2) (2021-10-04)
6
15
 
7
16
  ### [2.0.1](https://github.com/capacitor-community/fcm/compare/v2.0.0...v2.0.1) (2021-09-13)
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { git: package['repository']['url'], tag: s.version.to_s }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '12.0'
14
+ s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.dependency 'Firebase/Messaging'
17
17
  s.swift_version = '5.1'
package/README.md CHANGED
@@ -6,23 +6,39 @@
6
6
  </p>
7
7
 
8
8
  <p align="center">
9
- <img src="https://img.shields.io/maintenance/yes/2021?style=flat-square" />
9
+ <img src="https://img.shields.io/maintenance/yes/2022?style=flat-square" />
10
10
  <a href="https://www.npmjs.com/package/@capacitor-community/fcm"><img src="https://img.shields.io/npm/l/@capacitor-community/fcm?style=flat-square" /></a>
11
11
  <br>
12
12
  <a href="https://www.npmjs.com/package/@capacitor-community/fcm"><img src="https://img.shields.io/npm/dw/@capacitor-community/fcm?style=flat-square" /></a>
13
13
  <a href="https://www.npmjs.com/package/@capacitor-community/fcm"><img src="https://img.shields.io/npm/v/@capacitor-community/fcm?style=flat-square" /></a>
14
14
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
15
- <a href="#contributors"><img src="https://img.shields.io/badge/all%20contributors-16-orange?style=flat-square" /></a>
15
+ <a href="#contributors"><img src="https://img.shields.io/badge/all%20contributors-21-orange?style=flat-square" /></a>
16
16
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
17
17
 
18
18
  </p>
19
19
 
20
+ ## Sponsors
21
+
22
+ <table>
23
+ <tr>
24
+ <td align="center">
25
+ <a href="https://intenseloop.com">
26
+ <img src="https://static.intenseloop.com/assets/logo-512x512.png" width="40" />
27
+ </a>
28
+ </td>
29
+ <td>
30
+ <a href="https://intenseloop.com">
31
+ Intenseloop
32
+ </a>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+
20
37
  ## Maintainers
21
38
 
22
- | Maintainer | GitHub | Social |
23
- | -------------- | ------------------------------------------------------- | ------------------------------------------- |
24
- | Stewan Silva | [stewones](https://github.com/stewones) | [@stewones](https://twitter.com/stewones) |
25
- | Daniel Pereira | [danielprrazevedo](https://github.com/danielprrazevedo) | [@DandanPrr](https://twitter.com/DandanPrr) |
39
+ | Maintainer | GitHub | Social |
40
+ | ------------ | --------------------------------------- | ----------------------------------------- |
41
+ | Stewan Silva | [stewones](https://github.com/stewones) | [@stewones](https://twitter.com/stewones) |
26
42
 
27
43
  ## Notice 🚀
28
44
 
@@ -129,7 +145,8 @@ Download the `google-services.json` file and copy it to `android/app/` directory
129
145
 
130
146
  ## iOS setup
131
147
 
132
- - `sudo gem install cocoapods` _(once a time)_
148
+ - [Install homebrew](https://capacitorjs.com/docs/getting-started/environment-setup#homebrew) _(once)_
149
+ - `brew install cocoapods` _(once a time)_
133
150
  - `ionic start my-cap-app --capacitor`
134
151
  - `cd my-cap-app`
135
152
  - `mkdir www && touch www/index.html`
@@ -164,14 +181,17 @@ If you need to implement opt-in behavior, you can disable the auto initializatio
164
181
  - `npx cap sync android` _(always do sync after a plugin install)_
165
182
  - `npx cap open android`
166
183
  - add `google-services.json` to your `android/app` folder
167
- - `[extra step]` in android case we need to tell Capacitor to initialise the plugin:
168
-
169
- > on your `MainActivity.java` file add `import com.getcapacitor.community.fcm.FCMPlugin;` and then inside the init callback `add(FCMPlugin.class);`
170
184
 
171
185
  Now you should be set to go. Try to run your client using `ionic cap run android --livereload`.
172
186
 
173
187
  > Tip: every time you change a native code you may need to clean up the cache (Build > Clean Project | Build > Rebuild Project) and then run the app again.
174
188
 
189
+ ### Variables
190
+
191
+ This plugin will use the following project variables (defined in your app's `variables.gradle` file):
192
+
193
+ - `$firebaseMessagingVersion` version of `com.google.firebase:firebase-messaging` (default: `23.0.5`)
194
+
175
195
  ### Prevent auto initialization
176
196
 
177
197
  If you need to implement opt-in behavior, you can disable the auto initialization of the library by following the [Firebase docs](https://firebase.google.com/docs/cloud-messaging/android/client#prevent-auto-init).
@@ -192,30 +212,39 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
192
212
  <!-- prettier-ignore-start -->
193
213
  <!-- markdownlint-disable -->
194
214
  <table>
195
- <tr>
196
- <td align="center"><a href="https://twitter.com/stewones"><img src="https://avatars1.githubusercontent.com/u/719763?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Stew</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=stewones" title="Code">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=stewones" title="Documentation">📖</a></td>
197
- <td align="center"><a href="https://github.com/danielprrazevedo"><img src="https://avatars2.githubusercontent.com/u/20153661?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Daniel Pereira</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=danielprrazevedo" title="Code">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=danielprrazevedo" title="Documentation">📖</a></td>
198
- <td align="center"><a href="http://priyankpatel.io/"><img src="https://avatars3.githubusercontent.com/u/5585797?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Priyank Patel</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=priyankpat" title="Code">💻</a></td>
199
- <td align="center"><a href="http://fuubar.wordpress.com/"><img src="https://avatars1.githubusercontent.com/u/1230033?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Nikolas</b></sub></a><br /><a href="#maintenance-nikoskip" title="Maintenance">🚧</a></td>
200
- <td align="center"><a href="https://lights0123.com/"><img src="https://avatars3.githubusercontent.com/u/3756309?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Ben Schattinger</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=lights0123" title="Code">💻</a></td>
201
- </tr>
202
- <tr>
203
- <td align="center"><a href="https://binary.com.au/"><img src="https://avatars2.githubusercontent.com/u/175909?v=4?s=75" width="75px;" alt=""/><br /><sub><b>James Manners</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=jmannau" title="Code">💻</a></td>
204
- <td align="center"><a href="https://github.com/borodiliz"><img src="https://avatars3.githubusercontent.com/u/2467193?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Borja Rodríguez</b></sub></a><br /><a href="#maintenance-borodiliz" title="Maintenance">🚧</a></td>
205
- <td align="center"><a href="https://github.com/Karrlllis"><img src="https://avatars1.githubusercontent.com/u/37330643?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Karrlllis</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=Karrlllis" title="Documentation">📖</a></td>
206
- <td align="center"><a href="https://github.com/jamesmah"><img src="https://avatars0.githubusercontent.com/u/21981049?v=4?s=75" width="75px;" alt=""/><br /><sub><b>jamesmah</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=jamesmah" title="Code">💻</a></td>
207
- <td align="center"><a href="https://github.com/josh-m-sharpe"><img src="https://avatars3.githubusercontent.com/u/39473?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Josh Sharpe</b></sub></a><br /><a href="#maintenance-josh-m-sharpe" title="Maintenance">🚧</a></td>
208
- </tr>
209
- <tr>
210
- <td align="center"><a href="https://github.com/msimkunas"><img src="https://avatars.githubusercontent.com/u/9675250?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Mantas Šimkūnas</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=msimkunas" title="Code">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=msimkunas" title="Documentation">📖</a></td>
211
- <td align="center"><a href="https://github.com/iOlivier"><img src="https://avatars.githubusercontent.com/u/12254953?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Olivier Overstraete</b></sub></a><br /><a href="#maintenance-iOlivier" title="Maintenance">🚧</a></td>
212
- <td align="center"><a href="https://hemang.dev/"><img src="https://avatars.githubusercontent.com/u/13018570?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Hemang Kumar</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=hemangsk" title="Code">💻</a> <a href="#maintenance-hemangsk" title="Maintenance">🚧</a></td>
213
- <td align="center"><a href="https://github.com/mesqueeb"><img src="https://avatars.githubusercontent.com/u/3253920?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Luca Ban</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=mesqueeb" title="Documentation">📖</a></td>
214
- <td align="center"><a href="https://www.alexgriffith.me/"><img src="https://avatars.githubusercontent.com/u/5904472?v=4?s=75" width="75px;" alt=""/><br /><sub><b>Alex Griffith</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=halomademeapc" title="Code">💻</a> <a href="#maintenance-halomademeapc" title="Maintenance">🚧</a></td>
215
- </tr>
216
- <tr>
217
- <td align="center"><a href="https://github.com/bdirito"><img src="https://avatars.githubusercontent.com/u/8117238?v=4?s=75" width="75px;" alt=""/><br /><sub><b>bdirito</b></sub></a><br /><a href="#maintenance-bdirito" title="Maintenance">🚧</a></td>
218
- </tr>
215
+ <tbody>
216
+ <tr>
217
+ <td align="center" valign="top" width="20%"><a href="https://twitter.com/stewones"><img src="https://avatars1.githubusercontent.com/u/719763?v=4?s=75" width="75px;" alt="Stew"/><br /><sub><b>Stew</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=stewones" title="Code">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=stewones" title="Documentation">📖</a></td>
218
+ <td align="center" valign="top" width="20%"><a href="https://github.com/danielprrazevedo"><img src="https://avatars2.githubusercontent.com/u/20153661?v=4?s=75" width="75px;" alt="Daniel Pereira"/><br /><sub><b>Daniel Pereira</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=danielprrazevedo" title="Code">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=danielprrazevedo" title="Documentation">📖</a></td>
219
+ <td align="center" valign="top" width="20%"><a href="http://priyankpatel.io/"><img src="https://avatars3.githubusercontent.com/u/5585797?v=4?s=75" width="75px;" alt="Priyank Patel"/><br /><sub><b>Priyank Patel</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=priyankpat" title="Code">💻</a></td>
220
+ <td align="center" valign="top" width="20%"><a href="http://fuubar.wordpress.com/"><img src="https://avatars1.githubusercontent.com/u/1230033?v=4?s=75" width="75px;" alt="Nikolas"/><br /><sub><b>Nikolas</b></sub></a><br /><a href="#maintenance-nikoskip" title="Maintenance">🚧</a></td>
221
+ <td align="center" valign="top" width="20%"><a href="https://lights0123.com/"><img src="https://avatars3.githubusercontent.com/u/3756309?v=4?s=75" width="75px;" alt="Ben Schattinger"/><br /><sub><b>Ben Schattinger</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=lights0123" title="Code">💻</a></td>
222
+ </tr>
223
+ <tr>
224
+ <td align="center" valign="top" width="20%"><a href="https://binary.com.au/"><img src="https://avatars2.githubusercontent.com/u/175909?v=4?s=75" width="75px;" alt="James Manners"/><br /><sub><b>James Manners</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=jmannau" title="Code">💻</a></td>
225
+ <td align="center" valign="top" width="20%"><a href="https://github.com/borodiliz"><img src="https://avatars3.githubusercontent.com/u/2467193?v=4?s=75" width="75px;" alt="Borja Rodríguez"/><br /><sub><b>Borja Rodríguez</b></sub></a><br /><a href="#maintenance-borodiliz" title="Maintenance">🚧</a></td>
226
+ <td align="center" valign="top" width="20%"><a href="https://github.com/Karrlllis"><img src="https://avatars1.githubusercontent.com/u/37330643?v=4?s=75" width="75px;" alt="Karrlllis"/><br /><sub><b>Karrlllis</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=Karrlllis" title="Documentation">📖</a></td>
227
+ <td align="center" valign="top" width="20%"><a href="https://github.com/jamesmah"><img src="https://avatars0.githubusercontent.com/u/21981049?v=4?s=75" width="75px;" alt="jamesmah"/><br /><sub><b>jamesmah</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=jamesmah" title="Code">💻</a></td>
228
+ <td align="center" valign="top" width="20%"><a href="https://github.com/josh-m-sharpe"><img src="https://avatars3.githubusercontent.com/u/39473?v=4?s=75" width="75px;" alt="Josh Sharpe"/><br /><sub><b>Josh Sharpe</b></sub></a><br /><a href="#maintenance-josh-m-sharpe" title="Maintenance">🚧</a></td>
229
+ </tr>
230
+ <tr>
231
+ <td align="center" valign="top" width="20%"><a href="https://github.com/msimkunas"><img src="https://avatars.githubusercontent.com/u/9675250?v=4?s=75" width="75px;" alt="Mantas Šimkūnas"/><br /><sub><b>Mantas Šimkūnas</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=msimkunas" title="Code">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=msimkunas" title="Documentation">📖</a></td>
232
+ <td align="center" valign="top" width="20%"><a href="https://github.com/iOlivier"><img src="https://avatars.githubusercontent.com/u/12254953?v=4?s=75" width="75px;" alt="Olivier Overstraete"/><br /><sub><b>Olivier Overstraete</b></sub></a><br /><a href="#maintenance-iOlivier" title="Maintenance">🚧</a></td>
233
+ <td align="center" valign="top" width="20%"><a href="https://hemang.dev/"><img src="https://avatars.githubusercontent.com/u/13018570?v=4?s=75" width="75px;" alt="Hemang Kumar"/><br /><sub><b>Hemang Kumar</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=hemangsk" title="Code">💻</a> <a href="#maintenance-hemangsk" title="Maintenance">🚧</a></td>
234
+ <td align="center" valign="top" width="20%"><a href="https://github.com/mesqueeb"><img src="https://avatars.githubusercontent.com/u/3253920?v=4?s=75" width="75px;" alt="Luca Ban"/><br /><sub><b>Luca Ban</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=mesqueeb" title="Documentation">📖</a></td>
235
+ <td align="center" valign="top" width="20%"><a href="https://www.alexgriffith.me/"><img src="https://avatars.githubusercontent.com/u/5904472?v=4?s=75" width="75px;" alt="Alex Griffith"/><br /><sub><b>Alex Griffith</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=halomademeapc" title="Code">💻</a> <a href="#maintenance-halomademeapc" title="Maintenance">🚧</a></td>
236
+ </tr>
237
+ <tr>
238
+ <td align="center" valign="top" width="20%"><a href="https://github.com/bdirito"><img src="https://avatars.githubusercontent.com/u/8117238?v=4?s=75" width="75px;" alt="bdirito"/><br /><sub><b>bdirito</b></sub></a><br /><a href="#maintenance-bdirito" title="Maintenance">🚧</a></td>
239
+ <td align="center" valign="top" width="20%"><a href="https://github.com/mineminemine"><img src="https://avatars.githubusercontent.com/u/17585549?v=4?s=75" width="75px;" alt="Ryan"/><br /><sub><b>Ryan</b></sub></a><br /><a href="#maintenance-mineminemine" title="Maintenance">🚧</a></td>
240
+ <td align="center" valign="top" width="20%"><a href="https://github.com/josuelmm"><img src="https://avatars.githubusercontent.com/u/12968781?v=4?s=75" width="75px;" alt="Josué Moreno"/><br /><sub><b>Josué Moreno</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=josuelmm" title="Code">💻</a></td>
241
+ <td align="center" valign="top" width="20%"><a href="https://marcjulian.de/?ref=github"><img src="https://avatars.githubusercontent.com/u/8985933?v=4?s=75" width="75px;" alt="Marc"/><br /><sub><b>Marc</b></sub></a><br /><a href="#maintenance-marcjulian" title="Maintenance">🚧</a></td>
242
+ <td align="center" valign="top" width="20%"><a href="https://floriangyger.ch/"><img src="https://avatars.githubusercontent.com/u/1215256?v=4?s=75" width="75px;" alt="Florian Gyger"/><br /><sub><b>Florian Gyger</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=flogy" title="Code">💻</a></td>
243
+ </tr>
244
+ <tr>
245
+ <td align="center" valign="top" width="20%"><a href="http://www.jcesarmobile.com/"><img src="https://avatars.githubusercontent.com/u/1637892?v=4?s=75" width="75px;" alt="jcesarmobile"/><br /><sub><b>jcesarmobile</b></sub></a><br /><a href="#question-jcesarmobile" title="Answering Questions">💬</a> <a href="https://github.com/capacitor-community/fcm/commits?author=jcesarmobile" title="Documentation">📖</a> <a href="#maintenance-jcesarmobile" title="Maintenance">🚧</a></td>
246
+ </tr>
247
+ </tbody>
219
248
  </table>
220
249
 
221
250
  <!-- markdownlint-restore -->
@@ -1,27 +1,28 @@
1
1
  ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.12'
3
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.1'
4
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.2.0'
5
- firebaseMessagingVersion = project.hasProperty('firebaseMessagingVersion') ? rootProject.ext.firebaseMessagingVersion : '21.0.1'
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
+ firebaseMessagingVersion = project.hasProperty('firebaseMessagingVersion') ? rootProject.ext.firebaseMessagingVersion : '23.0.5'
6
7
  }
7
8
 
8
9
  buildscript {
9
10
  repositories {
10
11
  google()
11
- jcenter()
12
+ mavenCentral()
12
13
  }
13
14
  dependencies {
14
- classpath 'com.android.tools.build:gradle:3.6.1'
15
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
16
  }
16
17
  }
17
18
 
18
19
  apply plugin: 'com.android.library'
19
20
 
20
21
  android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
22
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
23
  defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
26
  versionCode 1
26
27
  versionName "1.0"
27
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -37,14 +38,13 @@ android {
37
38
  }
38
39
 
39
40
  compileOptions {
40
- sourceCompatibility JavaVersion.VERSION_1_8
41
- targetCompatibility JavaVersion.VERSION_1_8
41
+ sourceCompatibility JavaVersion.VERSION_11
42
+ targetCompatibility JavaVersion.VERSION_11
42
43
  }
43
44
  }
44
45
 
45
46
  repositories {
46
47
  google()
47
- jcenter()
48
48
  mavenCentral()
49
49
  }
50
50
 
@@ -52,10 +52,9 @@ repositories {
52
52
  dependencies {
53
53
  implementation fileTree(dir: 'libs', include: ['*.jar'])
54
54
  implementation project(':capacitor-android')
55
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
56
  testImplementation "junit:junit:$junitVersion"
56
57
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
58
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
- androidTestImplementation 'com.android.support:support-annotations:28.0.0'
59
59
  implementation "com.google.firebase:firebase-messaging:$firebaseMessagingVersion"
60
- implementation 'com.android.support:appcompat-v7:28.0.0'
61
60
  }
@@ -63,6 +63,18 @@ public class FCMPlugin extends Plugin {
63
63
 
64
64
  @PluginMethod()
65
65
  public void getToken(final PluginCall call) {
66
+ FirebaseMessaging.getInstance().getToken().addOnCompleteListener(getActivity(), tokenResult -> {
67
+ JSObject data = new JSObject();
68
+ data.put("token", tokenResult.getResult());
69
+ call.resolve(data);
70
+ });
71
+
72
+ FirebaseMessaging.getInstance().getToken().addOnFailureListener(e -> call.reject("Failed to get FCM registration token", e));
73
+ }
74
+
75
+ @PluginMethod()
76
+ public void refreshToken(final PluginCall call) {
77
+ FirebaseMessaging.getInstance().deleteToken();
66
78
  FirebaseInstallations.getInstance().getToken(false).addOnSuccessListener(getActivity(), instanceIdResult -> {
67
79
  JSObject data = new JSObject();
68
80
  data.put("token", instanceIdResult.getToken());
@@ -32,6 +32,21 @@ export interface FCMPlugin {
32
32
  getToken(): Promise<{
33
33
  token: string;
34
34
  }>;
35
+ /**
36
+ * Refresh fcm token to eventually use from a serve
37
+ *
38
+ * Recommended to use this instead of
39
+ * @usage
40
+ * ```typescript
41
+ * PushNotifications.addListener("registration", (token) => {
42
+ * console.log(token.data);
43
+ * });
44
+ * ```
45
+ * because the native capacitor method, for apple, returns the APN's token
46
+ */
47
+ refreshToken(): Promise<{
48
+ token: string;
49
+ }>;
35
50
  /**
36
51
  * Remove local fcm instance completely
37
52
  */
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface FCMPlugin {\n /**\n * Subscribe to fcm topic\n * @param options\n */\n subscribeTo(options: { topic: string }): Promise<{ message: string }>;\n\n /**\n * Unsubscribe from fcm topic\n * @param options\n */\n unsubscribeFrom(options: { topic: string }): Promise<{ message: string }>;\n\n /**\n * Get fcm token to eventually use from a serve\n *\n * Recommended to use this instead of\n * @usage\n * ```typescript\n * PushNotifications.addListener(\"registration\", (token) => {\n * console.log(token.data);\n * });\n * ```\n * because the native capacitor method, for apple, returns the APN's token\n */\n getToken(): Promise<{ token: string }>;\n\n \n /**\n * Refresh fcm token to eventually use from a serve\n *\n * Recommended to use this instead of\n * @usage\n * ```typescript\n * PushNotifications.addListener(\"registration\", (token) => {\n * console.log(token.data);\n * });\n * ```\n * because the native capacitor method, for apple, returns the APN's token\n */\n refreshToken(): Promise<{ token: string }>;\n\n /**\n * Remove local fcm instance completely\n */\n deleteInstance(): Promise<boolean>;\n\n /**\n * Enabled/disabled auto initialization.\n * @param options\n */\n setAutoInit(options: { enabled: boolean }): Promise<void>;\n\n /**\n * Retrieve the auto initialization status.\n */\n isAutoInitEnabled(): Promise<{ enabled: boolean }>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,MAAM,GAAG,GAAG,cAAc,CACtB,KAAK,EACL;IACI,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;CACzD,CACJ,CAAC;AAEF,kCAAkC;AAClC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,MAAM,GAAG,GAAG,cAAc,CACtB,KAAK,EACL;IACI,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;CACzD,CACJ,CAAC;AAEF,kCAAkC;AAClC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,CAAC","sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nimport { FCMPlugin } from \"./definitions\";\n\nconst FCM = registerPlugin<FCMPlugin>(\n \"FCM\",\n {\n web: () => import(\"./web\").then((m) => new m.FCMWeb()),\n }\n);\n\n// export * from './web'; // @todo\nexport * from \"./definitions\";\nexport { FCM };\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -22,6 +22,9 @@ export declare class FCMWeb extends WebPlugin implements FCMPlugin {
22
22
  isAutoInitEnabled(): Promise<{
23
23
  enabled: boolean;
24
24
  }>;
25
+ refreshToken(): Promise<{
26
+ token: string;
27
+ }>;
25
28
  }
26
29
  declare const FCM: FCMWeb;
27
30
  export { FCM };
package/dist/esm/web.js CHANGED
@@ -3,7 +3,7 @@ export class FCMWeb extends WebPlugin {
3
3
  constructor() {
4
4
  super({
5
5
  name: 'FCM',
6
- platforms: ['web']
6
+ platforms: ['web'],
7
7
  });
8
8
  }
9
9
  subscribeTo(_options) {
@@ -24,6 +24,9 @@ export class FCMWeb extends WebPlugin {
24
24
  isAutoInitEnabled() {
25
25
  throw this.unimplemented('Not implemented on web.');
26
26
  }
27
+ refreshToken() {
28
+ throw this.unimplemented('Not implemented on web.');
29
+ }
27
30
  }
28
31
  const FCM = new FCMWeb();
29
32
  export { FCM };
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,CAAC,KAAK,CAAC;SACnB,CAAC,CAAC;IACL,CAAC;IACD,WAAW,CAAC,QAA4B;QACtC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IACD,eAAe,CAAC,QAA4B;QAC1C,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IACD,QAAQ;QACN,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IACD,cAAc;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IACD,WAAW,CAAC,QAA+B;QACzC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IACD,iBAAiB;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC;AAEzB,OAAO,EAAE,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,CAAC,KAAK,CAAC;SACnB,CAAC,CAAC;IACL,CAAC;IAED,WAAW,CAAC,QAA2B;QACrC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,eAAe,CAAC,QAA2B;QACzC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ;QACN,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,cAAc;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,WAAW,CAAC,QAA8B;QACxC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,iBAAiB;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,YAAY;QACV,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC;AAEzB,OAAO,EAAE,GAAG,EAAE,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport { FCMPlugin } from './definitions';\n\nexport class FCMWeb extends WebPlugin implements FCMPlugin {\n constructor() {\n super({\n name: 'FCM',\n platforms: ['web'],\n });\n }\n\n subscribeTo(_options: { topic: string }): Promise<{ message: string }> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n unsubscribeFrom(_options: { topic: string }): Promise<{ message: string }> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n getToken(): Promise<{ token: string }> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n deleteInstance(): Promise<boolean> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n setAutoInit(_options: { enabled: boolean }): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n isAutoInitEnabled(): Promise<{ enabled: boolean }> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n refreshToken(): Promise<{ token: string }> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n\nconst FCM = new FCMWeb();\n\nexport { FCM };\n"]}
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@capacitor/core');
6
+
7
+ const FCM$1 = core.registerPlugin("FCM", {
8
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.FCMWeb()),
9
+ });
10
+
11
+ class FCMWeb extends core.WebPlugin {
12
+ constructor() {
13
+ super({
14
+ name: 'FCM',
15
+ platforms: ['web'],
16
+ });
17
+ }
18
+ subscribeTo(_options) {
19
+ throw this.unimplemented('Not implemented on web.');
20
+ }
21
+ unsubscribeFrom(_options) {
22
+ throw this.unimplemented('Not implemented on web.');
23
+ }
24
+ getToken() {
25
+ throw this.unimplemented('Not implemented on web.');
26
+ }
27
+ deleteInstance() {
28
+ throw this.unimplemented('Not implemented on web.');
29
+ }
30
+ setAutoInit(_options) {
31
+ throw this.unimplemented('Not implemented on web.');
32
+ }
33
+ isAutoInitEnabled() {
34
+ throw this.unimplemented('Not implemented on web.');
35
+ }
36
+ refreshToken() {
37
+ throw this.unimplemented('Not implemented on web.');
38
+ }
39
+ }
40
+ const FCM = new FCMWeb();
41
+
42
+ var web = /*#__PURE__*/Object.freeze({
43
+ __proto__: null,
44
+ FCMWeb: FCMWeb,
45
+ FCM: FCM
46
+ });
47
+
48
+ exports.FCM = FCM$1;
49
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst FCM = registerPlugin(\"FCM\", {\n web: () => import(\"./web\").then((m) => new m.FCMWeb()),\n});\n// export * from './web'; // @todo\nexport * from \"./definitions\";\nexport { FCM };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class FCMWeb extends WebPlugin {\n constructor() {\n super({\n name: 'FCM',\n platforms: ['web'],\n });\n }\n subscribeTo(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n unsubscribeFrom(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n getToken() {\n throw this.unimplemented('Not implemented on web.');\n }\n deleteInstance() {\n throw this.unimplemented('Not implemented on web.');\n }\n setAutoInit(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n isAutoInitEnabled() {\n throw this.unimplemented('Not implemented on web.');\n }\n refreshToken() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst FCM = new FCMWeb();\nexport { FCM };\n//# sourceMappingURL=web.js.map"],"names":["FCM","registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAACA,KAAG,GAAGC,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,KAAK;AACvB,YAAY,SAAS,EAAE,CAAC,KAAK,CAAC;AAC9B,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,WAAW,CAAC,QAAQ,EAAE;AAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,eAAe,CAAC,QAAQ,EAAE;AAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,QAAQ,GAAG;AACf,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,cAAc,GAAG;AACrB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,WAAW,CAAC,QAAQ,EAAE;AAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,iBAAiB,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,YAAY,GAAG;AACnB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,CAAC;AACD,MAAM,GAAG,GAAG,IAAI,MAAM,EAAE;;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,52 @@
1
+ var capacitorPlugin = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const FCM$1 = core.registerPlugin("FCM", {
5
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.FCMWeb()),
6
+ });
7
+
8
+ class FCMWeb extends core.WebPlugin {
9
+ constructor() {
10
+ super({
11
+ name: 'FCM',
12
+ platforms: ['web'],
13
+ });
14
+ }
15
+ subscribeTo(_options) {
16
+ throw this.unimplemented('Not implemented on web.');
17
+ }
18
+ unsubscribeFrom(_options) {
19
+ throw this.unimplemented('Not implemented on web.');
20
+ }
21
+ getToken() {
22
+ throw this.unimplemented('Not implemented on web.');
23
+ }
24
+ deleteInstance() {
25
+ throw this.unimplemented('Not implemented on web.');
26
+ }
27
+ setAutoInit(_options) {
28
+ throw this.unimplemented('Not implemented on web.');
29
+ }
30
+ isAutoInitEnabled() {
31
+ throw this.unimplemented('Not implemented on web.');
32
+ }
33
+ refreshToken() {
34
+ throw this.unimplemented('Not implemented on web.');
35
+ }
36
+ }
37
+ const FCM = new FCMWeb();
38
+
39
+ var web = /*#__PURE__*/Object.freeze({
40
+ __proto__: null,
41
+ FCMWeb: FCMWeb,
42
+ FCM: FCM
43
+ });
44
+
45
+ exports.FCM = FCM$1;
46
+
47
+ Object.defineProperty(exports, '__esModule', { value: true });
48
+
49
+ return exports;
50
+
51
+ })({}, capacitorExports);
52
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst FCM = registerPlugin(\"FCM\", {\n web: () => import(\"./web\").then((m) => new m.FCMWeb()),\n});\n// export * from './web'; // @todo\nexport * from \"./definitions\";\nexport { FCM };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class FCMWeb extends WebPlugin {\n constructor() {\n super({\n name: 'FCM',\n platforms: ['web'],\n });\n }\n subscribeTo(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n unsubscribeFrom(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n getToken() {\n throw this.unimplemented('Not implemented on web.');\n }\n deleteInstance() {\n throw this.unimplemented('Not implemented on web.');\n }\n setAutoInit(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n isAutoInitEnabled() {\n throw this.unimplemented('Not implemented on web.');\n }\n refreshToken() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst FCM = new FCMWeb();\nexport { FCM };\n//# sourceMappingURL=web.js.map"],"names":["FCM","registerPlugin","WebPlugin"],"mappings":";;;AACK,UAACA,KAAG,GAAGC,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC;IACd,YAAY,IAAI,EAAE,KAAK;IACvB,YAAY,SAAS,EAAE,CAAC,KAAK,CAAC;IAC9B,SAAS,CAAC,CAAC;IACX,KAAK;IACL,IAAI,WAAW,CAAC,QAAQ,EAAE;IAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,eAAe,CAAC,QAAQ,EAAE;IAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,QAAQ,GAAG;IACf,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,cAAc,GAAG;IACrB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,WAAW,CAAC,QAAQ,EAAE;IAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,iBAAiB,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,YAAY,GAAG;IACnB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,MAAM,EAAE;;;;;;;;;;;;;;;;;;"}
@@ -80,6 +80,21 @@ public class FCMPlugin: CAPPlugin, MessagingDelegate {
80
80
  ])
81
81
  }
82
82
  }
83
+
84
+ @objc func refreshToken(_ call: CAPPluginCall) {
85
+ Messaging.messaging().token { token, error in
86
+ if let error = error {
87
+ print("Error fetching FCM registration token: \(error)")
88
+ call.reject("Failed to get instance FirebaseID", error.localizedDescription)
89
+ } else if let token = token {
90
+ print("FCM registration token: \(token)");
91
+ self.fcmToken = token;
92
+ call.resolve([
93
+ "token": token
94
+ ]);
95
+ }
96
+ }
97
+ }
83
98
 
84
99
  @objc func deleteInstance(_ call: CAPPluginCall) {
85
100
  Installations.installations().delete { error in
@@ -1,5 +1,5 @@
1
1
  # Uncomment the next line to define a global platform for your project
2
- platform :ios, '12.0'
2
+ platform :ios, '13.0'
3
3
 
4
4
  def capacitor_pods
5
5
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks