Use Compose version of SyncFavoritesWarningDialog
This commit is contained in:
parent
9a55b70d91
commit
8b57decea6
@ -50,6 +50,7 @@ import eu.kanade.domain.UnsortedPreferences
|
|||||||
import eu.kanade.domain.manga.interactor.DeleteFavoriteEntries
|
import eu.kanade.domain.manga.interactor.DeleteFavoriteEntries
|
||||||
import eu.kanade.domain.manga.interactor.GetExhFavoriteMangaWithMetadata
|
import eu.kanade.domain.manga.interactor.GetExhFavoriteMangaWithMetadata
|
||||||
import eu.kanade.domain.manga.interactor.GetFlatMetadataById
|
import eu.kanade.domain.manga.interactor.GetFlatMetadataById
|
||||||
|
import eu.kanade.presentation.library.components.SyncFavoritesWarningDialog
|
||||||
import eu.kanade.presentation.more.settings.Preference
|
import eu.kanade.presentation.more.settings.Preference
|
||||||
import eu.kanade.presentation.util.collectAsState
|
import eu.kanade.presentation.util.collectAsState
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
@ -64,7 +65,6 @@ import eu.kanade.tachiyomi.util.system.toast
|
|||||||
import exh.eh.EHentaiUpdateWorker
|
import exh.eh.EHentaiUpdateWorker
|
||||||
import exh.eh.EHentaiUpdateWorkerConstants
|
import exh.eh.EHentaiUpdateWorkerConstants
|
||||||
import exh.eh.EHentaiUpdaterStats
|
import exh.eh.EHentaiUpdaterStats
|
||||||
import exh.favorites.FavoritesIntroDialog
|
|
||||||
import exh.metadata.metadata.EHentaiSearchMetadata
|
import exh.metadata.metadata.EHentaiSearchMetadata
|
||||||
import exh.ui.login.EhLoginActivity
|
import exh.ui.login.EhLoginActivity
|
||||||
import exh.util.nullIfBlank
|
import exh.util.nullIfBlank
|
||||||
@ -847,13 +847,17 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun syncFavoriteNotes(): Preference.PreferenceItem.TextPreference {
|
fun syncFavoriteNotes(): Preference.PreferenceItem.TextPreference {
|
||||||
val context = LocalContext.current
|
var dialogOpen by remember { mutableStateOf(false) }
|
||||||
|
if (dialogOpen) {
|
||||||
|
SyncFavoritesWarningDialog(
|
||||||
|
onDismissRequest = { dialogOpen = false },
|
||||||
|
onAccept = { dialogOpen = false },
|
||||||
|
)
|
||||||
|
}
|
||||||
return Preference.PreferenceItem.TextPreference(
|
return Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(R.string.show_favorite_sync_notes),
|
title = stringResource(R.string.show_favorite_sync_notes),
|
||||||
subtitle = stringResource(R.string.show_favorite_sync_notes_summary),
|
subtitle = stringResource(R.string.show_favorite_sync_notes_summary),
|
||||||
onClick = {
|
onClick = { dialogOpen = true },
|
||||||
FavoritesIntroDialog().show(context)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package exh.favorites
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.core.text.HtmlCompat
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|
||||||
import eu.kanade.domain.UnsortedPreferences
|
|
||||||
import eu.kanade.tachiyomi.R
|
|
||||||
import uy.kohesive.injekt.injectLazy
|
|
||||||
|
|
||||||
class FavoritesIntroDialog {
|
|
||||||
private val prefs: UnsortedPreferences by injectLazy()
|
|
||||||
|
|
||||||
fun show(context: Context) = MaterialAlertDialogBuilder(context)
|
|
||||||
.setTitle(R.string.favorites_sync_notes)
|
|
||||||
.setMessage(HtmlCompat.fromHtml(context.getString(R.string.favorites_sync_notes_message), HtmlCompat.FROM_HTML_MODE_LEGACY))
|
|
||||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
|
||||||
prefs.exhShowSyncIntro().set(false)
|
|
||||||
}
|
|
||||||
.setCancelable(false)
|
|
||||||
.show()
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user