-
-
Notifications
You must be signed in to change notification settings - Fork 846
Add notification permission bottom sheet #6094
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
base: feature/use_new_onboarding
Are you sure you want to change the base?
Changes from 10 commits
3785b93
0058842
db37f34
cec48b7
9ba4176
29a98da
2316612
1287805
92093be
6e43eb8
f5fa9a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import androidx.core.content.ContextCompat | |
| import androidx.core.graphics.toColorInt | ||
| import androidx.core.net.toUri | ||
| import dagger.hilt.android.qualifiers.ActivityContext | ||
| import io.homeassistant.companion.android.BuildConfig | ||
| import io.homeassistant.companion.android.common.R as commonR | ||
| import io.homeassistant.companion.android.common.data.authentication.SessionState | ||
| import io.homeassistant.companion.android.common.data.prefs.PrefsRepository | ||
|
|
@@ -19,6 +20,10 @@ import io.homeassistant.companion.android.common.util.DisabledLocationHandler | |
| import io.homeassistant.companion.android.common.util.GestureAction | ||
| import io.homeassistant.companion.android.common.util.GestureDirection | ||
| import io.homeassistant.companion.android.common.util.HAGesture | ||
| import io.homeassistant.companion.android.database.settings.SensorUpdateFrequencySetting | ||
| import io.homeassistant.companion.android.database.settings.Setting | ||
| import io.homeassistant.companion.android.database.settings.SettingsDao | ||
| import io.homeassistant.companion.android.database.settings.WebsocketSetting | ||
| import io.homeassistant.companion.android.improv.ImprovRepository | ||
| import io.homeassistant.companion.android.matter.MatterManager | ||
| import io.homeassistant.companion.android.thread.ThreadManager | ||
|
|
@@ -54,6 +59,7 @@ class WebViewPresenterImpl @Inject constructor( | |
| private val prefsRepository: PrefsRepository, | ||
| private val matterUseCase: MatterManager, | ||
| private val threadUseCase: ThreadManager, | ||
| private val settingsDao: SettingsDao, | ||
| ) : WebViewPresenter { | ||
|
|
||
| private val view = context as WebView | ||
|
|
@@ -581,4 +587,21 @@ class WebViewPresenterImpl @Inject constructor( | |
| improvJob?.cancel() | ||
| } | ||
| } | ||
|
|
||
| override suspend fun onNotificationPermissionResult(granted: Boolean) { | ||
| if (granted && BuildConfig.FLAVOR != "full") { | ||
| settingsDao.insert( | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The setting should be added for each new server though when using minimal, while this pop-up is only shown once if the permission is missing (so probably the first server added).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's where having it in the onboarding was easier :/. Should we in minimal always show the sheet ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I would always show it for minimal, because it's setting up a persistent connection which may not be necessary for each server but drain some battery. |
||
| Setting( | ||
| serverId, | ||
| WebsocketSetting.ALWAYS, | ||
| SensorUpdateFrequencySetting.NORMAL, | ||
| ), | ||
| ) | ||
| } | ||
| prefsRepository.setAskNotificationPermission(false) | ||
| } | ||
|
|
||
| override suspend fun shouldAskNotificationPermission(): Boolean { | ||
| return prefsRepository.shouldAskNotificationPermission() | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.