From 9f82008b207b356f947bafa31ed444c2a08d83b0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 5 Feb 2024 02:27:32 +0100 Subject: [PATCH] Cleanup related to strings --- .../twom/avatar/components/AvatarEmpty.kt | 4 +- .../components/ConfigureRoomForm.kt | 16 ++- .../components/ConfigureRoomTopBar.kt | 4 +- .../steffo/twom/login/components/LoginForm.kt | 18 ++-- .../twom/login/components/LoginTopBar.kt | 4 +- .../twom/login/components/PasswordField.kt | 6 +- .../twom/main/components/AccountIconButton.kt | 9 +- .../twom/main/components/CreateRoomFAB.kt | 7 +- .../main/components/MainContentLoggedIn.kt | 2 +- .../main/components/MainContentNotLoggedIn.kt | 6 +- .../twom/main/components/RoomListItem.kt | 4 +- .../TwoMRoomDisplayNameFallbackProvider.kt | 16 +-- .../twom/viewroom/components/InviteFAB.kt | 6 +- .../twom/viewroom/components/InviteSheet.kt | 2 +- .../viewroom/components/InviteUserForm.kt | 10 +- .../viewroom/components/MemberListItem.kt | 6 +- .../twom/viewroom/components/RSVPChip.kt | 2 +- .../viewroom/components/RSVPUpdateButton.kt | 2 +- .../viewroom/components/RoomIconButton.kt | 2 +- .../twom/viewroom/components/ViewRoomForm.kt | 2 +- .../viewroom/components/ViewRoomMembers.kt | 2 +- .../viewroom/components/ViewRoomScaffold.kt | 3 +- ...vite.kt => canCurrentSessionInviteHere.kt} | 2 +- ...nIKick.kt => canCurrentSessionKickHere.kt} | 2 +- .../steffo/twom/viewroom/utils/RSVPAnswer.kt | 55 +++++----- app/src/main/res/values/strings.xml | 101 +++++++++--------- 26 files changed, 151 insertions(+), 142 deletions(-) rename app/src/main/java/eu/steffo/twom/viewroom/effects/{canIInvite.kt => canCurrentSessionInviteHere.kt} (91%) rename app/src/main/java/eu/steffo/twom/viewroom/effects/{canIKick.kt => canCurrentSessionKickHere.kt} (91%) diff --git a/app/src/main/java/eu/steffo/twom/avatar/components/AvatarEmpty.kt b/app/src/main/java/eu/steffo/twom/avatar/components/AvatarEmpty.kt index 8c46353..9f2e6f4 100644 --- a/app/src/main/java/eu/steffo/twom/avatar/components/AvatarEmpty.kt +++ b/app/src/main/java/eu/steffo/twom/avatar/components/AvatarEmpty.kt @@ -8,7 +8,9 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview +import eu.steffo.twom.R @Composable @Preview(name = "Regular", widthDp = 40, heightDp = 40) @@ -28,7 +30,7 @@ fun AvatarEmpty( modifier = Modifier .align(Alignment.Center), color = MaterialTheme.colorScheme.onTertiary.copy(alpha = alpha), - text = text ?: "?", + text = text ?: stringResource(R.string.avatar_empty_placeholder), ) } } diff --git a/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomForm.kt b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomForm.kt index 9dff761..eff0212 100644 --- a/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomForm.kt +++ b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomForm.kt @@ -58,7 +58,7 @@ fun ConfigureRoomForm( Column(modifier) { Row(Modifier.basePadding()) { - val avatarContentDescription = stringResource(R.string.create_avatar_label) + val avatarContentDescription = stringResource(R.string.configure_avatarpicker_label) AvatarPickerWrapbox( modifier = Modifier .size(60.dp) @@ -87,7 +87,7 @@ fun ConfigureRoomForm( .fillMaxWidth(), singleLine = true, label = { - Text(stringResource(R.string.create_name_label)) + Text(stringResource(R.string.configure_namepicker_label)) }, value = name, onValueChange = { name = it } @@ -100,7 +100,7 @@ fun ConfigureRoomForm( .height(180.dp) .fillMaxWidth(), label = { - Text(stringResource(R.string.create_description_label)) + Text(stringResource(R.string.configure_descriptionpicker_label)) }, value = description, onValueChange = { description = it } @@ -127,7 +127,15 @@ fun ConfigureRoomForm( activity.finish() }, ) { - Text(stringResource(R.string.create_complete_text)) + Text( + stringResource( + if (initialConfiguration != null) { + R.string.configure_submit_label_update + } else { + R.string.configure_submit_label_create + } + ) + ) } } } diff --git a/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomTopBar.kt b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomTopBar.kt index fa08d93..7e955d9 100644 --- a/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomTopBar.kt +++ b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomTopBar.kt @@ -23,9 +23,9 @@ fun ConfigureActivityTopBar( title = { Text( text = if (initialName == null) { - stringResource(R.string.create_title) + stringResource(R.string.configure_title_create) } else { - stringResource(R.string.edit_title, initialName) + stringResource(R.string.configure_title_edit, initialName) } ) } diff --git a/app/src/main/java/eu/steffo/twom/login/components/LoginForm.kt b/app/src/main/java/eu/steffo/twom/login/components/LoginForm.kt index 64c2e3a..ff20ead 100644 --- a/app/src/main/java/eu/steffo/twom/login/components/LoginForm.kt +++ b/app/src/main/java/eu/steffo/twom/login/components/LoginForm.kt @@ -16,7 +16,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R import eu.steffo.twom.errorhandling.components.ErrorText @@ -52,7 +52,7 @@ fun LoginForm( } ) Row(Modifier.basePadding()) { - Text(LocalContext.current.getString(R.string.login_text)) + Text(stringResource(R.string.login_intro_text)) } Row(Modifier.basePadding()) { TextField( @@ -61,13 +61,13 @@ fun LoginForm( value = username, onValueChange = { username = it }, label = { - Text(LocalContext.current.getString(R.string.login_username_label)) + Text(stringResource(R.string.login_username_label)) }, placeholder = { - Text(LocalContext.current.getString(R.string.login_username_placeholder)) + Text(stringResource(R.string.login_username_placeholder)) }, supportingText = { - Text(LocalContext.current.getString(R.string.login_username_supporting)) + Text(stringResource(R.string.login_username_supporting)) }, ) } @@ -77,13 +77,13 @@ fun LoginForm( value = password, onValueChange = { password = it }, label = { - Text(LocalContext.current.getString(R.string.login_password_label)) + Text(stringResource(R.string.login_password_label)) }, placeholder = { - Text(LocalContext.current.getString(R.string.login_password_placeholder)) + Text(stringResource(R.string.login_password_placeholder)) }, supportingText = { - Text(LocalContext.current.getString(R.string.login_password_supporting)) + Text(stringResource(R.string.login_password_supporting)) }, ) } @@ -98,7 +98,7 @@ fun LoginForm( } }, ) { - Text(LocalContext.current.getString(R.string.login_complete_text)) + Text(stringResource(R.string.login_submit_text)) } } manager.error.Display { diff --git a/app/src/main/java/eu/steffo/twom/login/components/LoginTopBar.kt b/app/src/main/java/eu/steffo/twom/login/components/LoginTopBar.kt index 5af05a5..ef49ea3 100644 --- a/app/src/main/java/eu/steffo/twom/login/components/LoginTopBar.kt +++ b/app/src/main/java/eu/steffo/twom/login/components/LoginTopBar.kt @@ -5,7 +5,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R import eu.steffo.twom.navigation.components.BackIconButton @@ -19,6 +19,6 @@ fun LoginActivityTopBar( TopAppBar( modifier = modifier, navigationIcon = { BackIconButton() }, - title = { Text(LocalContext.current.getString(R.string.login_title)) } + title = { Text(stringResource(R.string.login_title)) } ) } \ No newline at end of file diff --git a/app/src/main/java/eu/steffo/twom/login/components/PasswordField.kt b/app/src/main/java/eu/steffo/twom/login/components/PasswordField.kt index 7795ce1..18a1606 100644 --- a/app/src/main/java/eu/steffo/twom/login/components/PasswordField.kt +++ b/app/src/main/java/eu/steffo/twom/login/components/PasswordField.kt @@ -12,7 +12,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.tooling.preview.Preview @@ -55,10 +55,10 @@ fun PasswordField( Icons.Outlined.RemoveRedEye }, if(showPassword) { - LocalContext.current.getString(R.string.password_hide) + stringResource(R.string.password_hide) } else { - LocalContext.current.getString(R.string.password_show) + stringResource(R.string.password_show) } ) } diff --git a/app/src/main/java/eu/steffo/twom/main/components/AccountIconButton.kt b/app/src/main/java/eu/steffo/twom/main/components/AccountIconButton.kt index f0ef02c..a0f9c33 100644 --- a/app/src/main/java/eu/steffo/twom/main/components/AccountIconButton.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/AccountIconButton.kt @@ -16,7 +16,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R @@ -48,12 +47,12 @@ fun AccountIconButton( if (session == null) { Icon( imageVector = Icons.Filled.AccountCircle, - contentDescription = LocalContext.current.getString(R.string.main_account_label), + contentDescription = stringResource(R.string.accountmenu_label), ) } else { AvatarUserId( userId = session.myUserId, - contentDescription = LocalContext.current.getString(R.string.main_account_label), + contentDescription = stringResource(R.string.accountmenu_label), ) } } @@ -64,7 +63,7 @@ fun AccountIconButton( if (session == null) { DropdownMenuItem( text = { - Text(stringResource(R.string.main_account_login_text)) + Text(stringResource(R.string.accountmenu_login_label)) }, onClick = { expanded = false @@ -74,7 +73,7 @@ fun AccountIconButton( } else { DropdownMenuItem( text = { - Text(stringResource(R.string.main_account_logout_text)) + Text(stringResource(R.string.accountmenu_logout_label)) }, onClick = { expanded = false diff --git a/app/src/main/java/eu/steffo/twom/main/components/CreateRoomFAB.kt b/app/src/main/java/eu/steffo/twom/main/components/CreateRoomFAB.kt index 43152c8..d5d0dd9 100644 --- a/app/src/main/java/eu/steffo/twom/main/components/CreateRoomFAB.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/CreateRoomFAB.kt @@ -125,10 +125,7 @@ fun CreateRoomFAB( Log.i(TAG, "Creating room: ${createRoomParams.name}") val roomId = session.roomService().createRoom(createRoomParams) - Log.d( - TAG, - "Successfully created room: ${createRoomParams.name}" - ) + Log.d(TAG, "Successfully created room: $roomId") } } @@ -142,7 +139,7 @@ fun CreateRoomFAB( ) }, text = { - Text(stringResource(R.string.main_efab_create_text)) + Text(stringResource(R.string.createroom_label)) } ) } \ No newline at end of file diff --git a/app/src/main/java/eu/steffo/twom/main/components/MainContentLoggedIn.kt b/app/src/main/java/eu/steffo/twom/main/components/MainContentLoggedIn.kt index 35731e6..9c961c0 100644 --- a/app/src/main/java/eu/steffo/twom/main/components/MainContentLoggedIn.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/MainContentLoggedIn.kt @@ -43,7 +43,7 @@ fun MainContentLoggedIn( } else if (roomSummaries!!.isEmpty()) { Text( modifier = Modifier.basePadding(), - text = stringResource(R.string.main_roomlist_empty_text) + text = stringResource(R.string.main_empty_text) ) } else { roomSummaries!!.forEach { RoomListItem(it) } diff --git a/app/src/main/java/eu/steffo/twom/main/components/MainContentNotLoggedIn.kt b/app/src/main/java/eu/steffo/twom/main/components/MainContentNotLoggedIn.kt index 0a432b5..954e12a 100644 --- a/app/src/main/java/eu/steffo/twom/main/components/MainContentNotLoggedIn.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/MainContentNotLoggedIn.kt @@ -5,7 +5,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R import eu.steffo.twom.theme.utils.basePadding @@ -17,10 +17,10 @@ fun MainContentNotLoggedIn( ) { Column(modifier) { Row(Modifier.basePadding()) { - Text(LocalContext.current.getString(R.string.main_notloggedin_text_1)) + Text(stringResource(R.string.main_notloggedin_intro_1)) } Row(Modifier.basePadding()) { - Text(LocalContext.current.getString(R.string.main_notloggedin_text_2)) + Text(stringResource(R.string.main_notloggedin_intro_2)) } } } \ No newline at end of file diff --git a/app/src/main/java/eu/steffo/twom/main/components/RoomListItem.kt b/app/src/main/java/eu/steffo/twom/main/components/RoomListItem.kt index f4bb6e6..d160051 100644 --- a/app/src/main/java/eu/steffo/twom/main/components/RoomListItem.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/RoomListItem.kt @@ -136,9 +136,9 @@ fun RoomListItem( Text( text = stringResource( id = if (count != 1) { - R.string.main_partecipants + R.string.main_partecipantcount_text_plural } else { - R.string.main_partecipant + R.string.main_partecipantcount_text_singular }, count, ), diff --git a/app/src/main/java/eu/steffo/twom/matrix/utils/TwoMRoomDisplayNameFallbackProvider.kt b/app/src/main/java/eu/steffo/twom/matrix/utils/TwoMRoomDisplayNameFallbackProvider.kt index b375b50..3913196 100644 --- a/app/src/main/java/eu/steffo/twom/matrix/utils/TwoMRoomDisplayNameFallbackProvider.kt +++ b/app/src/main/java/eu/steffo/twom/matrix/utils/TwoMRoomDisplayNameFallbackProvider.kt @@ -10,15 +10,15 @@ class TwoMRoomDisplayNameFallbackProvider( ) : RoomDisplayNameFallbackProvider { override fun getNameFor1member(name: String): String { - return context.getString(R.string.room_name_fallback_members_1).format(name) + return context.getString(R.string.matrix_fallback_members_1).format(name) } override fun getNameFor2members(name1: String, name2: String): String { - return context.getString(R.string.room_name_fallback_members_2).format(name1, name2) + return context.getString(R.string.matrix_fallback_members_2).format(name1, name2) } override fun getNameFor3members(name1: String, name2: String, name3: String): String { - return context.getString(R.string.room_name_fallback_members_3).format(name1, name2, name3) + return context.getString(R.string.matrix_fallback_members_3).format(name1, name2, name3) } override fun getNameFor4members( @@ -27,7 +27,8 @@ class TwoMRoomDisplayNameFallbackProvider( name3: String, name4: String ): String { - return context.getString(R.string.room_name_fallback_members_4).format(name1, name2, name3, name4) + return context.getString(R.string.matrix_fallback_members_4) + .format(name1, name2, name3, name4) } override fun getNameFor4membersAndMore( @@ -36,14 +37,15 @@ class TwoMRoomDisplayNameFallbackProvider( name3: String, remainingCount: Int ): String { - return context.getString(R.string.room_name_fallback_members_more).format(name1, name2, name3, remainingCount) + return context.getString(R.string.matrix_fallback_members_more) + .format(name1, name2, name3, remainingCount) } override fun getNameForEmptyRoom(isDirect: Boolean, leftMemberNames: List): String { - return context.getString(R.string.room_name_fallback_members_0) + return context.getString(R.string.matrix_fallback_members_0) } override fun getNameForRoomInvite(): String { - return context.getString(R.string.room_name_fallback_invite) + return context.getString(R.string.matrix_fallback_invite) } } diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/InviteFAB.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteFAB.kt index 1c94a4e..19082f3 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/InviteFAB.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteFAB.kt @@ -10,7 +10,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.viewroom.effects.canIInvite +import eu.steffo.twom.viewroom.effects.canCurrentSessionInviteHere @Composable @Preview @@ -18,7 +18,7 @@ fun InviteFAB( modifier: Modifier = Modifier, onClick: () -> Unit = {}, ) { - if (!canIInvite()) { + if (!canCurrentSessionInviteHere()) { return } @@ -32,7 +32,7 @@ fun InviteFAB( ) }, text = { - Text(stringResource(R.string.room_invite_button_label)) + Text(stringResource(R.string.invite_submit_label)) } ) } \ No newline at end of file diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/InviteSheet.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteSheet.kt index 998bdb9..e745ce6 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/InviteSheet.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteSheet.kt @@ -50,7 +50,7 @@ fun InviteSheet( modifier = Modifier .basePadding() .fillMaxWidth(), - text = stringResource(R.string.room_invite_title), + text = stringResource(R.string.invite_title), style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center, ) diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/InviteUserForm.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteUserForm.kt index 01c2a35..4303121 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/InviteUserForm.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteUserForm.kt @@ -44,7 +44,7 @@ fun InviteUserForm( if (room == null) { ErrorText( modifier = Modifier.basePadding(), - text = stringResource(R.string.room_error_room_notfound) + text = stringResource(R.string.invite_error_room_notfound) ) return } @@ -58,12 +58,12 @@ fun InviteUserForm( singleLine = true, label = { Text( - text = stringResource(R.string.room_invite_username_label) + text = stringResource(R.string.invite_username_label) ) }, placeholder = { Text( - text = stringResource(R.string.room_invite_username_placeholder) + text = stringResource(R.string.invite_username_placeholder) ) }, ) @@ -88,7 +88,7 @@ fun InviteUserForm( room.membershipService().invite(userId) } catch (e: Throwable) { Log.e("Room", "Failed to send invite to `$userId`: $error") - error = LocalizableError(R.string.room_error_invite_generic, e) + error = LocalizableError(R.string.invite_error_invite_generic, e) busy = false return@SendInvite } @@ -101,7 +101,7 @@ fun InviteUserForm( }, ) { Text( - text = stringResource(R.string.room_invite_button_label) + text = stringResource(R.string.invite_submit_label) ) } diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/MemberListItem.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/MemberListItem.kt index 0e207e8..da7e97c 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/MemberListItem.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/MemberListItem.kt @@ -28,7 +28,7 @@ import eu.steffo.twom.avatar.components.AvatarUser import eu.steffo.twom.errorhandling.components.ErrorText import eu.steffo.twom.matrix.complocals.LocalSession import eu.steffo.twom.viewroom.complocals.LocalRoom -import eu.steffo.twom.viewroom.effects.canIKick +import eu.steffo.twom.viewroom.effects.canCurrentSessionKickHere import eu.steffo.twom.viewroom.effects.observeRSVP import eu.steffo.twom.viewroom.effects.resolveUser import eu.steffo.twom.viewroom.utils.RSVPAnswer @@ -61,14 +61,14 @@ fun MemberListItem( val room = roomRequest.getOrNull() if (room == null) { ErrorText( - text = stringResource(R.string.room_error_room_notfound) + text = stringResource(R.string.invite_error_room_notfound) ) return } // This might not be necessary; I'm not sure when the internal Matrix client resolves users val user = resolveUser(member.userId) - val canKick = canIKick() + val canKick = canCurrentSessionKickHere() val scope = rememberCoroutineScope() diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChip.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChip.kt index 6e10563..94ba421 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChip.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChip.kt @@ -33,7 +33,7 @@ fun RSVPChip( }, label = { Text( - text = representedAnswer.toLabel() ?: "[missing label]", + text = representedAnswer.toLabel(), style = MaterialTheme.typography.bodyLarge, ) }, diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPUpdateButton.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPUpdateButton.kt index ee1218e..203b1e7 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPUpdateButton.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPUpdateButton.kt @@ -30,7 +30,7 @@ fun RSVPUpdateButton( ) ) { Text( - text = stringResource(R.string.room_rsvp_update_label) + text = stringResource(R.string.room_update_label) ) } } diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/RoomIconButton.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RoomIconButton.kt index 0fbc6c3..969b531 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/RoomIconButton.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RoomIconButton.kt @@ -70,7 +70,7 @@ fun RoomIconButton( val room = roomRequest.getOrNull() if (room == null) { ErrorIconButton( - message = stringResource(R.string.room_error_room_notfound) + message = stringResource(R.string.invite_error_room_notfound) ) return } diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomForm.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomForm.kt index cf703d2..8596ad8 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomForm.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomForm.kt @@ -59,7 +59,7 @@ fun ViewRoomForm() { if (room == null) { Row(Modifier.basePadding()) { ErrorText( - text = stringResource(R.string.room_error_room_notfound) + text = stringResource(R.string.invite_error_room_notfound) ) } return diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomMembers.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomMembers.kt index 5abf451..ebb623e 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomMembers.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomMembers.kt @@ -37,7 +37,7 @@ fun ViewRoomMembers() { if (room == null) { Row(Modifier.basePadding()) { ErrorText( - text = stringResource(R.string.room_error_room_notfound) + text = stringResource(R.string.invite_error_room_notfound) ) } return diff --git a/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomScaffold.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomScaffold.kt index 6917cae..2e304f5 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomScaffold.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomScaffold.kt @@ -1,6 +1,5 @@ package eu.steffo.twom.viewroom.components -import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.padding import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Scaffold @@ -20,7 +19,7 @@ import eu.steffo.twom.viewroom.complocals.LocalRoomSummary import org.matrix.android.sdk.api.session.Session import java.util.Optional -@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable fun ViewRoomScaffold( session: Session, diff --git a/app/src/main/java/eu/steffo/twom/viewroom/effects/canIInvite.kt b/app/src/main/java/eu/steffo/twom/viewroom/effects/canCurrentSessionInviteHere.kt similarity index 91% rename from app/src/main/java/eu/steffo/twom/viewroom/effects/canIInvite.kt rename to app/src/main/java/eu/steffo/twom/viewroom/effects/canCurrentSessionInviteHere.kt index 4058e96..be2a478 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/effects/canIInvite.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/effects/canCurrentSessionInviteHere.kt @@ -6,7 +6,7 @@ import observePowerLevels import kotlin.jvm.optionals.getOrNull @Composable -fun canIInvite(): Boolean { +fun canCurrentSessionInviteHere(): Boolean { val session = LocalSession.current ?: return false val powerLevelsRequest = observePowerLevels() ?: return false val powerLevels = powerLevelsRequest.getOrNull() ?: return false diff --git a/app/src/main/java/eu/steffo/twom/viewroom/effects/canIKick.kt b/app/src/main/java/eu/steffo/twom/viewroom/effects/canCurrentSessionKickHere.kt similarity index 91% rename from app/src/main/java/eu/steffo/twom/viewroom/effects/canIKick.kt rename to app/src/main/java/eu/steffo/twom/viewroom/effects/canCurrentSessionKickHere.kt index c4fa0c5..fe7a3bf 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/effects/canIKick.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/effects/canCurrentSessionKickHere.kt @@ -6,7 +6,7 @@ import observePowerLevels import kotlin.jvm.optionals.getOrNull @Composable -fun canIKick(): Boolean { +fun canCurrentSessionKickHere(): Boolean { val session = LocalSession.current ?: return false val powerLevelsRequest = observePowerLevels() ?: return false val powerLevels = powerLevelsRequest.getOrNull() ?: return false diff --git a/app/src/main/java/eu/steffo/twom/viewroom/utils/RSVPAnswer.kt b/app/src/main/java/eu/steffo/twom/viewroom/utils/RSVPAnswer.kt index 27dfbdc..62a39ea 100644 --- a/app/src/main/java/eu/steffo/twom/viewroom/utils/RSVPAnswer.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/utils/RSVPAnswer.kt @@ -34,15 +34,15 @@ enum class RSVPAnswer { @Composable override fun toLabel(): String = - stringResource(R.string.room_rsvp_sure_label) + stringResource(R.string.rsvp_sure_label) @Composable override fun toResponse(): String = - stringResource(R.string.room_rsvp_sure_response) + stringResource(R.string.rsvp_sure_response) @Composable override fun toCommentPlaceholder(): String = - stringResource(R.string.room_rsvp_sure_placeholder) + stringResource(R.string.rsvp_sure_placeholder) }, // Will be there, but later! @@ -58,15 +58,15 @@ enum class RSVPAnswer { @Composable override fun toLabel(): String = - stringResource(R.string.room_rsvp_later_label) + stringResource(R.string.rsvp_later_label) @Composable override fun toResponse(): String = - stringResource(R.string.room_rsvp_later_response) + stringResource(R.string.rsvp_later_response) @Composable override fun toCommentPlaceholder(): String = - stringResource(R.string.room_rsvp_later_placeholder) + stringResource(R.string.rsvp_later_placeholder) }, // Might be there... @@ -82,15 +82,15 @@ enum class RSVPAnswer { @Composable override fun toLabel(): String = - stringResource(R.string.room_rsvp_maybe_label) + stringResource(R.string.rsvp_maybe_label) @Composable override fun toResponse(): String = - stringResource(R.string.room_rsvp_maybe_response) + stringResource(R.string.rsvp_maybe_response) @Composable override fun toCommentPlaceholder(): String = - stringResource(R.string.room_rsvp_maybe_placeholder) + stringResource(R.string.rsvp_maybe_placeholder) }, // Won't be there. @@ -106,15 +106,15 @@ enum class RSVPAnswer { @Composable override fun toLabel(): String = - stringResource(R.string.room_rsvp_noway_label) + stringResource(R.string.rsvp_noway_label) @Composable override fun toResponse(): String = - stringResource(R.string.room_rsvp_noway_response) + stringResource(R.string.rsvp_noway_response) @Composable override fun toCommentPlaceholder(): String = - stringResource(R.string.room_rsvp_noway_placeholder) + stringResource(R.string.rsvp_noway_placeholder) }, // An option differing from the previous ones. @@ -129,16 +129,16 @@ enum class RSVPAnswer { get() = Icons.Outlined.BuildCircle @Composable - override fun toLabel(): String? = - null + override fun toLabel(): String = + stringResource(R.string.rsvp_nolabel) @Composable override fun toResponse(): String = - stringResource(R.string.room_rsvp_unknown_response) + stringResource(R.string.rsvp_unknown_response) @Composable override fun toCommentPlaceholder(): String = - stringResource(R.string.room_rsvp_nullish_placeholder) + stringResource(R.string.rsvp_nullish_placeholder) }, // The answer is still being loaded. @@ -153,7 +153,8 @@ enum class RSVPAnswer { get() = Icons.Outlined.HourglassEmpty @Composable - override fun toLabel(): String? = null + override fun toLabel(): String = + stringResource(R.string.rsvp_nolabel) @Composable override fun toResponse(): String = @@ -161,7 +162,7 @@ enum class RSVPAnswer { @Composable override fun toCommentPlaceholder(): String = - stringResource(R.string.room_rsvp_nullish_placeholder) + stringResource(R.string.rsvp_nullish_placeholder) }, // No answer has been provided yet. @@ -176,16 +177,16 @@ enum class RSVPAnswer { get() = Icons.Outlined.Circle @Composable - override fun toLabel(): String? = - null + override fun toLabel(): String = + stringResource(R.string.rsvp_nolabel) @Composable override fun toResponse(): String = - stringResource(R.string.room_rsvp_none_response) + stringResource(R.string.rsvp_none_response) @Composable override fun toCommentPlaceholder(): String = - stringResource(R.string.room_rsvp_nullish_placeholder) + stringResource(R.string.rsvp_nullish_placeholder) }, // Has been invited, but has not accepted yet. @@ -200,16 +201,16 @@ enum class RSVPAnswer { get() = Icons.Outlined.MoreHoriz @Composable - override fun toLabel(): String? = - null + override fun toLabel(): String = + stringResource(R.string.rsvp_nolabel) @Composable override fun toResponse(): String = - stringResource(R.string.room_rsvp_pending_response) + stringResource(R.string.rsvp_pending_response) @Composable override fun toCommentPlaceholder(): String = - stringResource(R.string.room_rsvp_nullish_placeholder) + stringResource(R.string.rsvp_nullish_placeholder) }; abstract val value: String @@ -217,7 +218,7 @@ enum class RSVPAnswer { abstract val icon: ImageVector @Composable - abstract fun toLabel(): String? + abstract fun toLabel(): String @Composable abstract fun toResponse(): String diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f0bb1ee..ae8f388 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,68 +1,66 @@ - TwoM - A brand new party - Partying with %1$s - Partying with %1$s and %2$s - Partying with %1$s, %2$s, and %3$s - Partying with %1$s, %2$s, %3$s, and %4$s - Partying with %1$s, %2$s, %3$s and %4$d others - Party invite + TwoM + A brand new party + Partying with %1$s + Partying with %1$s and %2$s + Partying with %1$s, %2$s, and %3$s + Partying with %1$s, %2$s, %3$s, and %4$s + Partying with %1$s, %2$s, %3$s and %4$d others + Party invite Log into Matrix Go back - To use TwoM, you need to log into a Matrix homeserver. Currently, TwoM supports only username and password authentication. - Log in - \@steffo:candy.steffo.eu + To use TwoM, you need to log into a Matrix homeserver. Currently, TwoM supports only username and password authentication. + Log in + \@steffo:candy.steffo.eu The Matrix ID to login as, including the leading \"@\" and the trailing \":localpart\". - p4ssw0rd! + p4ssw0rd! The password of the Matrix account. Username Password Show password Hide password - To use TwoM, you need to select the Matrix account to use. - My account - Logout - There are no rooms. + To use TwoM, you need to select the Matrix account to use. + My account + Logout + There are no rooms. Loading… - New - Log into your Matrix account by clicking the icon on the top right of the screen. - Login - Create a new happening - Name - Select happening avatar - Description - Create + Log into your Matrix account by clicking the icon on the top right of the screen. + Login + Create a new happening + Name + Select happening avatar + Description + Create Room options Error The entered username is not a valid Matrix ID. Failed to detect well-known data for the specified Matrix homeserver. The server might not exist, be offline, or not be supporting well-known lookups. Invitees Your reply - Sure! - I\'ll be late… - Maybe? - Nope. + Sure! + I\'ll be late… + Maybe? + Nope. About this party [unknown user] - Will be there - Will arrive late - Will maybe partecipate - Won\'t be there - Anything to add? - Why will you be late? - What will determine your partecipation? - Why won\'t you partecipate? - Update + Will be there + Will arrive late + Will maybe partecipate + Won\'t be there + Anything to add? + Why will you be late? + What will determine your partecipation? + Why won\'t you partecipate? The Matrix session context has not been initialized. - Could not find the requested Matrix room. + Could not find the requested Matrix room. The Matrix room context has not been initialized. The Matrix room summary context has not been initialized. Could not find the requested Matrix room summary. - \@steffotwo:candy.steffo.eu - User you want to invite + \@steffotwo:candy.steffo.eu + User you want to invite Reason - Invite - Send an invite + Invite + Send an invite Not opened Hasn\'t opened the invite yet Leave party @@ -75,18 +73,21 @@ Edit party Zoom on avatar Could not retrieve the list of room members. - Leave a comment... - Has given an unsupported response - Hasn\'t responded yet - Hasn\'t opened the invite yet + Leave a comment... + Has given an unsupported response + Hasn\'t responded yet + Hasn\'t opened the invite yet Uninvite Something went wrong while updating your RSVP: %1$s Your response has been updated, but something went wrong while attempting to remove your previous one: %1$s You have been removed from the room. - Something went wrong while sending the invite: %1$s - Editing %1$s - %1$d partecipants - %1$d partecipant + Something went wrong while sending the invite: %1$s + Editing %1$s + %1$d partecipants + %1$d partecipant Reject invite Something went wrong while opening the invite: %1$s + \? + [unlabeled] + Update \ No newline at end of file