A lil cache fixing & search fixes

This commit is contained in:
Blatzar 2022-11-05 19:54:04 +01:00
parent 60a2f7c1c5
commit 60bcbf0060
4 changed files with 11 additions and 7 deletions

View file

@ -47,8 +47,8 @@ android {
minSdk = 21
targetSdk = 30
versionCode = 54
versionName = "3.2.2"
versionCode = 55
versionName = "3.2.3"
resValue("string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}")
@ -190,7 +190,7 @@ dependencies {
// Networking
// implementation("com.squareup.okhttp3:okhttp:4.9.2")
// implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.1")
implementation("com.github.Blatzar:NiceHttp:0.3.4")
implementation("com.github.Blatzar:NiceHttp:0.3.5")
// Util to skip the URI file fuckery 🙏
implementation("com.github.tachiyomiorg:unifile:17bec43")

View file

@ -61,6 +61,7 @@ object CommonActivity {
}
}
@MainThread
fun showToast(act: Activity?, @StringRes message: Int, duration: Int) {
if (act == null) return
showToast(act, act.getString(message), duration)
@ -69,6 +70,7 @@ object CommonActivity {
const val TAG = "COMPACT"
/** duration is Toast.LENGTH_SHORT if null*/
@MainThread
fun showToast(act: Activity?, message: String?, duration: Int? = null) {
if (act == null || message == null) {
Log.w(TAG, "invalid showToast act = $act message = $message")

View file

@ -131,9 +131,9 @@ class SearchFragment : Fragment() {
context?.let { ctx ->
val default = enumValues<TvType>().sorted().filter { it != TvType.NSFW }
.map { it.ordinal.toString() }.toSet()
val preferredTypes = PreferenceManager.getDefaultSharedPreferences(ctx)
.getStringSet(this.getString(R.string.prefer_media_type_key), default)
?.mapNotNull { it.toIntOrNull() ?: return@mapNotNull null } ?: default
val preferredTypes = (PreferenceManager.getDefaultSharedPreferences(ctx)
.getStringSet(this.getString(R.string.prefer_media_type_key), default)?.ifEmpty { default } ?: default)
.mapNotNull { it.toIntOrNull() ?: return@mapNotNull null }
val settings = ctx.getApiSettings()

View file

@ -200,7 +200,9 @@ class ExtensionsFragment : Fragment() {
val url = dialog.repo_url_input?.text?.toString()
?.let { it1 -> RepositoryManager.parseRepoUrl(it1) }
if (url.isNullOrBlank()) {
showToast(activity, R.string.error_invalid_data, Toast.LENGTH_SHORT)
main {
showToast(activity, R.string.error_invalid_data, Toast.LENGTH_SHORT)
}
} else {
val fixedName = if (!name.isNullOrBlank()) name
else RepositoryManager.parseRepository(url)?.name ?: "No name"