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

Suppress system Matter device discovery bottom sheet #4062

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ interface WebViewPresenter {

fun sessionTimeOut(): Int

fun onStart(context: Context)

fun onFinish()

fun isSsidUsed(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ class WebViewPresenterImpl @Inject constructor(
} ?: 0
}

override fun onStart(context: Context) {
matterUseCase.suppressDiscoveryBottomSheet(context)
}

override fun onFinish() {
mainScope.cancel()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down