@capacitor-community/fcm 3.0.0 β 3.0.2
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.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
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.2](https://github.com/capacitor-community/fcm/compare/v3.0.1...v3.0.2) (2022-12-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* check if task is successful before accessing result to avoid crashes ([0304daa](https://github.com/capacitor-community/fcm/commit/0304daa54d25305a166661d9040bd7cb107261da))
|
|
11
|
+
|
|
12
|
+
### [3.0.1](https://github.com/capacitor-community/fcm/compare/v3.0.0...v3.0.1) (2022-11-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* add sponsor ([e2270f6](https://github.com/capacitor-community/fcm/commit/e2270f607287fa1440c5150de57e93f4d52f42d6))
|
|
18
|
+
* **android:** update firebaseMessagingVersion default value ([445b8ac](https://github.com/capacitor-community/fcm/commit/445b8ac805daf3ac52c3ccf0e4b89ed0e93a012d))
|
|
19
|
+
* readme ([1cbc83c](https://github.com/capacitor-community/fcm/commit/1cbc83c7825395ea7310814fa70ed1fd0ca809bb))
|
|
20
|
+
|
|
5
21
|
### [2.0.2](https://github.com/capacitor-community/fcm/compare/v2.0.1...v2.0.2) (2021-10-04)
|
|
6
22
|
|
|
7
23
|
### [2.0.1](https://github.com/capacitor-community/fcm/compare/v2.0.0...v2.0.1) (2021-09-13)
|
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/
|
|
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-
|
|
15
|
+
<a href="#contributors"><img src="https://img.shields.io/badge/all%20contributors-22-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
|
|
23
|
-
|
|
|
24
|
-
| Stewan Silva
|
|
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
|
-
-
|
|
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,12 +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
184
|
|
|
169
185
|
Now you should be set to go. Try to run your client using `ionic cap run android --livereload`.
|
|
170
186
|
|
|
171
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.
|
|
172
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
|
+
|
|
173
195
|
### Prevent auto initialization
|
|
174
196
|
|
|
175
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).
|
|
@@ -190,34 +212,40 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
190
212
|
<!-- prettier-ignore-start -->
|
|
191
213
|
<!-- markdownlint-disable -->
|
|
192
214
|
<table>
|
|
193
|
-
<
|
|
194
|
-
<
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/ramikhafagi96"><img src="https://avatars.githubusercontent.com/u/38646828?v=4?s=75" width="75px;" alt="Rami Khafagi"/><br /><sub><b>Rami Khafagi</b></sub></a><br /><a href="https://github.com/capacitor-community/fcm/commits?author=ramikhafagi96" title="Code">π»</a></td>
|
|
247
|
+
</tr>
|
|
248
|
+
</tbody>
|
|
221
249
|
</table>
|
|
222
250
|
|
|
223
251
|
<!-- markdownlint-restore -->
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ ext {
|
|
|
3
3
|
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
|
4
4
|
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
5
5
|
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
6
|
-
firebaseMessagingVersion = project.hasProperty('firebaseMessagingVersion') ? rootProject.ext.firebaseMessagingVersion : '
|
|
6
|
+
firebaseMessagingVersion = project.hasProperty('firebaseMessagingVersion') ? rootProject.ext.firebaseMessagingVersion : '23.0.5'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
buildscript {
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.getcapacitor.community.fcm;
|
|
2
2
|
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
|
|
3
5
|
import com.getcapacitor.JSObject;
|
|
4
6
|
import com.getcapacitor.Plugin;
|
|
5
7
|
import com.getcapacitor.PluginCall;
|
|
@@ -19,6 +21,8 @@ import com.google.firebase.messaging.FirebaseMessaging;
|
|
|
19
21
|
)
|
|
20
22
|
public class FCMPlugin extends Plugin {
|
|
21
23
|
|
|
24
|
+
public static final String TAG = "FirebaseMessaging";
|
|
25
|
+
|
|
22
26
|
@PluginMethod()
|
|
23
27
|
public void subscribeTo(final PluginCall call) {
|
|
24
28
|
final String topicName = call.getString("topic");
|
|
@@ -64,6 +68,12 @@ public class FCMPlugin extends Plugin {
|
|
|
64
68
|
@PluginMethod()
|
|
65
69
|
public void getToken(final PluginCall call) {
|
|
66
70
|
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(getActivity(), tokenResult -> {
|
|
71
|
+
if (!tokenResult.isSuccessful()) {
|
|
72
|
+
Exception exception = tokenResult.getException();
|
|
73
|
+
Log.w(TAG, "Fetching FCM registration token failed", exception);
|
|
74
|
+
call.errorCallback(exception.getLocalizedMessage());
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
67
77
|
JSObject data = new JSObject();
|
|
68
78
|
data.put("token", tokenResult.getResult());
|
|
69
79
|
call.resolve(data);
|
|
@@ -80,6 +90,7 @@ public class FCMPlugin extends Plugin {
|
|
|
80
90
|
data.put("token", instanceIdResult.getToken());
|
|
81
91
|
call.resolve(data);
|
|
82
92
|
});
|
|
93
|
+
|
|
83
94
|
FirebaseInstallations.getInstance().getId().addOnFailureListener(e -> call.reject("Failed to get instance FirebaseID", e));
|
|
84
95
|
}
|
|
85
96
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-community/fcm",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Enable Firebase Cloud Messaging features for Capacitor apps",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -58,11 +58,13 @@
|
|
|
58
58
|
"@ionic/eslint-config": "^0.3.0",
|
|
59
59
|
"@ionic/prettier-config": "^1.0.1",
|
|
60
60
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
61
|
+
"all-contributors-cli": "^6.24.0",
|
|
61
62
|
"eslint": "^7.11.0",
|
|
62
63
|
"prettier": "~2.3.0",
|
|
63
64
|
"prettier-plugin-java": "~1.0.2",
|
|
64
65
|
"rimraf": "^3.0.2",
|
|
65
66
|
"rollup": "^2.32.0",
|
|
67
|
+
"standard-version": "^9.5.0",
|
|
66
68
|
"swiftlint": "^1.0.1",
|
|
67
69
|
"typescript": "~4.1.5"
|
|
68
70
|
},
|