Merge pull request #2278 from element-hq/feature/bma/reportProblemFromOnBoarding

Add a report problem text button to the OnBoarding screen.
This commit is contained in:
Benoit Marty 2024-01-23 17:23:54 +01:00 committed by GitHub
commit 196d8a2db6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 59 additions and 22 deletions

View file

@ -24,6 +24,7 @@ import com.bumble.appyx.core.lifecycle.subscribe
import com.bumble.appyx.core.modality.BuildContext
import com.bumble.appyx.core.node.Node
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.operation.push
import dagger.assisted.Assisted
@ -54,6 +55,10 @@ class NotLoggedInFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins,
) {
interface Callback : Plugin {
fun onOpenBugReport()
}
override fun onBuilt() {
super.onBuilt()
lifecycle.subscribe(
@ -91,6 +96,10 @@ class NotLoggedInFlowNode @AssistedInject constructor(
override fun onOpenDeveloperSettings() {
backstack.push(NavTarget.ConfigureTracing)
}
override fun onReportProblem() {
plugins<Callback>().forEach { it.onOpenBugReport() }
}
}
onBoardingEntryPoint
.nodeBuilder(this, buildContext)

View file

@ -210,7 +210,14 @@ class RootFlowNode @AssistedInject constructor(
}
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 -> {
signedOutEntryPoint.nodeBuilder(this, buildContext)
.params(

1
changelog.d/2275.misc Normal file
View file

@ -0,0 +1 @@
Add "Report a problem" button to the onboarding screen

View file

@ -33,5 +33,6 @@ interface OnBoardingEntryPoint : FeatureEntryPoint {
fun onSignUp()
fun onSignIn()
fun onOpenDeveloperSettings()
fun onReportProblem()
}
}

View file

@ -49,6 +49,10 @@ class OnBoardingNode @AssistedInject constructor(
plugins<OnBoardingEntryPoint.Callback>().forEach { it.onOpenDeveloperSettings() }
}
private fun onReportProblem() {
plugins<OnBoardingEntryPoint.Callback>().forEach { it.onReportProblem() }
}
@Composable
override fun View(modifier: Modifier) {
val state = presenter.present()
@ -59,6 +63,7 @@ class OnBoardingNode @AssistedInject constructor(
onCreateAccount = ::onSignUp,
onSignInWithQrCode = { /* Not supported yet */ },
onOpenDeveloperSettings = ::onOpenDeveloperSettings,
onReportProblem = ::onReportProblem,
)
}
}

View file

@ -16,6 +16,7 @@
package io.element.android.features.onboarding.impl
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
@ -65,6 +66,7 @@ fun OnBoardingView(
onSignIn: () -> Unit,
onCreateAccount: () -> Unit,
onOpenDeveloperSettings: () -> Unit,
onReportProblem: () -> Unit,
modifier: Modifier = Modifier,
) {
OnBoardingPage(
@ -81,6 +83,7 @@ fun OnBoardingView(
onSignInWithQrCode = onSignInWithQrCode,
onSignIn = onSignIn,
onCreateAccount = onCreateAccount,
onReportProblem = onReportProblem,
)
}
)
@ -154,6 +157,7 @@ private fun OnBoardingButtons(
onSignInWithQrCode: () -> Unit,
onSignIn: () -> Unit,
onCreateAccount: () -> Unit,
onReportProblem: () -> Unit,
modifier: Modifier = Modifier,
) {
ButtonColumnMolecule(modifier = modifier) {
@ -187,6 +191,15 @@ private fun OnBoardingButtons(
)
}
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 = {},
onSignIn = {},
onCreateAccount = {},
onOpenDeveloperSettings = {}
onOpenDeveloperSettings = {},
onReportProblem = {},
)
}

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:067d37cbe20e27b8e852f3eedaa3bcc64d94d062cb825df5b826a1b584e2aa1b
size 316186
oid sha256:4595089f2c885b73cdbd79d626c3eab79da657fef1a2ce2390e761e2469a4e0b
size 313738

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08aedb3ff38729714de367a1b51b92f14907d1cd6f71a02a3b73ada46c2b86a6
size 311794
oid sha256:452876b1189da12691bca146c63202324593c791e854a1f8918a71c556a2c454
size 305809

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:94383700dd12a703f9e3773d231a18520b74037d7823d307c15c2c44ef9c4fd3
size 315047
oid sha256:f496246dd0186280943dbf3057956eef19fdfd64ccd8458c49edb32cb97f24d3
size 315968

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:672c71bf95e048043af54904e3e14909a7af37efc8dbfa0c29ba3b027db2b70a
size 305960
oid sha256:a127838495bdd790e1eeb6632d9fcfb256edd8ebe5d83f222434458b9687679c
size 307141

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aaf9e59966650af342740484f37b7e5da334a72a96faa318db0dc9ea012d891c
size 316954
oid sha256:c5c86f4f08460382392eb9404fecdc93b6ff056e0d4116f39fc6308d1061c163
size 314537

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6334be27e7a3c3fd2b000ffb8d912b84fdf3867211c261fcd6451f8321d91f9e
size 412644
oid sha256:9df131c8d7482b7b00df587cca8b385d0cd57954240368f349a24e8e6ae36322
size 405021

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8d84c6f511b9533118bf603d37e99f9a8670f8dc120c0b6ef85f0e488ffea43a
size 401150
oid sha256:d5070637e034d7ecc1db4944cb05ec056e0cbea342769a32ee030b47110f8e4b
size 386301

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:162389f0543bec631064fa9da20bf4e76150cedacc594a3299b4da231fe62502
size 404119
oid sha256:662e5beadd1baea7825ce047df87c4429f720ea7b4dd53f8ea576ada91814568
size 399093

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f980d1c2a27b18237e04679bc8a507854ebb518eab7506d1210e34bd38087a4
size 383009
oid sha256:3a76b73d9e5e94b8dd8b27addd07593bae43423b92048110b213413e1185100e
size 373027

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b19d128ca665799591b6a570be4643e482821bf9d632dc7704aacd13111d458a
size 413352
oid sha256:d1a672fea8d9f8b6a1c9646982438bf3dc66874a472c0c2269d74fccffed3a98
size 405810