-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile app settings backend #1571
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one minor comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! I'm sure people will be pleased once this is released 😛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you requested a review, i can say that it looks fine in principle, but obviously i didn' treview the python code.
…ckend' into vadimkerr/mobile-app-settings-backend
What this PR does
Adds mobile app settings support to OnCall backend.
MobileAppUserSettings
to store push notification settings/mobile_app/v1/user_settings
to fetch/update settings from the mobile appSome additional info on implementation: at first I wanted to extend the messaging backend system to allow storing / retrieving per-user data and implement mobile app settings based on those changes. After some thought I decided not to extend the messaging backend system and have this as functionality specific to the
mobile_app
Django app. Currently the messaging backend system is used by the backend and plugin UI, but mobile app settings are specific only to the mobile app and not configurable in the plugin UI.tldr: wanted to extend messaging backend system, but decided not to do that
Usage
Get settings via API
GET /mobile_app/v1/user_settings
Example response:
Update settings via API
PUT /mobile_app/v1/user_settings
- see example response above for payload shape.Note that sound names must be passed without file extension. When sending push notifications, the backend will add
.mp3
to sound names and pass it to push notification data for Android. For iOS, sound names will be suffixed with.aiff
to be used by APNS.Get settings from notification data for Android
All the settings from example response will be available in push notification data (along with
orgId
,alertGroupId
,title
, etc.).Fields
default_notification_volume
,default_notification_volume_override
andimportant_notification_volume
,important_notification_override_dnd
will be converted to strings due to FCM limitations.Fields
default_notification_sound_name
andimportant_notification_sound_name
will be suffixed with.mp3
in push notification data.iOS limitations
While Android push notifications are handled purely on the mobile app side, iOS notifications are sent via APNS which imposes some limitations.
default_notification_volume_override
anddefault_notification_volume
will be disregarded for iOS notifications)default_notification_sound_name
/important_notification_sound_name
.Which issue(s) this PR fixes
Related to https://github.com/grafana/oncall-private/issues/1602
Checklist