mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-15 23:12:48 +01:00
refactor: use by remember and private the functions.
Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
parent
389336b823
commit
d17aa201d5
@ -392,14 +392,14 @@ private fun getGoogleDrivePreferences(): List<Preference> {
|
|||||||
@Composable
|
@Composable
|
||||||
private fun getGoogleDrivePurge(): Preference.PreferenceItem.TextPreference {
|
private fun getGoogleDrivePurge(): Preference.PreferenceItem.TextPreference {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val showPurgeDialog = remember { mutableStateOf(false) }
|
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val googleDriveSync = remember { GoogleDriveSyncService(context) }
|
val googleDriveSync = remember { GoogleDriveSyncService(context) }
|
||||||
|
var showPurgeDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
if (showPurgeDialog.value) {
|
if (showPurgeDialog) {
|
||||||
PurgeConfirmationDialog(
|
PurgeConfirmationDialog(
|
||||||
onConfirm = {
|
onConfirm = {
|
||||||
showPurgeDialog.value = false
|
showPurgeDialog = false
|
||||||
scope.launch {
|
scope.launch {
|
||||||
val result = googleDriveSync.deleteSyncDataFromGoogleDrive()
|
val result = googleDriveSync.deleteSyncDataFromGoogleDrive()
|
||||||
when (result) {
|
when (result) {
|
||||||
@ -415,18 +415,18 @@ private fun getGoogleDrivePurge(): Preference.PreferenceItem.TextPreference {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDismissRequest = { showPurgeDialog.value = false },
|
onDismissRequest = { showPurgeDialog = false },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Preference.PreferenceItem.TextPreference(
|
return Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_google_drive_purge_sync_data),
|
title = stringResource(MR.strings.pref_google_drive_purge_sync_data),
|
||||||
onClick = { showPurgeDialog.value = true },
|
onClick = { showPurgeDialog = true },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PurgeConfirmationDialog(
|
private fun PurgeConfirmationDialog(
|
||||||
onConfirm: () -> Unit,
|
onConfirm: () -> Unit,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
) {
|
) {
|
||||||
@ -543,7 +543,7 @@ private fun getAutomaticSyncGroup(syncPreferences: SyncPreferences): Preference.
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SyncConfirmationDialog(
|
private fun SyncConfirmationDialog(
|
||||||
onConfirm: () -> Unit,
|
onConfirm: () -> Unit,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user