Skip to content

Commit

Permalink
Merge pull request #1418 from aniyomiorg/fixes
Browse files Browse the repository at this point in the history
Bug Fixes
  • Loading branch information
jmir1 authored Feb 12, 2024
2 parents aec7893 + cbb6906 commit 4a20181
Show file tree
Hide file tree
Showing 26 changed files with 140 additions and 63 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ android {
defaultConfig {
applicationId = "xyz.jmir.tachiyomi.mi"

versionCode = 121
versionCode = 122
versionName = "0.15.2.4"

buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ object SettingsAdvancedScreen : SearchableSettings {
title = stringResource(MR.strings.pref_verbose_logging),
subtitle = stringResource(MR.strings.pref_verbose_logging_summary),
onValueChanged = {
context.stringResource(MR.strings.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
true
},
),
Expand Down Expand Up @@ -184,12 +184,10 @@ object SettingsAdvancedScreen : SearchableSettings {
}
context.startActivity(intent)
} catch (e: ActivityNotFoundException) {
context.toast(
MR.strings.battery_optimization_setting_activity_not_found,
)
context.toast(MR.strings.battery_optimization_setting_activity_not_found)
}
} else {
context.stringResource(MR.strings.battery_optimization_disabled)
context.toast(MR.strings.battery_optimization_disabled)
}
},
),
Expand All @@ -216,7 +214,7 @@ object SettingsAdvancedScreen : SearchableSettings {
onClick = {
Injekt.get<MangaDownloadCache>().invalidateCache()
Injekt.get<AnimeDownloadCache>().invalidateCache()
context.stringResource(MR.strings.download_cache_invalidated)
context.toast(MR.strings.download_cache_invalidated)
},
),
Preference.PreferenceItem.TextPreference(
Expand Down Expand Up @@ -250,7 +248,7 @@ object SettingsAdvancedScreen : SearchableSettings {
title = stringResource(MR.strings.pref_clear_cookies),
onClick = {
networkHelper.cookieJar.removeAll()
context.stringResource(MR.strings.cookies_cleared)
context.toast(MR.strings.cookies_cleared)
},
),
Preference.PreferenceItem.TextPreference(
Expand All @@ -266,10 +264,10 @@ object SettingsAdvancedScreen : SearchableSettings {
}
WebStorage.getInstance().deleteAllData()
context.applicationInfo?.dataDir?.let { File("$it/app_webview/").deleteRecursively() }
context.stringResource(MR.strings.webview_data_deleted)
context.toast(MR.strings.webview_data_deleted)
} catch (e: Throwable) {
logcat(LogPriority.ERROR, e)
context.stringResource(MR.strings.cache_delete_error)
context.toast(MR.strings.cache_delete_error)
}
},
),
Expand All @@ -293,7 +291,7 @@ object SettingsAdvancedScreen : SearchableSettings {
PREF_DOH_LIBREDNS to "LibreDNS",
),
onValueChanged = {
context.stringResource(MR.strings.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
true
},
),
Expand All @@ -305,7 +303,7 @@ object SettingsAdvancedScreen : SearchableSettings {
// OkHttp checks for valid values internally
Headers.Builder().add("User-Agent", it)
} catch (_: IllegalArgumentException) {
context.stringResource(MR.strings.error_user_agent_string_invalid)
context.toast(MR.strings.error_user_agent_string_invalid)
return@EditTextPreference false
}
true
Expand All @@ -316,7 +314,7 @@ object SettingsAdvancedScreen : SearchableSettings {
enabled = remember(userAgent) { userAgent != userAgentPref.defaultValue() },
onClick = {
userAgentPref.delete()
context.stringResource(MR.strings.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
},
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.screen.appearance.AppLanguageScreen
import eu.kanade.presentation.more.settings.widget.AppThemeModePreferenceWidget
import eu.kanade.presentation.more.settings.widget.AppThemePreferenceWidget
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableMap
import tachiyomi.core.i18n.stringResource
Expand Down Expand Up @@ -124,7 +125,7 @@ object SettingsAppearanceScreen : SearchableSettings {
.associateWith { stringResource(it.titleRes) }
.toImmutableMap(),
onValueChanged = {
context.stringResource(MR.strings.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
true
},
),
Expand All @@ -135,7 +136,7 @@ object SettingsAppearanceScreen : SearchableSettings {
.associateWith { stringResource(it.titleRes) }
.toImmutableMap(),
onValueChanged = {
context.stringResource(MR.strings.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
true
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ object SettingsDataScreen : SearchableSettings {
try {
pickStorageLocation.launch(null)
} catch (e: ActivityNotFoundException) {
context.stringResource(MR.strings.file_picker_error)
context.toast(MR.strings.file_picker_error)
}
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ object SettingsTrackingScreen : SearchableSettings {
): Boolean {
return try {
tracker.login(username, password)
withUIContext { context.stringResource(MR.strings.login_success) }
withUIContext { context.toast(MR.strings.login_success) }
true
} catch (e: Throwable) {
tracker.logout()
Expand Down Expand Up @@ -389,7 +389,7 @@ object SettingsTrackingScreen : SearchableSettings {
onClick = {
tracker.logout()
onDismissRequest()
context.stringResource(MR.strings.logout_success)
context.toast(MR.strings.logout_success)
},
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ object AboutScreen : Screen() {
onAvailableUpdate(result)
}
is GetApplicationRelease.Result.NoNewUpdate -> {
context.toast(context.stringResource(MR.strings.update_check_no_new_updates))
context.toast(MR.strings.update_check_no_new_updates)
}
is GetApplicationRelease.Result.OsTooOld -> {
context.toast(context.stringResource(MR.strings.update_check_eol))
context.toast(MR.strings.update_check_eol)
}
else -> {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import eu.kanade.presentation.browse.anime.components.AnimeSourceIcon
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.update
Expand Down Expand Up @@ -81,7 +82,7 @@ class ClearAnimeDatabaseScreen : Screen() {
model.removeAnimeBySourceId()
model.clearSelection()
model.hideConfirmation()
context.stringResource(MR.strings.clear_database_completed)
context.toast(MR.strings.clear_database_completed)
}
},
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import eu.kanade.presentation.browse.manga.components.MangaSourceIcon
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.update
Expand Down Expand Up @@ -77,7 +78,7 @@ class ClearDatabaseScreen : Screen() {
model.removeMangaBySourceId()
model.clearSelection()
model.hideConfirmation()
context.stringResource(MR.strings.clear_database_completed)
context.toast(MR.strings.clear_database_completed)
}
},
) {
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/eu/kanade/tachiyomi/Migrations.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package eu.kanade.tachiyomi

import android.content.Context
import android.os.Build
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import eu.kanade.domain.base.BasePreferences
Expand Down Expand Up @@ -511,9 +510,10 @@ object Migrations {
newKey = { Preference.appStateKey(it) },
)

if (Build.MODEL == "Subsystem for Android(TM)") {
if (HwDecState.isWSA) {
playerPreferences.hwDec().set(HwDecState.SW.mpvValue)
}

// Deleting old download cache index files, but might as well clear it all out
context.cacheDir.deleteRecursively()
}
Expand Down Expand Up @@ -560,6 +560,10 @@ object Migrations {
trackerManager.myAnimeList.logout()
}
}

if (oldVersion < 122) {
if (HwDecState.isWSA) playerPreferences.hwDec().set(HwDecState.SW.mpvValue)
}
return true
}
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class AnimeLibraryUpdateJob(private val context: Context, workerParams: WorkerPa
} catch (e: Throwable) {
val errorMessage = when (e) {
is NoEpisodesException -> context.stringResource(
MR.strings.no_chapters_error,
MR.strings.no_episodes_error,
)
// failedUpdates will already have the source, don't need to copy it into the message
is AnimeSourceNotInstalledException -> context.stringResource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import eu.kanade.tachiyomi.extension.anime.model.AnimeLoadResult
import eu.kanade.tachiyomi.extension.anime.util.AnimeExtensionInstallReceiver
import eu.kanade.tachiyomi.extension.anime.util.AnimeExtensionInstaller
import eu.kanade.tachiyomi.extension.anime.util.AnimeExtensionLoader
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.async
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.emptyFlow
import logcat.LogPriority
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchNow
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat
Expand Down Expand Up @@ -130,7 +130,7 @@ class AnimeExtensionManager(
api.findExtensions()
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
withUIContext { context.stringResource(MR.strings.extension_api_error) }
withUIContext { context.toast(MR.strings.extension_api_error) }
emptyList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import eu.kanade.tachiyomi.extension.manga.model.MangaLoadResult
import eu.kanade.tachiyomi.extension.manga.util.MangaExtensionInstallReceiver
import eu.kanade.tachiyomi.extension.manga.util.MangaExtensionInstaller
import eu.kanade.tachiyomi.extension.manga.util.MangaExtensionLoader
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.async
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.emptyFlow
import logcat.LogPriority
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.preference.plusAssign
import tachiyomi.core.util.lang.launchNow
import tachiyomi.core.util.lang.withUIContext
Expand Down Expand Up @@ -120,7 +120,7 @@ class MangaExtensionManager(
api.findExtensions()
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
withUIContext { context.stringResource(MR.strings.extension_api_error) }
withUIContext { context.toast(MR.strings.extension_api_error) }
emptyList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.browse.anime.AnimeExtensionFilterScreen
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.flow.collectLatest
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.LoadingScreen

Expand Down Expand Up @@ -41,7 +41,7 @@ class AnimeExtensionFilterScreen : Screen() {
screenModel.events.collectLatest {
when (it) {
AnimeExtensionFilterEvent.FailedFetchingLanguages -> {
context.stringResource(MR.strings.internal_error)
context.toast(MR.strings.internal_error)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import eu.kanade.presentation.browse.anime.MigrateAnimeScreen
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.ui.browse.anime.migration.search.MigrateAnimeSearchScreen
import eu.kanade.tachiyomi.ui.entries.anime.AnimeScreen
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.flow.collectLatest
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.LoadingScreen

Expand Down Expand Up @@ -46,7 +46,7 @@ data class MigrateAnimeScreen(
screenModel.events.collectLatest { event ->
when (event) {
MigrationAnimeEvent.FailedFetchingFavorites -> {
context.stringResource(MR.strings.internal_error)
context.toast(MR.strings.internal_error)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.browse.anime.AnimeSourcesFilterScreen
import eu.kanade.presentation.util.Screen
import tachiyomi.core.i18n.stringResource
import eu.kanade.tachiyomi.util.system.toast
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.LoadingScreen

Expand All @@ -30,7 +30,7 @@ class AnimeSourcesFilterScreen : Screen() {
if (state is AnimeSourcesFilterScreenModel.State.Error) {
val context = LocalContext.current
LaunchedEffect(Unit) {
context.stringResource(MR.strings.internal_error)
context.toast(MR.strings.internal_error)
navigator.pop()
}
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.browse.manga.MangaExtensionFilterScreen
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.flow.collectLatest
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.LoadingScreen

Expand Down Expand Up @@ -41,7 +41,7 @@ class MangaExtensionFilterScreen : Screen() {
screenModel.events.collectLatest {
when (it) {
MangaExtensionFilterEvent.FailedFetchingLanguages -> {
context.stringResource(MR.strings.internal_error)
context.toast(MR.strings.internal_error)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import eu.kanade.presentation.browse.manga.MigrateMangaScreen
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.ui.browse.manga.migration.search.MigrateMangaSearchScreen
import eu.kanade.tachiyomi.ui.entries.manga.MangaScreen
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.flow.collectLatest
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.LoadingScreen

Expand Down Expand Up @@ -46,7 +46,7 @@ data class MigrateMangaScreen(
screenModel.events.collectLatest { event ->
when (event) {
MigrationMangaEvent.FailedFetchingFavorites -> {
context.stringResource(MR.strings.internal_error)
context.toast(MR.strings.internal_error)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.browse.manga.MangaSourcesFilterScreen
import eu.kanade.presentation.util.Screen
import tachiyomi.core.i18n.stringResource
import eu.kanade.tachiyomi.util.system.toast
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.LoadingScreen

Expand All @@ -30,7 +30,7 @@ class MangaSourcesFilterScreen : Screen() {
if (state is MangaSourcesFilterScreenModel.State.Error) {
val context = LocalContext.current
LaunchedEffect(Unit) {
context.stringResource(MR.strings.internal_error)
context.toast(MR.strings.internal_error)
navigator.pop()
}
return
Expand Down
Loading

0 comments on commit 4a20181

Please sign in to comment.