Add default value for noActivityFoundMessage

This commit is contained in:
Benoit Marty 2023-04-07 15:13:06 +02:00 committed by Benoit Marty
parent 12f65ba59c
commit b396ce3e20
9 changed files with 20 additions and 15 deletions

View file

@ -38,7 +38,7 @@ fun LoggedInView(
state = state.permissionsState,
modifier = modifier,
openSystemSettings = {
activity?.let { openAppSettingsPage(it, "") }
activity?.let { openAppSettingsPage(it) }
}
)
}

View file

@ -31,7 +31,6 @@ import io.element.android.libraries.androidutils.system.startSharePlainTextInten
import io.element.android.libraries.di.RoomScope
import io.element.android.libraries.matrix.api.permalink.PermalinkBuilder
import io.element.android.libraries.matrix.api.room.MatrixRoom
import io.element.android.libraries.ui.strings.R as StringR
@ContributesNode(RoomScope::class)
class RoomDetailsNode @AssistedInject constructor(
@ -57,7 +56,6 @@ class RoomDetailsNode @AssistedInject constructor(
activityResultLauncher = null,
chooserTitle = context.getString(R.string.screen_room_details_share_room_title),
text = permalink,
noActivityFoundMessage = context.getString(StringR.string.error_no_compatible_app_found)
)
}
}

View file

@ -32,6 +32,7 @@ import androidx.activity.result.ActivityResultLauncher
import androidx.annotation.ChecksSdkIntAtLeast
import androidx.annotation.RequiresApi
import androidx.core.content.getSystemService
import io.element.android.libraries.androidutils.R
import io.element.android.libraries.androidutils.compat.getApplicationInfoCompat
/**
@ -125,7 +126,7 @@ fun startNotificationSettingsIntent(context: Context, activityResultLauncher: Ac
fun openAppSettingsPage(
activity: Activity,
noActivityFoundMessage: String,
noActivityFoundMessage: String = activity.getString(R.string.error_no_compatible_app_found),
) {
try {
activity.startActivity(
@ -156,7 +157,7 @@ fun startNotificationChannelSettingsIntent(activity: Activity, channelID: String
fun startAddGoogleAccountIntent(
context: Context,
activityResultLauncher: ActivityResultLauncher<Intent>,
noActivityFoundMessage: String,
noActivityFoundMessage: String = context.getString(R.string.error_no_compatible_app_found),
) {
val intent = Intent(Settings.ACTION_ADD_ACCOUNT)
intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, arrayOf("com.google"))
@ -171,7 +172,7 @@ fun startAddGoogleAccountIntent(
fun startInstallFromSourceIntent(
context: Context,
activityResultLauncher: ActivityResultLauncher<Intent>,
noActivityFoundMessage: String,
noActivityFoundMessage: String = context.getString(R.string.error_no_compatible_app_found),
) {
val intent = Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES)
.setData(Uri.parse(String.format("package:%s", context.packageName)))
@ -189,7 +190,7 @@ fun startSharePlainTextIntent(
text: String,
subject: String? = null,
extraTitle: String? = null,
noActivityFoundMessage: String,
noActivityFoundMessage: String = context.getString(R.string.error_no_compatible_app_found),
) {
val share = Intent(Intent.ACTION_SEND)
share.type = "text/plain"
@ -217,7 +218,7 @@ fun startSharePlainTextIntent(
fun startImportTextFromFileIntent(
context: Context,
activityResultLauncher: ActivityResultLauncher<Intent>,
noActivityFoundMessage: String,
noActivityFoundMessage: String = context.getString(R.string.error_no_compatible_app_found),
) {
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
type = "text/plain"

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="error_no_compatible_app_found">"No compatible app was found to handle this action."</string>
</resources>

View file

@ -107,7 +107,6 @@
<string name="emoji_picker_category_symbols">"Símbolos"</string>
<string name="error_failed_creating_the_permalink">"No se pudo crear el enlace permanente"</string>
<string name="error_failed_loading_messages">"Error al cargar mensajes"</string>
<string name="error_no_compatible_app_found">"No se encontró ninguna aplicación compatible con esta acción."</string>
<string name="error_some_messages_have_not_been_sent">"Algunos mensajes no se han enviado"</string>
<string name="error_unknown">"Lo siento, se ha producido un error"</string>
<string name="invite_friends_text">"Hola, puedes hablar conmigo en %1$s: %2$s"</string>
@ -145,4 +144,4 @@
<string name="settings_title_general">"General"</string>
<string name="settings_version_number">"Versión: %1$s (%2$s)"</string>
<string name="test_language_identifier">"es"</string>
</resources>
</resources>

View file

@ -107,7 +107,6 @@
<string name="emoji_picker_category_symbols">"Simboli"</string>
<string name="error_failed_creating_the_permalink">"Impossibile creare il collegamento permanente"</string>
<string name="error_failed_loading_messages">"Caricamento dei messaggi non riuscito"</string>
<string name="error_no_compatible_app_found">"Non è stata trovata alcuna app compatibile per gestire questa azione."</string>
<string name="error_some_messages_have_not_been_sent">"Alcuni messaggi non sono stati inviati"</string>
<string name="error_unknown">"Siamo spiacenti, si è verificato un errore"</string>
<string name="invite_friends_text">"Ehi, parlami su %1$s: %2$s"</string>
@ -145,4 +144,4 @@
<string name="settings_title_general">"Generali"</string>
<string name="settings_version_number">"Versione: %1$s (%2$s)"</string>
<string name="test_language_identifier">"it"</string>
</resources>
</resources>

View file

@ -107,7 +107,6 @@
<string name="emoji_picker_category_symbols">"Simboluri"</string>
<string name="error_failed_creating_the_permalink">"Crearea permalink-ului a eșuat"</string>
<string name="error_failed_loading_messages">"Încărcarea mesajelor a eșuat"</string>
<string name="error_no_compatible_app_found">"Nu a fost găsită nicio aplicație capabilă să gestioneze această acțiune."</string>
<string name="error_some_messages_have_not_been_sent">"Unele mesaje nu au fost trimise"</string>
<string name="error_unknown">"Ne pare rău, a apărut o eroare"</string>
<string name="invite_friends_text">"Hei, vorbește cu mine pe %1$s: %2$s"</string>
@ -147,4 +146,4 @@
<string name="settings_title_general">"General"</string>
<string name="settings_version_number">"Versiunea: %1$s (%2$s)"</string>
<string name="test_language_identifier">"ro"</string>
</resources>
</resources>

View file

@ -114,7 +114,6 @@
<string name="emoji_picker_category_symbols">"Symbols"</string>
<string name="error_failed_creating_the_permalink">"Failed creating the permalink"</string>
<string name="error_failed_loading_messages">"Failed loading messages"</string>
<string name="error_no_compatible_app_found">"No compatible app was found to handle this action."</string>
<string name="error_some_messages_have_not_been_sent">"Some messages have not been sent"</string>
<string name="error_unknown">"Sorry, an error occurred"</string>
<string name="invite_friends_text">"Hey, talk to me on %1$s: %2$s"</string>

View file

@ -43,6 +43,12 @@
"rich_text_editor_.*"
]
},
{
"name": ":libraries:androidutils",
"includeRegex": [
"error_no_compatible_app_found"
]
},
{
"name": ":libraries:push:impl",
"includeRegex": [