From 1488c13c42a0a53acc55db9dceabb37fa9012d91 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Fri, 2 Feb 2024 15:34:31 +0100 Subject: [PATCH] feat: Allow the user to send an error report without a crash (#406) Getting error reports with logs of strange behaviour is useful even if the app doesn't crash. Move crash reporting in to `core.activity`, and provide a menu option (in orange builds) to trigger a non-fatal crash report that is handled the same way (i.e., sent by e-mail) as a regular crash report. `BaseActivity` has to be able to create and handle menus, so adjust subclasses to call the superclass when necessary. Update `tools/mvstring` to be able to move strings between different flavour directories, not just `main`. --- app/build.gradle.kts | 2 -- app/src/main/java/app/pachli/MainActivity.kt | 10 +++++--- .../main/java/app/pachli/PachliApplication.kt | 1 + .../components/account/AccountActivity.kt | 2 ++ .../announcements/AnnouncementsActivity.kt | 2 ++ .../scheduled/ScheduledStatusActivity.kt | 2 ++ .../components/search/SearchActivity.kt | 2 ++ .../components/trending/TrendingActivity.kt | 2 ++ app/src/main/res/values-ar/strings.xml | 1 - app/src/main/res/values-fi/strings.xml | 11 -------- app/src/main/res/values-nl/strings.xml | 11 -------- app/src/main/res/values-pt-rBR/strings.xml | 11 -------- app/src/main/res/values-sv/strings.xml | 11 -------- app/src/main/res/values/strings.xml | 11 -------- core/activity/build.gradle.kts | 3 +++ core/activity/lint-baseline.xml | 2 +- .../pachli/core/activity}/CrashReporter.kt | 3 ++- .../app/pachli/core/activity/BaseActivity.kt | 25 +++++++++++++++++-- .../src/main/res/menu/activity_base.xml | 25 +++++++++++++++++++ core/activity/src/main/res/values/strings.xml | 1 + .../pachli/core/activity}/CrashReporter.kt | 10 +++++++- .../src/orange/res/values-ar/strings.xml | 4 +++ .../src/orange/res/values-fi/strings.xml | 14 +++++++++++ .../src/orange/res/values-nl/strings.xml | 14 +++++++++++ .../src/orange/res/values-pt-rBR/strings.xml | 14 +++++++++++ .../src/orange/res/values-sv/strings.xml | 14 +++++++++++ .../src/orange/res/values/strings.xml | 14 +++++++++++ .../main/kotlin/app/pachli/mvstring/Main.kt | 11 +++++--- 28 files changed, 162 insertions(+), 71 deletions(-) rename {app/src/blue/kotlin/app/pachli => core/activity/src/blue/kotlin/app/pachli/core/activity}/CrashReporter.kt (93%) create mode 100644 core/activity/src/main/res/menu/activity_base.xml rename {app/src/orange/kotlin/app/pachli => core/activity/src/orange/kotlin/app/pachli/core/activity}/CrashReporter.kt (89%) create mode 100644 core/activity/src/orange/res/values-ar/strings.xml create mode 100644 core/activity/src/orange/res/values-fi/strings.xml create mode 100644 core/activity/src/orange/res/values-nl/strings.xml create mode 100644 core/activity/src/orange/res/values-pt-rBR/strings.xml create mode 100644 core/activity/src/orange/res/values-sv/strings.xml create mode 100644 core/activity/src/orange/res/values/strings.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 39c7c6b0f..c6e45e908 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -177,8 +177,6 @@ dependencies { debugImplementation(libs.leakcanary) - orangeImplementation(libs.bundles.acra) - testImplementation(projects.core.testing) testImplementation(libs.androidx.test.junit) testImplementation(libs.robolectric) diff --git a/app/src/main/java/app/pachli/MainActivity.kt b/app/src/main/java/app/pachli/MainActivity.kt index 2f1ceb400..1dc018bd0 100644 --- a/app/src/main/java/app/pachli/MainActivity.kt +++ b/app/src/main/java/app/pachli/MainActivity.kt @@ -382,6 +382,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { } override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { + super.onCreateMenu(menu, menuInflater) menuInflater.inflate(R.menu.activity_main, menu) menu.findItem(R.id.action_search)?.apply { icon = IconicsDrawable(this@MainActivity, GoogleMaterial.Icon.gmd_search).apply { @@ -392,20 +393,21 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { } override fun onPrepareMenu(menu: Menu) { - super.onPrepareMenu(menu) + super.onPrepareMenu(menu) // If the main toolbar is hidden then there's no space in the top/bottomNav to show // the menu items as icons, so forceably disable them if (!binding.mainToolbar.isVisible) menu.forEach { it.setShowAsAction(SHOW_AS_ACTION_NEVER) } } - override fun onMenuItemSelected(item: MenuItem): Boolean { - return when (item.itemId) { + override fun onMenuItemSelected(menuItem: MenuItem): Boolean { + super.onMenuItemSelected(menuItem) + return when (menuItem.itemId) { R.id.action_search -> { startActivity(SearchActivityIntent(this@MainActivity)) true } - else -> super.onOptionsItemSelected(item) + else -> super.onOptionsItemSelected(menuItem) } } diff --git a/app/src/main/java/app/pachli/PachliApplication.kt b/app/src/main/java/app/pachli/PachliApplication.kt index 67d389172..3de7802b9 100644 --- a/app/src/main/java/app/pachli/PachliApplication.kt +++ b/app/src/main/java/app/pachli/PachliApplication.kt @@ -25,6 +25,7 @@ import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.PeriodicWorkRequestBuilder import androidx.work.WorkManager import app.pachli.components.notifications.createWorkerNotificationChannel +import app.pachli.core.activity.initCrashReporter import app.pachli.core.preferences.AppTheme import app.pachli.core.preferences.NEW_INSTALL_SCHEMA_VERSION import app.pachli.core.preferences.PrefKeys diff --git a/app/src/main/java/app/pachli/components/account/AccountActivity.kt b/app/src/main/java/app/pachli/components/account/AccountActivity.kt index 0ed667c8d..6bca184ad 100644 --- a/app/src/main/java/app/pachli/components/account/AccountActivity.kt +++ b/app/src/main/java/app/pachli/components/account/AccountActivity.kt @@ -805,6 +805,7 @@ class AccountActivity : } override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { + super.onCreateMenu(menu, menuInflater) menuInflater.inflate(R.menu.account_toolbar, menu) val openAsItem = menu.findItem(R.id.action_open_as) @@ -964,6 +965,7 @@ class AccountActivity : } override fun onMenuItemSelected(item: MenuItem): Boolean { + super.onMenuItemSelected(item) when (item.itemId) { R.id.action_open_in_web -> { // If the account isn't loaded yet, eat the input. diff --git a/app/src/main/java/app/pachli/components/announcements/AnnouncementsActivity.kt b/app/src/main/java/app/pachli/components/announcements/AnnouncementsActivity.kt index 7ae79c5cd..f7b6dd174 100644 --- a/app/src/main/java/app/pachli/components/announcements/AnnouncementsActivity.kt +++ b/app/src/main/java/app/pachli/components/announcements/AnnouncementsActivity.kt @@ -139,6 +139,7 @@ class AnnouncementsActivity : } override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { + super.onCreateMenu(menu, menuInflater) menuInflater.inflate(R.menu.activity_announcements, menu) menu.findItem(R.id.action_search)?.apply { icon = IconicsDrawable(this@AnnouncementsActivity, GoogleMaterial.Icon.gmd_search).apply { @@ -149,6 +150,7 @@ class AnnouncementsActivity : } override fun onMenuItemSelected(menuItem: MenuItem): Boolean { + super.onMenuItemSelected(menuItem) return when (menuItem.itemId) { R.id.action_refresh -> { binding.swipeRefreshLayout.isRefreshing = true diff --git a/app/src/main/java/app/pachli/components/scheduled/ScheduledStatusActivity.kt b/app/src/main/java/app/pachli/components/scheduled/ScheduledStatusActivity.kt index d0d62b8a4..619df615f 100644 --- a/app/src/main/java/app/pachli/components/scheduled/ScheduledStatusActivity.kt +++ b/app/src/main/java/app/pachli/components/scheduled/ScheduledStatusActivity.kt @@ -125,6 +125,7 @@ class ScheduledStatusActivity : } override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { + super.onCreateMenu(menu, menuInflater) menuInflater.inflate(R.menu.activity_announcements, menu) menu.findItem(R.id.action_search)?.apply { icon = IconicsDrawable(this@ScheduledStatusActivity, GoogleMaterial.Icon.gmd_search).apply { @@ -135,6 +136,7 @@ class ScheduledStatusActivity : } override fun onMenuItemSelected(menuItem: MenuItem): Boolean { + super.onMenuItemSelected(menuItem) return when (menuItem.itemId) { R.id.action_refresh -> { binding.swipeRefreshLayout.isRefreshing = true diff --git a/app/src/main/java/app/pachli/components/search/SearchActivity.kt b/app/src/main/java/app/pachli/components/search/SearchActivity.kt index 575f6d112..483a6b383 100644 --- a/app/src/main/java/app/pachli/components/search/SearchActivity.kt +++ b/app/src/main/java/app/pachli/components/search/SearchActivity.kt @@ -75,6 +75,7 @@ class SearchActivity : BottomSheetActivity(), MenuProvider, SearchView.OnQueryTe } override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { + super.onCreateMenu(menu, menuInflater) menuInflater.inflate(R.menu.search_toolbar, menu) val searchViewMenuItem = menu.findItem(R.id.action_search) searchViewMenuItem.expandActionView() @@ -83,6 +84,7 @@ class SearchActivity : BottomSheetActivity(), MenuProvider, SearchView.OnQueryTe } override fun onMenuItemSelected(menuItem: MenuItem): Boolean { + super.onMenuItemSelected(menuItem) return false } diff --git a/app/src/main/java/app/pachli/components/trending/TrendingActivity.kt b/app/src/main/java/app/pachli/components/trending/TrendingActivity.kt index ab5747928..905d65961 100644 --- a/app/src/main/java/app/pachli/components/trending/TrendingActivity.kt +++ b/app/src/main/java/app/pachli/components/trending/TrendingActivity.kt @@ -78,10 +78,12 @@ class TrendingActivity : BottomSheetActivity(), AppBarLayoutHost, MenuProvider { } override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { + super.onCreateMenu(menu, menuInflater) menuInflater.inflate(R.menu.activity_trending, menu) } override fun onMenuItemSelected(menuItem: MenuItem): Boolean { + super.onMenuItemSelected(menuItem) return super.onOptionsItemSelected(menuItem) } } diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 870be25a9..3ff70d054 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -677,7 +677,6 @@ إلغاء الترجمة صيانة ذاكرة التخزين المؤقتة… حجم نص واجهة المستخدم - لقد تحطّم %1$s تحميل أحدث الإشعارات السياقات التي تم تصفيتها #وسم diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 548675cba..ef419edc0 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -512,7 +512,6 @@ Sääntörikkomus Avainsanat tai jonot jotka suodatetaan Julkaisu, johon olit kirjoittanut vastausluonnoksen, on poistettu - Pyydämme anteeksi. Paina OK jos haluat lähettää kehittäjille yksityiskohtaiset tiedot Rajoita aikajanan ilmoituksia Liittyi %1$s tuntematon syy @@ -558,7 +557,6 @@ Lisää Lataa uusimmat ilmoitukset Näytä linkkien esikatselut aikajanoissa - %1$s kaatui Vaihda välilehteä pyyhkäisemällä Lähetä edelleen %s päättyy %s @@ -635,15 +633,6 @@ \nJos haluat tutkia muita tilejä, voit löytää niitä toisesta aikajanasta, esimerkiksi oman instanssisi paikallisesta aikajanasta [iconics gmd_group]. Voit myös etsiä niitä nimeltä [iconics gmd_search]; etsi esimerkiksi sanalla ”Pachli” löytääksesi Mastodon-tilimme. Poista ilmoitukset Listan nimi - Nämä tiedot lähetetään kehittäjille. -\n -\nTarkista, että tiedot eivät sisällä mitään, mitä et halua jakaa, ja kerro, mitä teit, kun ohjelma kaatui. -\n -\n------ -\nKirjoita kuvaus tähän: -\n -\n------ -\n Avaa/Sulje kaikki julkasut Valitse lista Loputon diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 9f2d44d69..300d23953 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -645,7 +645,6 @@ Voeg sleutelwoord toe Sleutelwoorden of zinnen om te filteren Iemand die hun eigen post boost - Sorry daarvoor. Klik op OK om een e-mail op te stellen naar de ontwikkelaars met alle details Laden van filters faalde: %s #%s verborgen Mogelijk is het noodzakelijk om je apparaat opnieuw op te starten @@ -656,15 +655,6 @@ Dit is je Thuis tijdlijn. Het toont de meest recente posts van accounts die je volgt. \n \nOm meer accounts te vinden, kun je ze ontdekken in een van de andere tijdlijnen. Bijvoorbeeld de lokale tijdlijn van jouw instance [iconics gmd_group]. Of je kunt zoeken op naam [iconics gmd_search]; bijvoorbeeld als je zoekt op Pachli dan vind je ons Mastodon account. - Deze data wordt verzonden naar de ontwikkelaars. -\n -\nControleer alsjeblieft of er niks tussen zit dat je niet met ons wilt delen, omschrijf wat je deed wanneer de crash gebeurde. -\n -\n ---- -\nJe omschrijving hier: -\n -\n ---- -\n Eenmaal per versie Je server beschikt niet over ondersteuning voor deze feature Lettertype-familie @@ -683,5 +673,4 @@ Vertaling ongedaan maken Cache onderhoud… UI tekst grootte - %1$s crashed diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 132d0dfc9..b559568f7 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -684,15 +684,4 @@ Carregar notificações mais recentes Descartar mudanças Tamanho do texto da UI - Desculpas por isso. Clique em OK para preparar uma mensagem aos desenvolvedores com detalhes - Esses dados serão enviados aos desenvolvedores. -\n -\nPor favor, verifique se ele não inclui algo que não queriras compartilhar e, por favor, descreva o que estavas fazendo quando a falha aconteceu. -\n -\n---- -\nA tua descrição aqui: -\n -\n---- -\n - %1$s travou diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 6300e70ca..44d3ea0de 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -671,17 +671,6 @@ Hashtaggar Bild Ångra översättning - Förlåt för det. Klicka på OK för att förbereda ett e-postmeddelande till utvecklarna med detaljer - Denna data kommer att skickas till utvecklarna. -\n -\nKontrollera att den inte innehåller något du inte vill dela, och beskriv vad du gjorde när kraschen inträffade. -\n -\n ---- -\nDin beskrivning här: -\n -\n---- -\n - %1$s kraschade Kunde inte hämta serverinformation för %1$s: %2$s misslyckades med att hämta /.well-known/nodeinfo: %1$s /.well-known/nodeinfo innehöll inte begripliga scheman diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1e9e58475..04e1ecaee 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -708,17 +708,6 @@ You may need to restart your device This version of Pachli may trigger an Android bug on some devices, and show broken animations.\n\nFor example, when tapping a post to view a thread.\n\nIf you see this you will need to restart your device.\n\nYou only need to do this once.\n\nThis is Android bug, there is nothing Pachli can do. - %1$s crashed - Sorry about that. Click OK to prepare an e-mail to the developers with details - This data will be sent to the developers.\n\n - -Please check to make sure it does not include anything you don\'t want to share, and please describe what you were doing when the crash happened.\n\n - -----\n -Your description here:\n\n - -----\n - Could not fetch server info for %1$s: %2$s fetching /.well-known/nodeinfo failed: %1$s diff --git a/core/activity/build.gradle.kts b/core/activity/build.gradle.kts index d11b2a015..c1f6635a2 100644 --- a/core/activity/build.gradle.kts +++ b/core/activity/build.gradle.kts @@ -47,6 +47,9 @@ dependencies { // Loading avatars implementation(libs.bundles.glide) + // Crash reporting in orange (Pachli Current) builds only + orangeImplementation(libs.bundles.acra) + // BottomSheetActivityTest uses mockito testImplementation(libs.bundles.mockito) } diff --git a/core/activity/lint-baseline.xml b/core/activity/lint-baseline.xml index 180fb59d1..730c55caa 100644 --- a/core/activity/lint-baseline.xml +++ b/core/activity/lint-baseline.xml @@ -19,7 +19,7 @@ errorLine2=" ~~~~~~~~~"> diff --git a/app/src/blue/kotlin/app/pachli/CrashReporter.kt b/core/activity/src/blue/kotlin/app/pachli/core/activity/CrashReporter.kt similarity index 93% rename from app/src/blue/kotlin/app/pachli/CrashReporter.kt rename to core/activity/src/blue/kotlin/app/pachli/core/activity/CrashReporter.kt index b7273aeb0..9aa890234 100644 --- a/app/src/blue/kotlin/app/pachli/CrashReporter.kt +++ b/core/activity/src/blue/kotlin/app/pachli/core/activity/CrashReporter.kt @@ -15,9 +15,10 @@ * see . */ -package app.pachli +package app.pachli.core.activity import android.app.Application /** Do nothing in blue builds */ fun initCrashReporter(app: Application) {} +fun triggerCrashReport() {} diff --git a/core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt b/core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt index 985d34a9a..320212c41 100644 --- a/core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt +++ b/core/activity/src/main/kotlin/app/pachli/core/activity/BaseActivity.kt @@ -24,16 +24,19 @@ import android.content.pm.PackageManager import android.graphics.BitmapFactory import android.graphics.Color import android.os.Bundle +import android.view.Menu +import android.view.MenuInflater import android.view.MenuItem import android.view.View +import androidx.annotation.CallSuper import androidx.annotation.StringRes import androidx.annotation.StyleRes import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat +import androidx.core.view.MenuProvider import app.pachli.core.accounts.AccountManager -import app.pachli.core.accounts.BuildConfig import app.pachli.core.database.model.AccountEntity import app.pachli.core.designsystem.EmbeddedFontFamily import app.pachli.core.designsystem.R as DR @@ -53,7 +56,7 @@ import javax.inject.Inject import timber.log.Timber @AndroidEntryPoint -abstract class BaseActivity : AppCompatActivity() { +abstract class BaseActivity : AppCompatActivity(), MenuProvider { @Inject lateinit var accountManager: AccountManager @@ -294,6 +297,24 @@ abstract class BaseActivity : AppCompatActivity() { ActivityCompat.requestPermissions(this, permissionsCopy, newKey) } + @CallSuper + override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { + if (BuildConfig.FLAVOR_color != "orange") return + menuInflater.inflate(R.menu.activity_base, menu) + } + + @CallSuper + override fun onMenuItemSelected(menuItem: MenuItem): Boolean { + if (BuildConfig.FLAVOR_color != "orange") return false + return when (menuItem.itemId) { + R.id.action_crash_report -> { + triggerCrashReport() + true + } + else -> false + } + } + companion object { private const val REQUESTER_NONE = Int.MAX_VALUE diff --git a/core/activity/src/main/res/menu/activity_base.xml b/core/activity/src/main/res/menu/activity_base.xml new file mode 100644 index 000000000..8c3f405a7 --- /dev/null +++ b/core/activity/src/main/res/menu/activity_base.xml @@ -0,0 +1,25 @@ + + + + + + diff --git a/core/activity/src/main/res/values/strings.xml b/core/activity/src/main/res/values/strings.xml index f642bea24..870c94c3c 100644 --- a/core/activity/src/main/res/values/strings.xml +++ b/core/activity/src/main/res/values/strings.xml @@ -3,4 +3,5 @@ Error looking up post %s Open as %s Performing lookup… + Send error report diff --git a/app/src/orange/kotlin/app/pachli/CrashReporter.kt b/core/activity/src/orange/kotlin/app/pachli/core/activity/CrashReporter.kt similarity index 89% rename from app/src/orange/kotlin/app/pachli/CrashReporter.kt rename to core/activity/src/orange/kotlin/app/pachli/core/activity/CrashReporter.kt index f9a7d9c2b..5a3016218 100644 --- a/app/src/orange/kotlin/app/pachli/CrashReporter.kt +++ b/core/activity/src/orange/kotlin/app/pachli/core/activity/CrashReporter.kt @@ -15,10 +15,11 @@ * see . */ -package app.pachli +package app.pachli.core.activity import android.app.Application import app.pachli.core.designsystem.R as DR +import org.acra.ACRA import org.acra.config.dialog import org.acra.config.mailSender import org.acra.data.StringFormat @@ -46,3 +47,10 @@ fun initCrashReporter(app: Application) { } } } + +/** + * Trigger a report without a crash. + */ +fun triggerCrashReport() { + ACRA.errorReporter.handleException(null, false) +} diff --git a/core/activity/src/orange/res/values-ar/strings.xml b/core/activity/src/orange/res/values-ar/strings.xml new file mode 100644 index 000000000..f349fdae8 --- /dev/null +++ b/core/activity/src/orange/res/values-ar/strings.xml @@ -0,0 +1,4 @@ + + + لقد تحطّم %1$s + diff --git a/core/activity/src/orange/res/values-fi/strings.xml b/core/activity/src/orange/res/values-fi/strings.xml new file mode 100644 index 000000000..4ba503371 --- /dev/null +++ b/core/activity/src/orange/res/values-fi/strings.xml @@ -0,0 +1,14 @@ + + + %1$s kaatui + Pyydämme anteeksi. Paina OK jos haluat lähettää kehittäjille yksityiskohtaiset tiedot + Nämä tiedot lähetetään kehittäjille. +\n +\nTarkista, että tiedot eivät sisällä mitään, mitä et halua jakaa, ja kerro, mitä teit, kun ohjelma kaatui. +\n +\n------ +\nKirjoita kuvaus tähän: +\n +\n------ +\n + diff --git a/core/activity/src/orange/res/values-nl/strings.xml b/core/activity/src/orange/res/values-nl/strings.xml new file mode 100644 index 000000000..de4641ed1 --- /dev/null +++ b/core/activity/src/orange/res/values-nl/strings.xml @@ -0,0 +1,14 @@ + + + %1$s crashed + Sorry daarvoor. Klik op OK om een e-mail op te stellen naar de ontwikkelaars met alle details + Deze data wordt verzonden naar de ontwikkelaars. +\n +\nControleer alsjeblieft of er niks tussen zit dat je niet met ons wilt delen, omschrijf wat je deed wanneer de crash gebeurde. +\n +\n ---- +\nJe omschrijving hier: +\n +\n ---- +\n + diff --git a/core/activity/src/orange/res/values-pt-rBR/strings.xml b/core/activity/src/orange/res/values-pt-rBR/strings.xml new file mode 100644 index 000000000..207bcadbe --- /dev/null +++ b/core/activity/src/orange/res/values-pt-rBR/strings.xml @@ -0,0 +1,14 @@ + + + %1$s travou + Desculpas por isso. Clique em OK para preparar uma mensagem aos desenvolvedores com detalhes + Esses dados serão enviados aos desenvolvedores. +\n +\nPor favor, verifique se ele não inclui algo que não queriras compartilhar e, por favor, descreva o que estavas fazendo quando a falha aconteceu. +\n +\n---- +\nA tua descrição aqui: +\n +\n---- +\n + diff --git a/core/activity/src/orange/res/values-sv/strings.xml b/core/activity/src/orange/res/values-sv/strings.xml new file mode 100644 index 000000000..0b252e075 --- /dev/null +++ b/core/activity/src/orange/res/values-sv/strings.xml @@ -0,0 +1,14 @@ + + + %1$s kraschade + Förlåt för det. Klicka på OK för att förbereda ett e-postmeddelande till utvecklarna med detaljer + Denna data kommer att skickas till utvecklarna. +\n +\nKontrollera att den inte innehåller något du inte vill dela, och beskriv vad du gjorde när kraschen inträffade. +\n +\n ---- +\nDin beskrivning här: +\n +\n---- +\n + diff --git a/core/activity/src/orange/res/values/strings.xml b/core/activity/src/orange/res/values/strings.xml new file mode 100644 index 000000000..edb228ada --- /dev/null +++ b/core/activity/src/orange/res/values/strings.xml @@ -0,0 +1,14 @@ + + + %1$s error report + Click OK to prepare an e-mail to the developers with details + This data will be sent to the developers.\n\n + +Please check to make sure it does not include anything you don\'t want to share, and please describe what you were doing when the crash happened.\n\n + +----\n +Your description here:\n\n + +----\n + + diff --git a/tools/mvstring/src/main/kotlin/app/pachli/mvstring/Main.kt b/tools/mvstring/src/main/kotlin/app/pachli/mvstring/Main.kt index c6ddcc32d..82a773de4 100644 --- a/tools/mvstring/src/main/kotlin/app/pachli/mvstring/Main.kt +++ b/tools/mvstring/src/main/kotlin/app/pachli/mvstring/Main.kt @@ -23,6 +23,7 @@ import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.UsageError import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.arguments.multiple +import com.github.ajalt.clikt.parameters.options.default import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option import io.github.oshai.kotlinlogging.DelegatingKLogger @@ -52,7 +53,9 @@ private val log = KotlinLogging.logger {} class App : CliktCommand(help = """Move string resources between modules""") { private val args by argument().multiple() - private val verbose by option("-n", "--verbose", help = "show additional information").flag() + private val verbose by option("-v", "--verbose", help = "show additional information").flag() + private val srcVariant by option("--srcVariant").default("main") + private val dstVariant by option("--dstVariant").default("main") /** * Returns the full path to a module's `.../src/main/res` directory, starting from the @@ -60,7 +63,7 @@ class App : CliktCommand(help = """Move string resources between modules""") { * * @return the path, or null if it's not a subtree of [start] or any of its parents. */ - private fun findResourcePath(start: Path, variant: String = "main"): Path? { + private fun findResourcePath(start: Path, variant: String): Path? { val suffix = Path("src/$variant/res") var prefix = start @@ -89,8 +92,8 @@ class App : CliktCommand(help = """Move string resources between modules""") { val cwd = Paths.get("").toAbsolutePath() log.info { "working directory: $cwd" } - val srcRes = findResourcePath(Path(src)) ?: throw UsageError("no resources in $src") - val dstRes = findResourcePath(Path(dst)) ?: throw UsageError("no resources in $dst") + val srcRes = findResourcePath(Path(src), srcVariant) ?: throw UsageError("no resources in $src") + val dstRes = findResourcePath(Path(dst), dstVariant) ?: throw UsageError("no resources in $dst") // Enumerate all the values-* directories that contain a strings.xml file val resourceDirs =