mirror of
https://github.com/home-assistant/android
synced 2024-07-08 20:05:52 +00:00
Suppress system Matter device discovery bottom sheet (#4062)
- Prevents the system's Matter device discovery bottom sheet from showing up while the Home Assistant app is opened.
This commit is contained in:
parent
7cc545bfac
commit
1162a82c48
|
@ -30,6 +30,11 @@ class MatterManagerImpl @Inject constructor(
|
|||
return config != null && config.components.contains("matter")
|
||||
}
|
||||
|
||||
override fun suppressDiscoveryBottomSheet(context: Context) {
|
||||
if (!appSupportsCommissioning()) return
|
||||
Matter.getCommissioningClient(context).suppressHalfSheetNotification()
|
||||
}
|
||||
|
||||
override fun startNewCommissioningFlow(
|
||||
context: Context,
|
||||
onSuccess: (IntentSender) -> Unit,
|
||||
|
|
|
@ -16,6 +16,11 @@ interface MatterManager {
|
|||
*/
|
||||
suspend fun coreSupportsCommissioning(serverId: Int): Boolean
|
||||
|
||||
/**
|
||||
* Prevent the bottom sheet for discovered Matter devices from showing up while the app is open.
|
||||
*/
|
||||
fun suppressDiscoveryBottomSheet(context: Context)
|
||||
|
||||
/**
|
||||
* Start a flow to commission a Matter device that is on the same network as this device.
|
||||
* @param onSuccess Callback that receives an intent to launch the commissioning flow
|
||||
|
|
|
@ -800,6 +800,11 @@ class WebViewActivity : BaseActivity(), io.homeassistant.companion.android.webvi
|
|||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
presenter.onStart(this)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (currentAutoplay != presenter.isAutoPlayVideoEnabled()) {
|
||||
|
|
|
@ -42,6 +42,8 @@ interface WebViewPresenter {
|
|||
|
||||
fun sessionTimeOut(): Int
|
||||
|
||||
fun onStart(context: Context)
|
||||
|
||||
fun onFinish()
|
||||
|
||||
fun isSsidUsed(): Boolean
|
||||
|
|
|
@ -287,6 +287,10 @@ class WebViewPresenterImpl @Inject constructor(
|
|||
} ?: 0
|
||||
}
|
||||
|
||||
override fun onStart(context: Context) {
|
||||
matterUseCase.suppressDiscoveryBottomSheet(context)
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
mainScope.cancel()
|
||||
}
|
||||
|
|
|
@ -14,6 +14,10 @@ class MatterManagerImpl @Inject constructor() : MatterManager {
|
|||
|
||||
override suspend fun coreSupportsCommissioning(serverId: Int): Boolean = false
|
||||
|
||||
override fun suppressDiscoveryBottomSheet(context: Context) {
|
||||
// No support, so nothing to suppress
|
||||
}
|
||||
|
||||
override fun startNewCommissioningFlow(
|
||||
context: Context,
|
||||
onSuccess: (IntentSender) -> Unit,
|
||||
|
|
Loading…
Reference in New Issue
Block a user