mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Add a report problem text button to the OnBoarding screen #2275.
This commit is contained in:
@@ -24,6 +24,7 @@ import com.bumble.appyx.core.lifecycle.subscribe
|
|||||||
import com.bumble.appyx.core.modality.BuildContext
|
import com.bumble.appyx.core.modality.BuildContext
|
||||||
import com.bumble.appyx.core.node.Node
|
import com.bumble.appyx.core.node.Node
|
||||||
import com.bumble.appyx.core.plugin.Plugin
|
import com.bumble.appyx.core.plugin.Plugin
|
||||||
|
import com.bumble.appyx.core.plugin.plugins
|
||||||
import com.bumble.appyx.navmodel.backstack.BackStack
|
import com.bumble.appyx.navmodel.backstack.BackStack
|
||||||
import com.bumble.appyx.navmodel.backstack.operation.push
|
import com.bumble.appyx.navmodel.backstack.operation.push
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
@@ -54,6 +55,10 @@ class NotLoggedInFlowNode @AssistedInject constructor(
|
|||||||
buildContext = buildContext,
|
buildContext = buildContext,
|
||||||
plugins = plugins,
|
plugins = plugins,
|
||||||
) {
|
) {
|
||||||
|
interface Callback : Plugin {
|
||||||
|
fun onOpenBugReport()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onBuilt() {
|
override fun onBuilt() {
|
||||||
super.onBuilt()
|
super.onBuilt()
|
||||||
lifecycle.subscribe(
|
lifecycle.subscribe(
|
||||||
@@ -91,6 +96,10 @@ class NotLoggedInFlowNode @AssistedInject constructor(
|
|||||||
override fun onOpenDeveloperSettings() {
|
override fun onOpenDeveloperSettings() {
|
||||||
backstack.push(NavTarget.ConfigureTracing)
|
backstack.push(NavTarget.ConfigureTracing)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onReportProblem() {
|
||||||
|
plugins<Callback>().forEach { it.onOpenBugReport() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onBoardingEntryPoint
|
onBoardingEntryPoint
|
||||||
.nodeBuilder(this, buildContext)
|
.nodeBuilder(this, buildContext)
|
||||||
|
|||||||
@@ -210,7 +210,14 @@ class RootFlowNode @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
createNode<LoggedInAppScopeFlowNode>(buildContext, plugins = listOf(inputs, callback))
|
createNode<LoggedInAppScopeFlowNode>(buildContext, plugins = listOf(inputs, callback))
|
||||||
}
|
}
|
||||||
NavTarget.NotLoggedInFlow -> createNode<NotLoggedInFlowNode>(buildContext)
|
NavTarget.NotLoggedInFlow -> {
|
||||||
|
val callback = object : NotLoggedInFlowNode.Callback {
|
||||||
|
override fun onOpenBugReport() {
|
||||||
|
backstack.push(NavTarget.BugReport)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createNode<NotLoggedInFlowNode>(buildContext, plugins = listOf(callback))
|
||||||
|
}
|
||||||
is NavTarget.SignedOutFlow -> {
|
is NavTarget.SignedOutFlow -> {
|
||||||
signedOutEntryPoint.nodeBuilder(this, buildContext)
|
signedOutEntryPoint.nodeBuilder(this, buildContext)
|
||||||
.params(
|
.params(
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Add "Report a problem" button to the onboarding screen
|
||||||
+1
@@ -33,5 +33,6 @@ interface OnBoardingEntryPoint : FeatureEntryPoint {
|
|||||||
fun onSignUp()
|
fun onSignUp()
|
||||||
fun onSignIn()
|
fun onSignIn()
|
||||||
fun onOpenDeveloperSettings()
|
fun onOpenDeveloperSettings()
|
||||||
|
fun onReportProblem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -49,6 +49,10 @@ class OnBoardingNode @AssistedInject constructor(
|
|||||||
plugins<OnBoardingEntryPoint.Callback>().forEach { it.onOpenDeveloperSettings() }
|
plugins<OnBoardingEntryPoint.Callback>().forEach { it.onOpenDeveloperSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun onReportProblem() {
|
||||||
|
plugins<OnBoardingEntryPoint.Callback>().forEach { it.onReportProblem() }
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
@@ -59,6 +63,7 @@ class OnBoardingNode @AssistedInject constructor(
|
|||||||
onCreateAccount = ::onSignUp,
|
onCreateAccount = ::onSignUp,
|
||||||
onSignInWithQrCode = { /* Not supported yet */ },
|
onSignInWithQrCode = { /* Not supported yet */ },
|
||||||
onOpenDeveloperSettings = ::onOpenDeveloperSettings,
|
onOpenDeveloperSettings = ::onOpenDeveloperSettings,
|
||||||
|
onReportProblem = ::onReportProblem,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-1
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package io.element.android.features.onboarding.impl
|
package io.element.android.features.onboarding.impl
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
@@ -65,6 +66,7 @@ fun OnBoardingView(
|
|||||||
onSignIn: () -> Unit,
|
onSignIn: () -> Unit,
|
||||||
onCreateAccount: () -> Unit,
|
onCreateAccount: () -> Unit,
|
||||||
onOpenDeveloperSettings: () -> Unit,
|
onOpenDeveloperSettings: () -> Unit,
|
||||||
|
onReportProblem: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
OnBoardingPage(
|
OnBoardingPage(
|
||||||
@@ -81,6 +83,7 @@ fun OnBoardingView(
|
|||||||
onSignInWithQrCode = onSignInWithQrCode,
|
onSignInWithQrCode = onSignInWithQrCode,
|
||||||
onSignIn = onSignIn,
|
onSignIn = onSignIn,
|
||||||
onCreateAccount = onCreateAccount,
|
onCreateAccount = onCreateAccount,
|
||||||
|
onReportProblem = onReportProblem,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -154,6 +157,7 @@ private fun OnBoardingButtons(
|
|||||||
onSignInWithQrCode: () -> Unit,
|
onSignInWithQrCode: () -> Unit,
|
||||||
onSignIn: () -> Unit,
|
onSignIn: () -> Unit,
|
||||||
onCreateAccount: () -> Unit,
|
onCreateAccount: () -> Unit,
|
||||||
|
onReportProblem: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
ButtonColumnMolecule(modifier = modifier) {
|
ButtonColumnMolecule(modifier = modifier) {
|
||||||
@@ -187,6 +191,15 @@ private fun OnBoardingButtons(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
// Add a report problem text button. Use a Text since we need a special theme here.
|
||||||
|
Text(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(8.dp)
|
||||||
|
.clickable(onClick = onReportProblem),
|
||||||
|
text = stringResource(id = CommonStrings.common_report_a_problem),
|
||||||
|
style = ElementTheme.typography.fontBodySmRegular,
|
||||||
|
color = ElementTheme.colors.textSecondary,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,6 +213,7 @@ internal fun OnBoardingScreenPreview(
|
|||||||
onSignInWithQrCode = {},
|
onSignInWithQrCode = {},
|
||||||
onSignIn = {},
|
onSignIn = {},
|
||||||
onCreateAccount = {},
|
onCreateAccount = {},
|
||||||
onOpenDeveloperSettings = {}
|
onOpenDeveloperSettings = {},
|
||||||
|
onReportProblem = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user