fix: Deprecated functions

This commit is contained in:
Ahmad Ansori Palembani 2024-05-26 07:38:46 +07:00
parent e51dce6ccd
commit 923a6e2306
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
3 changed files with 9 additions and 8 deletions

View file

@ -7,7 +7,7 @@ import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.util.view.DeferredField import eu.kanade.tachiyomi.util.view.DeferredField
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.channels.ConflatedBroadcastChannel import kotlinx.coroutines.flow.MutableStateFlow
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
class MigratingManga( class MigratingManga(
@ -19,7 +19,7 @@ class MigratingManga(
val searchResult = DeferredField<Long?>() val searchResult = DeferredField<Long?>()
// <MAX, PROGRESS> // <MAX, PROGRESS>
val progress = ConflatedBroadcastChannel(1 to 0) val progress = MutableStateFlow(1 to 0)
val migrationJob = parentContext + SupervisorJob() + Dispatchers.Default val migrationJob = parentContext + SupervisorJob() + Dispatchers.Default

View file

@ -37,6 +37,7 @@ import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
import eu.kanade.tachiyomi.util.lang.toNormalized import eu.kanade.tachiyomi.util.lang.toNormalized
import eu.kanade.tachiyomi.util.system.executeOnIO import eu.kanade.tachiyomi.util.system.executeOnIO
import eu.kanade.tachiyomi.util.system.getParcelableCompat
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.system.materialAlertDialog import eu.kanade.tachiyomi.util.system.materialAlertDialog
@ -77,7 +78,7 @@ class MigrationListController(bundle: Bundle? = null) :
override val coroutineContext: CoroutineContext = Job() + Dispatchers.Default override val coroutineContext: CoroutineContext = Job() + Dispatchers.Default
val config: MigrationProcedureConfig? = args.getParcelable(CONFIG_EXTRA) val config = args.getParcelableCompat(CONFIG_EXTRA, MigrationProcedureConfig::class.java)
private val db: DatabaseHelper by injectLazy() private val db: DatabaseHelper by injectLazy()
private val preferences: PreferencesHelper by injectLazy() private val preferences: PreferencesHelper by injectLazy()
@ -196,7 +197,7 @@ class MigrationListController(bundle: Bundle? = null) :
} catch (e: Exception) { } catch (e: Exception) {
return@source null return@source null
} }
manga.progress.send(validSources.size to processedSources.incrementAndGet()) manga.progress.value = validSources.size to processedSources.incrementAndGet()
localManga to chapters.size localManga to chapters.size
} else { } else {
null null
@ -243,7 +244,7 @@ class MigrationListController(bundle: Bundle? = null) :
null null
} }
manga.progress.send(validSources.size to (index + 1)) manga.progress.value = validSources.size to (index + 1)
if (searchResult != null) return@async searchResult if (searchResult != null) return@async searchResult
} }
@ -266,7 +267,7 @@ class MigrationListController(bundle: Bundle? = null) :
} catch (e: CancellationException) { } catch (e: CancellationException) {
// Ignore cancellations // Ignore cancellations
throw e throw e
} catch (e: Exception) { } catch (_: Exception) {
} }
} }
@ -383,7 +384,7 @@ class MigrationListController(bundle: Bundle? = null) :
} catch (e: CancellationException) { } catch (e: CancellationException) {
// Ignore cancellations // Ignore cancellations
throw e throw e
} catch (e: Exception) { } catch (_: Exception) {
} }
migratingManga.manga.migrationStatus = MigrationStatus.MANGA_FOUND migratingManga.manga.migrationStatus = MigrationStatus.MANGA_FOUND

View file

@ -1,7 +1,7 @@
package eu.kanade.tachiyomi.ui.migration.manga.process package eu.kanade.tachiyomi.ui.migration.manga.process
import android.os.Parcelable import android.os.Parcelable
import kotlinx.android.parcel.Parcelize import kotlinx.parcelize.Parcelize
@Parcelize @Parcelize
data class MigrationProcedureConfig( data class MigrationProcedureConfig(