diff --git a/.gitignore b/.gitignore index 621f3e800..174302fc9 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ /.idea/kotlinc.xml /.idea/deploymentTargetDropDown.xml /.idea/androidTestResultsUserPreferences.xml +/.idea/deploymentTargetSelector.xml /.idea/render.experimental.xml /.idea/inspectionProfiles/ .DS_Store diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/BaseApp.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/BaseApp.kt index 4e994274a..4f2502449 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/BaseApp.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/BaseApp.kt @@ -11,6 +11,7 @@ import androidx.work.WorkManager import dagger.hilt.android.HiltAndroidApp import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import org.acra.ACRA import org.acra.ReportField import org.acra.config.dialog @@ -63,10 +64,15 @@ open class BaseApp : Application(), Configuration.Provider { override fun onCreate() { super.onCreate() - ACRA.errorReporter.putCustomData("isOriginalApp", appValidator.isOriginalApp.toString()) AppCompatDelegate.setDefaultNightMode(settings.theme) AppCompatDelegate.setApplicationLocales(settings.appLocales) setupActivityLifecycleCallbacks() + processLifecycleScope.launch { + val isOriginalApp = withContext(Dispatchers.Default) { + appValidator.isOriginalApp + } + ACRA.errorReporter.putCustomData("isOriginalApp", isOriginalApp.toString()) + } processLifecycleScope.launch(Dispatchers.Default) { setupDatabaseObservers() } @@ -79,13 +85,6 @@ open class BaseApp : Application(), Configuration.Provider { initAcra { buildConfigClass = BuildConfig::class.java reportFormat = StringFormat.JSON - excludeMatchingSharedPreferencesKeys = listOf( - "sources_\\w+", - AppSettings.KEY_APP_PASSWORD, - AppSettings.KEY_PROXY_LOGIN, - AppSettings.KEY_PROXY_ADDRESS, - AppSettings.KEY_PROXY_PASSWORD, - ) httpSender { uri = getString(R.string.url_error_report) basicAuthLogin = getString(R.string.acra_login) @@ -102,7 +101,6 @@ open class BaseApp : Application(), Configuration.Provider { ReportField.STACK_TRACE, ReportField.CRASH_CONFIGURATION, ReportField.CUSTOM_DATA, - ReportField.SHARED_PREFERENCES, ) dialog { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/prefs/AppSettings.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/prefs/AppSettings.kt index b3e6f26d2..cb927bd67 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/prefs/AppSettings.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/prefs/AppSettings.kt @@ -449,17 +449,6 @@ class AppSettings @Inject constructor(@ApplicationContext context: Context) { return result } - @SuppressLint("ApplySharedPref") - private inline fun SharedPreferences.editAsync( - action: SharedPreferences.Editor.() -> Unit - ) { - val editor = edit() - action(editor) - processLifecycleScope.launch(Dispatchers.IO, CoroutineStart.ATOMIC) { - editor.commit() - } - } - companion object { const val PAGE_SWITCH_TAPS = "taps" diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/AboutLinksPreference.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/AboutLinksPreference.kt index 2102b3788..ed9aabd94 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/AboutLinksPreference.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/AboutLinksPreference.kt @@ -7,8 +7,10 @@ import android.util.AttributeSet import android.view.View import androidx.appcompat.widget.TooltipCompat import androidx.core.net.toUri +import androidx.core.view.forEach import androidx.preference.Preference import androidx.preference.PreferenceViewHolder +import com.google.android.material.snackbar.Snackbar import org.koitharu.kotatsu.R import org.koitharu.kotatsu.databinding.PreferenceAboutLinksBinding @@ -27,12 +29,7 @@ class AboutLinksPreference @JvmOverloads constructor( super.onBindViewHolder(holder) val binding = PreferenceAboutLinksBinding.bind(holder.itemView) - arrayOf( - binding.btn4pda, - binding.btnDiscord, - binding.btnGithub, - binding.btnTelegram, - ).forEach { button -> + binding.root.forEach { button -> TooltipCompat.setTooltipText(button, button.contentDescription) button.setOnClickListener(this) } @@ -40,16 +37,15 @@ class AboutLinksPreference @JvmOverloads constructor( override fun onClick(v: View) { val urlResId = when (v.id) { - R.id.btn_4pda -> R.string.url_forpda R.id.btn_discord -> R.string.url_discord R.id.btn_telegram -> R.string.url_telegram R.id.btn_github -> R.string.url_github else -> return } - openLink(v.context.getString(urlResId), v.contentDescription) + openLink(v, v.context.getString(urlResId), v.contentDescription) } - private fun openLink(url: String, title: CharSequence?) { + private fun openLink(v: View, url: String, title: CharSequence?) { val intent = Intent(Intent.ACTION_VIEW, url.toUri()) try { context.startActivity( @@ -60,6 +56,7 @@ class AboutLinksPreference @JvmOverloads constructor( }, ) } catch (_: ActivityNotFoundException) { + Snackbar.make(v, R.string.operation_not_supported, Snackbar.LENGTH_SHORT).show() } } } diff --git a/app/src/main/res/drawable/ic_4pda.xml b/app/src/main/res/drawable/ic_4pda.xml deleted file mode 100644 index f0920f0d8..000000000 --- a/app/src/main/res/drawable/ic_4pda.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/layout/preference_about_links.xml b/app/src/main/res/layout/preference_about_links.xml index 975925184..b5c0ad8ee 100644 --- a/app/src/main/res/layout/preference_about_links.xml +++ b/app/src/main/res/layout/preference_about_links.xml @@ -40,15 +40,4 @@ app:tint="?attr/colorAccent" tools:ignore="HardcodedText" /> - - diff --git a/app/src/main/res/values/constants.xml b/app/src/main/res/values/constants.xml index 3802b534a..6caed36d1 100644 --- a/app/src/main/res/values/constants.xml +++ b/app/src/main/res/values/constants.xml @@ -2,7 +2,6 @@ https://github.com/KotatsuApp/Kotatsu https://discord.gg/NNJ5RgVBC5 - https://4pda.to/forum/index.php?showtopic=697669 https://t.me/kotatsuapp https://hosted.weblate.org/engage/kotatsu https://acra.kotatsu.app/report @@ -13,8 +12,8 @@ 9887 wrMqFosItQWsmB8dtAHfIFPDt15FfQi2ZGiKkJoW 6cd8e6349e9a36bc1fc1ab97703c9fd1 - LxUiQIbVgKv1pdtM - gtG6y1MpEPHrdV1z + zPALLBPdpn5mnCB4 + kgpuhoNJpSsQDCwu org.koitharu.kotatsu.history org.koitharu.kotatsu.favourites