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

Wear Assist: show login when logged out, scroll first item into view #4174

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 @@ -17,6 +17,7 @@ import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import io.homeassistant.companion.android.conversation.views.LoadAssistView
import io.homeassistant.companion.android.home.HomeActivity
import kotlinx.coroutines.launch

@AndroidEntryPoint
Expand Down Expand Up @@ -53,6 +54,9 @@ class ConversationActivity : ComponentActivity() {
val launchIntent = conversationViewModel.onCreate(hasRecordingPermission())
if (launchIntent) {
launchVoiceInputIntent()
} else if (!conversationViewModel.isRegistered()) {
startActivity(HomeActivity.newInstance(this@ConversationActivity))
finish()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class ConversationViewModel @Inject constructor(
return false
}

fun isRegistered(): Boolean = serverManager.isRegistered()

override fun getInput(): AssistInputMode = inputMode

override fun setInput(inputMode: AssistInputMode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fun ConversationResultView(
val scrollState = rememberScalingLazyListState()
LaunchedEffect(conversation.size) {
scrollState.scrollToItem(
if (inputMode != AssistViewModelBase.AssistInputMode.BLOCKED) conversation.size else (conversation.size - 1)
if (inputMode != AssistViewModelBase.AssistInputMode.BLOCKED) (conversation.size + 1) else conversation.size
)
}
if (hapticFeedback) {
Expand All @@ -135,6 +135,9 @@ fun ConversationResultView(
}

ThemeLazyColumn(state = scrollState) {
item {
Spacer(Modifier.size(1.dp)) // This exists to allow the next item to be centered
}
item {
if (currentPipeline != null) {
val textColor = LocalContentColor.current.copy(alpha = 0.38f) // disabled/hint alpha
Expand Down
Loading