Skip to content
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

feat: Enable push subscription for mobile devices by default #4321

Merged
merged 1 commit into from Jul 23, 2017
Merged

feat: Enable push subscription for mobile devices by default #4321

merged 1 commit into from Jul 23, 2017

Conversation

sorin-davidoi
Copy link
Contributor

@sorin-davidoi sorin-davidoi commented Jul 23, 2017

Mobile devices do not support regular notifications. So we enable push notifications by default for these devices. I wish there was a better way to detect this, but it is impossible to reliably feature-detect this in the browsers (e.g. Chrome exposes the Notification API but throws errors when invoked).

@@ -16,10 +16,23 @@ def create
active_session.update!(web_push_subscription: nil)
end

# Mobile devices do not support regular notifications, so we enable push notifications by default
alerts_enabled = active_session.detection.device.mobile? || active_session.detection.device.tablet?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is basically Chrome and Firefox on Android.

@Gargron Gargron merged commit 9075c90 into mastodon:master Jul 23, 2017
@sorin-davidoi sorin-davidoi deleted the enable-push-for-mobile branch July 24, 2017 06:17
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.

None yet

2 participants