Skip to content

Conversation

@J-Priebe
Copy link

No description provided.


device = Device.objects.get(user_id=123) # get the device for the user you want to message

# To multiple devices
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

@lukeburden lukeburden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @J-Priebe! Appreciate the PR.

A couple of questions, but generally looks good and I'll author a release soon.

STATIC_URL = "/static/"

DEVICES_FCM_API_KEY = "oopwhoopdoop"
DEVICES_GOOGLE_SERVICE_ACCOUNT_INFO = {"foo": "bar"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remind me why it's DEVICES prefix here but FCM_DEVICES in the test settings?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea ;) old code, or perhaps you specify the prefix at a config level somewhere, and this is just ascertaining you can use different prefixes?

@J-Priebe J-Priebe changed the title upgrade to PyFCM 2.0.1, use google oauth lib to load credentials upgrade to PyFCM 2.0.6, use google oauth lib to load credentials Aug 26, 2024
Copy link
Owner

@lukeburden lukeburden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @J-Priebe, appreciate your PR.

A couple of comments inline - but basically this looks great and I'm just hoping we can avoid the super tight dependency versioning you've added, as this can end up causing a lot of friction.

Also I saw at least one of your PRs to PyFCM has been merged now, so perhaps there are further adjustments?

Cheers!

setup.py Outdated
# and 1.5.x currently look good.
# https://github.com/olucurious/PyFCM/issues/285
"pyfcm>=1.4,<1.6",
"pyfcm==2.0.6",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we loosen the pyfcm dependency?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps. I'm a bit wary of the author's versioning. He isn't very active and there doesn't seem to be much oversight on PRs. I haven't looked too deeply at the test suites for this repo, and I've never released a library before so I'm not too certain of best practices here, but I think we'd want to ensure the method signatures and handling of mocked responses are consistent across a wide range of versions.

I have another PR in my head that I'd like to submit to PyFCM around optional arguments - maybe we can circle back to this in a couple weeks when I've got that merged in and there's a new PyFCM version released?

Copy link
Author

@J-Priebe J-Priebe Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: My second PR was merged and released in 2.0.7. However he hasn't authored any release notes since 2.0.1 when the breaking google API changes were addressed. I think we're betting off erring on the side of caution and pinning 2.0.7.

EDIT: NVM, my changes aren't in yet, we have to wait for 2.0.8 😑

setup.py Outdated
"pyfcm>=1.4,<1.6",
"pyfcm==2.0.6",
"django-konst>=2,<3",
"google-auth==2.22.0", # for loading credentials.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyfcm has this as a dependency, so we can rely on that

Copy link
Author

@J-Priebe J-Priebe Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's good practice to rely on a package dependency to do things outside that package. Since we're doing the loading of google credentials outside PyFCM, django-fcm-devices should have its own explicit dependency (which can be satisfied by PyFCM)

tox.ini Outdated
djangorestframework>=3.10
django-konst>=2,<3
pyfcm==1.5.1
pyfcm==2.0.6
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on your response to my earlier comments on reqs, may need adjustment.

@J-Priebe J-Priebe changed the title upgrade to PyFCM 2.0.6, use google oauth lib to load credentials upgrade to PyFCM 2.0.7, use google oauth lib to load credentials Dec 30, 2024
@J-Priebe J-Priebe changed the title upgrade to PyFCM 2.0.7, use google oauth lib to load credentials upgrade to PyFCM 2.0.8, use google oauth lib to load credentials Dec 30, 2024
@J-Priebe
Copy link
Author

Gah, I was mistaken and my changes to PyFCM haven't been merged in yet.. we need to wait for 2.0.8. I've done some general cleanup and I think this looks pretty good once 2.0.8 is actually available.

tox.ini Outdated
env_list =
checkqa
py{36,37,38,39}-dj{22,30,31,master}
py{38,39,310,311,312}-dj{22,30,31,32}
Copy link
Author

@J-Priebe J-Priebe Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated tox to reflect that 3.6 - 3.8 are past end of life (3.8 recently, so I've left it in as pyenv still supports it, for now)

django master is now on 5.x, and actually this is broken by 4.x + due to changes in Signal args, so I removed it as well. 4+ is already disallowed in dependencies

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My sense is py3.8 is so broadly used, even though it's EOL it probably makes sense to support it for now.

We can add support for further Python and Django versions in a separate PR, kinda similar to what I've done over here for django-konst. I haven't closely looked, but my guess is there'll be backward compatible changes required so will justify a major release.

@lukeburden
Copy link
Owner

Gah, I was mistaken and my changes to PyFCM haven't been merged in yet.. we need to wait for 2.0.8. I've done some general cleanup and I think this looks pretty good once 2.0.8 is actually available.

No rush on my end. Any idea if/when the maintainer will get to it?

@J-Priebe J-Priebe changed the title upgrade to PyFCM 2.0.8, use google oauth lib to load credentials upgrade to PyFCM 2.1.0, use google oauth lib to load credentials Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants