Merge branch 'develop' into feature/fga/presenter_tests

This commit is contained in:
ganfra 2023-01-18 20:47:15 +01:00
commit df723bfc44
300 changed files with 772 additions and 209 deletions

View file

@ -41,6 +41,7 @@ dependencies {
implementation(project(":libraries:designsystem"))
implementation(project(":libraries:elementresources"))
implementation(libs.appyx.core)
implementation(project(":libraries:ui-strings"))
ksp(libs.showkase.processor)
testImplementation(libs.test.junit)
androidTestImplementation(libs.test.junitext)

View file

@ -20,7 +20,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import io.element.android.x.core.uri.isValidUrl
import io.element.android.x.features.login.root.LoginFormState
import io.element.android.x.element.resources.R as ElementR
import io.element.android.x.ui.strings.R as StringR
@Composable
fun loginError(
@ -30,7 +30,7 @@ fun loginError(
return when {
data.login.isEmpty() -> "Please enter a login"
data.password.isEmpty() -> "Please enter a password"
throwable != null -> stringResource(id = ElementR.string.auth_invalid_login_param)
throwable != null -> stringResource(id = StringR.string.auth_invalid_login_param)
else -> "No error provided"
}
}
@ -42,7 +42,7 @@ fun changeServerError(
): String {
return when {
data.isEmpty() -> "Please enter a server URL"
!data.isValidUrl() -> stringResource(id = ElementR.string.login_error_invalid_home_server)
!data.isValidUrl() -> stringResource(id = StringR.string.login_error_invalid_home_server)
throwable != null -> "That server doesnt seem right. Please check the address."
else -> "No error provided"
}

View file

@ -48,6 +48,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
@ -61,6 +62,7 @@ import io.element.android.x.core.compose.textFieldState
import io.element.android.x.designsystem.ElementXTheme
import io.element.android.x.features.login.error.loginError
import io.element.android.x.matrix.core.SessionId
import io.element.android.x.ui.strings.R as StringR
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@ -95,7 +97,7 @@ fun LoginRootScreen(
val isError = state.loggedInState is LoggedInState.ErrorLoggingIn
// Title
Text(
text = "Welcome back",
text = stringResource(id = StringR.string.ftue_auth_welcome_back_title),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 48.dp),
@ -138,7 +140,7 @@ fun LoginRootScreen(
.fillMaxWidth()
.padding(top = 60.dp),
label = {
Text(text = "Email or username")
Text(text = stringResource(id = StringR.string.login_signin_username_hint))
},
onValueChange = {
loginFieldState = it

View file

@ -39,6 +39,7 @@ dependencies {
implementation(project(":libraries:matrix"))
implementation(project(":libraries:designsystem"))
implementation(project(":libraries:elementresources"))
implementation(project(":libraries:ui-strings"))
ksp(libs.showkase.processor)
testImplementation(libs.test.junit)
androidTestImplementation(libs.test.junitext)

View file

@ -30,7 +30,7 @@ import io.element.android.x.designsystem.components.ProgressDialog
import io.element.android.x.designsystem.components.dialogs.ConfirmationDialog
import io.element.android.x.designsystem.components.preferences.PreferenceCategory
import io.element.android.x.designsystem.components.preferences.PreferenceText
import io.element.android.x.element.resources.R as ElementR
import io.element.android.x.ui.strings.R as StringR
@Composable
fun LogoutPreferenceView(
@ -55,9 +55,9 @@ fun LogoutPreferenceView(
// Log out confirmation dialog
if (openDialog.value) {
ConfirmationDialog(
title = stringResource(id = ElementR.string.action_sign_out),
content = stringResource(id = ElementR.string.action_sign_out_confirmation_simple),
submitText = stringResource(id = ElementR.string.action_sign_out),
title = stringResource(id = StringR.string.action_sign_out),
content = stringResource(id = StringR.string.action_sign_out_confirmation_simple),
submitText = stringResource(id = StringR.string.action_sign_out),
onCancelClicked = {
openDialog.value = false
},
@ -80,9 +80,9 @@ fun LogoutPreferenceView(
fun LogoutPreferenceContent(
onClick: () -> Unit = {},
) {
PreferenceCategory(title = stringResource(id = ElementR.string.settings_general_title)) {
PreferenceCategory(title = stringResource(id = StringR.string.settings_general_title)) {
PreferenceText(
title = stringResource(id = ElementR.string.action_sign_out),
title = stringResource(id = StringR.string.action_sign_out),
icon = Icons.Default.Logout,
onClick = onClick
)

View file

@ -28,6 +28,7 @@ android {
dependencies {
implementation(project(":libraries:core"))
implementation(project(":libraries:elementresources"))
implementation(project(":libraries:ui-strings"))
implementation(project(":libraries:designsystem"))
implementation(project(":libraries:architecture"))
implementation(libs.accompanist.pager)

View file

@ -52,6 +52,7 @@ import com.google.accompanist.pager.rememberPagerState
import io.element.android.x.designsystem.components.VectorButton
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import io.element.android.x.ui.strings.R as StringR
@OptIn(ExperimentalPagerApi::class)
@Composable
@ -119,7 +120,7 @@ fun OnBoardingScreen(
)
*/
VectorButton(
text = "Sign in",
text = stringResource(id = StringR.string.login_splash_submit),
onClick = {
onSignIn()
},

View file

@ -17,7 +17,7 @@
package io.element.android.x.features.onboarding
import androidx.annotation.DrawableRes
import io.element.android.x.element.resources.R as ElementR
import io.element.android.x.ui.strings.R as StringR
class SplashCarouselStateFactory {
fun create(): SplashCarouselState {
@ -32,8 +32,8 @@ class SplashCarouselStateFactory {
return SplashCarouselState(
listOf(
SplashCarouselState.Item(
ElementR.string.ftue_auth_carousel_secure_title,
ElementR.string.ftue_auth_carousel_secure_body,
StringR.string.ftue_auth_carousel_secure_title,
StringR.string.ftue_auth_carousel_secure_body,
hero(
R.drawable.ic_splash_conversations,
R.drawable.ic_splash_conversations_dark
@ -41,20 +41,20 @@ class SplashCarouselStateFactory {
background(R.drawable.bg_carousel_page_1)
),
SplashCarouselState.Item(
ElementR.string.ftue_auth_carousel_control_title,
ElementR.string.ftue_auth_carousel_control_body,
StringR.string.ftue_auth_carousel_control_title,
StringR.string.ftue_auth_carousel_control_body,
hero(R.drawable.ic_splash_control, R.drawable.ic_splash_control_dark),
background(R.drawable.bg_carousel_page_2)
),
SplashCarouselState.Item(
ElementR.string.ftue_auth_carousel_encrypted_title,
ElementR.string.ftue_auth_carousel_encrypted_body,
StringR.string.ftue_auth_carousel_encrypted_title,
StringR.string.ftue_auth_carousel_encrypted_body,
hero(R.drawable.ic_splash_secure, R.drawable.ic_splash_secure_dark),
background(R.drawable.bg_carousel_page_3)
),
SplashCarouselState.Item(
collaborationTitle(),
ElementR.string.ftue_auth_carousel_workplace_body,
StringR.string.ftue_auth_carousel_workplace_body,
hero(
R.drawable.ic_splash_collaboration,
R.drawable.ic_splash_collaboration_dark
@ -68,7 +68,7 @@ class SplashCarouselStateFactory {
private fun collaborationTitle(): Int {
return when {
true -> R.string.cut_the_slack_from_teams
else -> ElementR.string.ftue_auth_carousel_workplace_title
else -> StringR.string.ftue_auth_carousel_workplace_title
}
}
}

View file

@ -16,5 +16,5 @@
-->
<resources>
<string name="cut_the_slack_from_teams">Cut the slack from teams.</string>
<string name="cut_the_slack_from_teams" translatable="false">Cut the slack from teams.</string>
</resources>

View file

@ -42,6 +42,7 @@ dependencies {
implementation(project(":features:logout"))
implementation(project(":libraries:designsystem"))
implementation(project(":libraries:elementresources"))
implementation(project(":libraries:ui-strings"))
implementation(libs.datetime)
implementation(libs.accompanist.placeholder)
testImplementation(libs.test.junit)

View file

@ -22,12 +22,12 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import io.element.android.x.architecture.Async
import io.element.android.x.designsystem.components.preferences.PreferenceView
import io.element.android.x.element.resources.R
import io.element.android.x.features.logout.LogoutPreferenceState
import io.element.android.x.features.logout.LogoutPreferenceView
import io.element.android.x.features.preferences.user.UserPreferences
import io.element.android.x.features.rageshake.preferences.RageshakePreferencesState
import io.element.android.x.features.rageshake.preferences.RageshakePreferencesView
import io.element.android.x.ui.strings.R as StringR
@Composable
fun PreferencesRootView(
@ -41,7 +41,7 @@ fun PreferencesRootView(
PreferenceView(
modifier = modifier,
onBackPressed = onBackPressed,
title = stringResource(id = R.string.settings)
title = stringResource(id = StringR.string.settings)
) {
UserPreferences(state.myUser)
RageshakePreferencesView(

View file

@ -39,6 +39,7 @@ dependencies {
implementation(project(":anvilannotations"))
implementation(project(":libraries:designsystem"))
implementation(project(":libraries:elementresources"))
implementation(project(":libraries:ui-strings"))
implementation(libs.squareup.seismic)
implementation(libs.androidx.datastore.preferences)
implementation(libs.coil)

View file

@ -56,7 +56,7 @@ import io.element.android.x.core.compose.textFieldState
import io.element.android.x.designsystem.ElementXTheme
import io.element.android.x.designsystem.components.LabelledCheckbox
import io.element.android.x.designsystem.components.dialogs.ErrorDialog
import io.element.android.x.element.resources.R as ElementR
import io.element.android.x.ui.strings.R as StringR
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@ -96,7 +96,7 @@ fun BugReportView(
val isFormEnabled = state.sending !is Async.Loading
// Title
Text(
text = stringResource(id = ElementR.string.send_bug_report),
text = stringResource(id = StringR.string.send_bug_report),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 16.dp),
@ -106,7 +106,7 @@ fun BugReportView(
)
// Form
Text(
text = stringResource(id = ElementR.string.send_bug_report_description),
text = stringResource(id = StringR.string.send_bug_report_description),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 16.dp),
@ -123,10 +123,10 @@ fun BugReportView(
.padding(top = 16.dp),
enabled = isFormEnabled,
label = {
Text(text = stringResource(id = ElementR.string.send_bug_report_placeholder))
Text(text = stringResource(id = StringR.string.send_bug_report_placeholder))
},
supportingText = {
Text(text = stringResource(id = ElementR.string.send_bug_report_description_in_english))
Text(text = stringResource(id = StringR.string.send_bug_report_description_in_english))
},
onValueChange = {
descriptionFieldState = it
@ -143,28 +143,28 @@ fun BugReportView(
checked = state.formState.sendLogs,
onCheckedChange = { eventSink(BugReportEvents.SetSendLog(it)) },
enabled = isFormEnabled,
text = stringResource(id = ElementR.string.send_bug_report_include_logs)
text = stringResource(id = StringR.string.send_bug_report_include_logs)
)
if (state.hasCrashLogs) {
LabelledCheckbox(
checked = state.formState.sendCrashLogs,
onCheckedChange = { eventSink(BugReportEvents.SetSendCrashLog(it)) },
enabled = isFormEnabled,
text = stringResource(id = ElementR.string.send_bug_report_include_crash_logs)
text = stringResource(id = StringR.string.send_bug_report_include_crash_logs)
)
}
LabelledCheckbox(
checked = state.formState.canContact,
onCheckedChange = { eventSink(BugReportEvents.SetCanContact(it)) },
enabled = isFormEnabled,
text = stringResource(id = ElementR.string.you_may_contact_me)
text = stringResource(id = StringR.string.you_may_contact_me)
)
if (state.screenshotUri != null) {
LabelledCheckbox(
checked = state.formState.sendScreenshot,
onCheckedChange = { eventSink(BugReportEvents.SetSendScreenshot(it)) },
enabled = isFormEnabled,
text = stringResource(id = ElementR.string.send_bug_report_include_screenshot)
text = stringResource(id = StringR.string.send_bug_report_include_screenshot)
)
if (state.formState.sendScreenshot) {
Box(
@ -191,7 +191,7 @@ fun BugReportView(
.fillMaxWidth()
.padding(vertical = 32.dp)
) {
Text(text = stringResource(id = ElementR.string.action_send))
Text(text = stringResource(id = StringR.string.action_send))
}
}
when (state.sending) {

View file

@ -22,7 +22,7 @@ import androidx.compose.ui.tooling.preview.Preview
import io.element.android.x.core.compose.LogCompositions
import io.element.android.x.designsystem.ElementXTheme
import io.element.android.x.designsystem.components.dialogs.ConfirmationDialog
import io.element.android.x.element.resources.R as ElementR
import io.element.android.x.ui.strings.R as StringR
@Composable
fun CrashDetectionView(
@ -53,10 +53,10 @@ fun CrashDetectionContent(
onDismiss: () -> Unit = { },
) {
ConfirmationDialog(
title = stringResource(id = ElementR.string.send_bug_report),
content = stringResource(id = ElementR.string.send_bug_report_app_crashed),
submitText = stringResource(id = ElementR.string.yes),
cancelText = stringResource(id = ElementR.string.no),
title = stringResource(id = StringR.string.send_bug_report),
content = stringResource(id = StringR.string.send_bug_report_app_crashed),
submitText = stringResource(id = StringR.string.yes),
cancelText = stringResource(id = StringR.string.no),
onCancelClicked = onNoClicked,
onSubmitClicked = onYesClicked,
onDismiss = onDismiss,

View file

@ -30,7 +30,7 @@ import io.element.android.x.core.screenshot.ImageResult
import io.element.android.x.core.screenshot.screenshot
import io.element.android.x.designsystem.ElementXTheme
import io.element.android.x.designsystem.components.dialogs.ConfirmationDialog
import io.element.android.x.element.resources.R as ElementR
import io.element.android.x.ui.strings.R as StringR
@Composable
fun RageshakeDetectionView(
@ -83,11 +83,11 @@ fun RageshakeDialogContent(
onYesClicked: () -> Unit = { },
) {
ConfirmationDialog(
title = stringResource(id = ElementR.string.send_bug_report),
content = stringResource(id = ElementR.string.send_bug_report_alert_message),
thirdButtonText = stringResource(id = ElementR.string.action_disable),
submitText = stringResource(id = ElementR.string.yes),
cancelText = stringResource(id = ElementR.string.no),
title = stringResource(id = StringR.string.send_bug_report),
content = stringResource(id = StringR.string.send_bug_report_alert_message),
thirdButtonText = stringResource(id = StringR.string.action_disable),
submitText = stringResource(id = StringR.string.yes),
cancelText = stringResource(id = StringR.string.no),
onCancelClicked = onNoClicked,
onThirdButtonClicked = onDisableClicked,
onSubmitClicked = onYesClicked,

Some files were not shown because too many files have changed in this diff Show more