Skip to content

Commit

Permalink
Prepare 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sdb9696 committed Aug 29, 2024
1 parent 10baee3 commit b845cd5
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 15 deletions.
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## [0.4.0](https://github.com/sdb9696/firebase-messaging/tree/0.4.0) (2024-08-29)

[Full Changelog](https://github.com/sdb9696/firebase-messaging/compare/0.3.0...0.4.0)

**Release highlights:**

- Support for new FCM HTTP v1 API
- Previous versions of this library will no longer work due firebase [deprecating the legacy APIs](https://firebase.google.com/docs/cloud-messaging/migrate-v1)
- Dropping official python 3.8 support
- **Breaking** - this version of the library only supports being run in an asyncio event loop
- **Breaking** - The api has changed, see the readme for updated details

**Breaking change pull requests:**

- Drop python 3.8 support and update CI [\#5](https://github.com/sdb9696/firebase-messaging/pull/5) (@sdb9696)

**Implemented enhancements:**

- Support FCM HTTP v1 \(async only\) [\#4](https://github.com/sdb9696/firebase-messaging/pull/4) (@sdb9696)

**Project maintenance:**

- Update releasing instructions and add changelog [\#6](https://github.com/sdb9696/firebase-messaging/pull/6) (@sdb9696)

## [0.3.0](https://github.com/sdb9696/firebase-messaging/tree/0.3.0) (2024-03-26)

[Full Changelog](https://github.com/sdb9696/firebase-messaging/compare/0.2.1...0.3.0)
Expand Down Expand Up @@ -79,5 +103,4 @@
- Fix publish workflow ([447d379](https://github.com/sdb9696/firebase-messaging/commit/447d37922aa2589e79b3952036ef10b02debb01a) by sdb9696).



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
22 changes: 15 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,34 @@ PyPi::
Requirements
------------

- Firebase sender id to receive notification
- Firebase serverKey to send notification (optional)
- Firebase configuration to receive notifications

Usage
-----

Must be run inside an asyncio event loop.

python::

from firebase_messaging import FcmPushClient
from firebase_messaging import FcmPushClient, FcmRegisterConfig

def on_notification(obj, notification, data_message):
# Do something with the notification
pass

pc = FcmPushClient(None)
fcm_token = pc.checkin(sender_id, app_id)
credentials = None # Start off with none or load from previous save
def on_credentials_updated(creds):
# save the credentials to a file here for future use

fcm_config = FcmRegisterConfig(fcm-project-id, fcm-app-id, fcm-api-key, fcm-message-sender-id)
pc = FcmPushClient(on_notification, fcm_config, credentials, on_credentials_updated)
fcm_token = await pc.checkin_or_register()

# Notify the service you're connecting to of your FCM token
await pc.start()

pc.start(YOUR_NOTIFICATION_CALLBACK)
# Adapt the following for your usage
while some_condition_to_keep_listening:
asyncio.sleep(2)


Attribution
Expand Down
12 changes: 6 additions & 6 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export NEW_RELEASE=x.x.x

```bash
git checkout main
git fetch upstream main
git rebase upstream/main
git fetch origin main
git rebase origin/main
git checkout -b release/$NEW_RELEASE
```

Expand Down Expand Up @@ -111,7 +111,7 @@ echo "$RELEASE_NOTES" # Check the output and copy paste if neccessary

```bash
git commit --all --verbose -m "Prepare $NEW_RELEASE"
git push upstream release/$NEW_RELEASE -u
git push origin release/$NEW_RELEASE -u
```

### Create a PR for the release, merge it, and re-fetch the main
Expand All @@ -133,8 +133,8 @@ gh pr merge --squash --body "$RELEASE_NOTES"

```bash
git checkout main
git fetch upstream main
git rebase upstream/main
git fetch origin main
git rebase origin/main
```

### Create a release tag
Expand All @@ -143,7 +143,7 @@ Note, add changelog release notes as the tag commit message so `gh release creat

```bash
git tag --annotate $NEW_RELEASE -m "$RELEASE_NOTES" # to create a signed tag replace --annotate with --sign
git push upstream $NEW_RELEASE
git push origin $NEW_RELEASE
```

### Create release
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "firebase-messaging"
version = "0.3.0"
version = "0.4.0"
description = "FCM/GCM push notification client"
authors = ["sdb9696 <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit b845cd5

Please sign in to comment.