mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-03 23:58:55 +01:00 
			
		
		
		
	Fix no sources while migrating alongside UI and code cleanup (#2155)
This commit is contained in:
		@@ -13,7 +13,7 @@ import eu.kanade.presentation.util.Screen
 | 
			
		||||
import eu.kanade.tachiyomi.ui.manga.MangaScreen
 | 
			
		||||
import eu.kanade.tachiyomi.util.system.toast
 | 
			
		||||
import kotlinx.coroutines.flow.collectLatest
 | 
			
		||||
import mihon.feature.migration.MigrateMangaConfigScreen
 | 
			
		||||
import mihon.feature.migration.config.MigrationConfigScreen
 | 
			
		||||
import tachiyomi.i18n.MR
 | 
			
		||||
import tachiyomi.presentation.core.screens.LoadingScreen
 | 
			
		||||
 | 
			
		||||
@@ -38,7 +38,7 @@ data class MigrateMangaScreen(
 | 
			
		||||
            navigateUp = navigator::pop,
 | 
			
		||||
            title = state.source!!.name,
 | 
			
		||||
            state = state,
 | 
			
		||||
            onClickItem = { navigator.push(MigrateMangaConfigScreen(it.id)) },
 | 
			
		||||
            onClickItem = { navigator.push(MigrationConfigScreen(it.id)) },
 | 
			
		||||
            onClickCover = { navigator.push(MangaScreen(it.id)) },
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ import eu.kanade.tachiyomi.util.system.toShareIntent
 | 
			
		||||
import eu.kanade.tachiyomi.util.system.toast
 | 
			
		||||
import kotlinx.coroutines.launch
 | 
			
		||||
import logcat.LogPriority
 | 
			
		||||
import mihon.feature.migration.MigrateMangaConfigScreen
 | 
			
		||||
import mihon.feature.migration.config.MigrationConfigScreen
 | 
			
		||||
import tachiyomi.core.common.i18n.stringResource
 | 
			
		||||
import tachiyomi.core.common.util.lang.withIOContext
 | 
			
		||||
import tachiyomi.core.common.util.system.logcat
 | 
			
		||||
@@ -163,7 +163,7 @@ class MangaScreen(
 | 
			
		||||
                successState.manga.favorite
 | 
			
		||||
            },
 | 
			
		||||
            onMigrateClicked = {
 | 
			
		||||
                navigator.push(MigrateMangaConfigScreen(successState.manga.id))
 | 
			
		||||
                navigator.push(MigrationConfigScreen(successState.manga.id))
 | 
			
		||||
            }.takeIf { successState.manga.favorite },
 | 
			
		||||
            onEditNotesClicked = { navigator.push(MangaNotesScreen(manga = successState.manga)) },
 | 
			
		||||
            onMultiBookmarkClicked = screenModel::bookmarkChapters,
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,17 @@ object LocaleHelper {
 | 
			
		||||
        return Locale.forLanguageTag(normalizedLang).displayName
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun getShortDisplayName(lang: String?, uppercase: Boolean = false): String {
 | 
			
		||||
        return when (lang) {
 | 
			
		||||
            null -> ""
 | 
			
		||||
            "es-419" -> "es-la"
 | 
			
		||||
            "zh-CN" -> "zh-hans"
 | 
			
		||||
            "zh-TW" -> "zh-hant"
 | 
			
		||||
            else -> lang
 | 
			
		||||
        }
 | 
			
		||||
            .let { if (uppercase) it.uppercase(Locale.ENGLISH) else it }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns display name of a string language code.
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user