|
| 1 | +# fcm-cloudflare-workers |
| 2 | + |
| 3 | +## 2.0.0 |
| 4 | + |
| 5 | +### Major Changes |
| 6 | + |
| 7 | +- dbe2a39: BREAKING CHANGES: |
| 8 | + |
| 9 | + - Deprecated `sendMulticast` method in favor of new targeting options |
| 10 | + - Added new message targeting options: topic and condition-based messaging |
| 11 | + - Introduced platform-specific configuration options for iOS and Android |
| 12 | + |
| 13 | + WHY: |
| 14 | + |
| 15 | + - Enhanced flexibility in message targeting to support broader use cases |
| 16 | + - Better control over platform-specific notification features |
| 17 | + - Improved alignment with Firebase Cloud Messaging's full capabilities |
| 18 | + - Simplified API by consolidating message targeting methods |
| 19 | + |
| 20 | + HOW TO UPDATE: |
| 21 | + |
| 22 | + 1. Replace `sendMulticast` calls with the new targeting methods: |
| 23 | + |
| 24 | + ```typescript |
| 25 | + // Old way (deprecated) |
| 26 | + await fcm.sendMulticast(tokens, { notification }); |
| 27 | + |
| 28 | + // New way |
| 29 | + await fcm.sendToTokens(tokens, { notification }); |
| 30 | + ``` |
| 31 | + |
| 32 | + 2. Message targeting now supports three modes: |
| 33 | + - Token-based (using `sendToTokens`) |
| 34 | + - Topic-based (new) |
| 35 | + - Condition-based (new) |
| 36 | + 3. Platform configurations can now be specified separately for iOS and Android |
| 37 | + 4. Update your message payload structure to use the new targeting options if needed |
| 38 | + |
| 39 | + Example of new features: |
| 40 | + |
| 41 | + ```typescript |
| 42 | + // Token-based messaging (replaces sendMulticast) |
| 43 | + await fcm.sendToTokens(["token1", "token2"], { |
| 44 | + notification: { title: "Update", body: "New message!" }, |
| 45 | + }); |
| 46 | +
|
| 47 | + // Topic messaging |
| 48 | + await fcm.sendToTopic("news", { |
| 49 | + notification: { title: "News Update", body: "Check out the latest news!" }, |
| 50 | + }); |
| 51 | +
|
| 52 | + // Condition-based messaging |
| 53 | + await fcm.sendToCondition( |
| 54 | + "'sports' in topics && ('game' in topics || 'match' in topics)", |
| 55 | + { |
| 56 | + notification: { title: "Sports Update", body: "New game results!" }, |
| 57 | + } |
| 58 | + ); |
| 59 | + ``` |
0 commit comments