jazzband / django-push-notifications

Send push notifications to mobile devices through GCM or APNS in Django.
MIT License
2.24k stars 605 forks source link

More robust handling of userAgentData, fix WebPushDeviceAdmin #643

Closed simonkern closed 2 years ago

simonkern commented 2 years ago

Relevant userAgentData ist not always stored in navigator.userAgentData.brands[0]

It is necessary to loop through all available navigator.userAgentData.brands and try to find the relevant entry. In case of Edge (and maybe in case of other chromium-based browsers too) it is also necessary to ignore any matches regarding chrome...

addresses #640

codecov[bot] commented 2 years ago

Codecov Report

Merging #643 (c88d5fe) into master (56995b1) will decrease coverage by 0.00%. The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #643      +/-   ##
==========================================
- Coverage   68.33%   68.32%   -0.01%     
==========================================
  Files          25       25              
  Lines        1102     1108       +6     
  Branches      240      242       +2     
==========================================
+ Hits          753      757       +4     
- Misses        312      313       +1     
- Partials       37       38       +1     
Impacted Files Coverage Δ
push_notifications/admin.py 34.69% <71.42%> (+2.08%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 56995b1...c88d5fe. Read the comment docs.

simonkern commented 2 years ago

Field "device_id" is not available for WebPushDevices. Instead I added "browser" to ListView and "registration_id" to search_fields, by Subclassing DeviceAdmin for WebpushDevice.

simonkern commented 2 years ago

@auvipy what do you have in mind? Except for the field changes in the broken admin, these are only changes to the README.

auvipy commented 2 years ago

@dismine

dismine commented 2 years ago

New function loadVersionBrowser works for me. Already ported to my website.