mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 18:08:24 +01:00
More onboarding screen additions 2: Electric Boogaloo
This commit is contained in:
parent
e3404cd3d3
commit
f7c5b42435
@ -22,7 +22,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "eu.kanade.tachiyomi"
|
applicationId = "eu.kanade.tachiyomi"
|
||||||
|
|
||||||
versionCode = 111
|
versionCode = 112
|
||||||
versionName = "0.14.7"
|
versionName = "0.14.7"
|
||||||
|
|
||||||
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
||||||
|
@ -6,11 +6,14 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
|
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
@ -32,7 +35,9 @@ internal fun GuidesStep(
|
|||||||
Text(stringResource(MR.strings.getting_started_guide))
|
Text(stringResource(MR.strings.getting_started_guide))
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalDivider()
|
HorizontalDivider(
|
||||||
|
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
|
)
|
||||||
|
|
||||||
Text(stringResource(MR.strings.onboarding_guides_returning_user, stringResource(MR.strings.app_name)))
|
Text(stringResource(MR.strings.onboarding_guides_returning_user, stringResource(MR.strings.app_name)))
|
||||||
Button(
|
Button(
|
||||||
@ -45,3 +50,13 @@ internal fun GuidesStep(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const val GETTING_STARTED_URL = "https://tachiyomi.org/docs/guides/getting-started"
|
const val GETTING_STARTED_URL = "https://tachiyomi.org/docs/guides/getting-started"
|
||||||
|
|
||||||
|
@PreviewLightDark
|
||||||
|
@Composable
|
||||||
|
private fun GuidesStepPreview() {
|
||||||
|
TachiyomiTheme {
|
||||||
|
GuidesStep(
|
||||||
|
onRestoreBackup = {},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -16,7 +16,9 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import eu.kanade.domain.ui.UiPreferences
|
import eu.kanade.domain.ui.UiPreferences
|
||||||
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import soup.compose.material.motion.animation.materialSharedAxisX
|
import soup.compose.material.motion.animation.materialSharedAxisX
|
||||||
import soup.compose.material.motion.animation.rememberSlideDistance
|
import soup.compose.material.motion.animation.rememberSlideDistance
|
||||||
import tachiyomi.domain.storage.service.StoragePreferences
|
import tachiyomi.domain.storage.service.StoragePreferences
|
||||||
@ -32,16 +34,20 @@ fun OnboardingScreen(
|
|||||||
onComplete: () -> Unit,
|
onComplete: () -> Unit,
|
||||||
onRestoreBackup: () -> Unit,
|
onRestoreBackup: () -> Unit,
|
||||||
) {
|
) {
|
||||||
var currentStep by remember { mutableIntStateOf(0) }
|
val context = LocalContext.current
|
||||||
val steps: List<@Composable () -> Unit> = listOf(
|
|
||||||
{ ThemeStep(uiPreferences = uiPreferences) },
|
|
||||||
{ StorageStep(storagePref = storagePreferences.baseStorageDirectory()) },
|
|
||||||
// TODO: prompt for notification permissions when bumping target to Android 13
|
|
||||||
{ GuidesStep(onRestoreBackup = onRestoreBackup) },
|
|
||||||
)
|
|
||||||
val isLastStep = currentStep == steps.size - 1
|
|
||||||
val slideDistance = rememberSlideDistance()
|
val slideDistance = rememberSlideDistance()
|
||||||
|
|
||||||
|
var currentStep by remember { mutableIntStateOf(0) }
|
||||||
|
val steps: List<@Composable () -> Unit> = remember {
|
||||||
|
listOf(
|
||||||
|
{ ThemeStep(uiPreferences = uiPreferences) },
|
||||||
|
{ StorageStep(storagePref = storagePreferences.baseStorageDirectory()) },
|
||||||
|
// TODO: prompt for notification permissions when bumping target to Android 13
|
||||||
|
{ GuidesStep(onRestoreBackup = onRestoreBackup) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val isLastStep = currentStep == steps.size - 1
|
||||||
|
|
||||||
BackHandler(enabled = currentStep != 0, onBack = { currentStep-- })
|
BackHandler(enabled = currentStep != 0, onBack = { currentStep-- })
|
||||||
|
|
||||||
InfoScreen(
|
InfoScreen(
|
||||||
@ -56,10 +62,15 @@ fun OnboardingScreen(
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
onAcceptClick = {
|
onAcceptClick = {
|
||||||
if (!isLastStep) {
|
if (isLastStep) {
|
||||||
currentStep++
|
|
||||||
} else {
|
|
||||||
onComplete()
|
onComplete()
|
||||||
|
} else {
|
||||||
|
// TODO: this is kind of janky
|
||||||
|
if (currentStep == 1 && !storagePreferences.baseStorageDirectory().isSet()) {
|
||||||
|
context.toast(MR.strings.onboarding_storage_selection_required)
|
||||||
|
} else {
|
||||||
|
currentStep++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rejectText = stringResource(MR.strings.onboarding_action_skip),
|
rejectText = stringResource(MR.strings.onboarding_action_skip),
|
||||||
|
@ -396,7 +396,12 @@ object Migrations {
|
|||||||
newKey = { Preference.privateKey(it) },
|
newKey = { Preference.privateKey(it) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (oldVersion < 110) {
|
if (oldVersion < 111) {
|
||||||
|
File(context.cacheDir, "dl_index_cache")
|
||||||
|
.takeIf { it.exists() }
|
||||||
|
?.delete()
|
||||||
|
}
|
||||||
|
if (oldVersion < 112) {
|
||||||
val prefsToReplace = listOf(
|
val prefsToReplace = listOf(
|
||||||
"pref_download_only",
|
"pref_download_only",
|
||||||
"incognito_mode",
|
"incognito_mode",
|
||||||
@ -409,6 +414,7 @@ object Migrations {
|
|||||||
"last_app_check",
|
"last_app_check",
|
||||||
"last_ext_check",
|
"last_ext_check",
|
||||||
"last_version_code",
|
"last_version_code",
|
||||||
|
"storage_dir",
|
||||||
)
|
)
|
||||||
replacePreferences(
|
replacePreferences(
|
||||||
preferenceStore = preferenceStore,
|
preferenceStore = preferenceStore,
|
||||||
@ -416,11 +422,6 @@ object Migrations {
|
|||||||
newKey = { Preference.appStateKey(it) },
|
newKey = { Preference.appStateKey(it) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (oldVersion < 111) {
|
|
||||||
File(context.cacheDir, "dl_index_cache")
|
|
||||||
.takeIf { it.exists() }
|
|
||||||
?.delete()
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package tachiyomi.domain.storage.service
|
package tachiyomi.domain.storage.service
|
||||||
|
|
||||||
|
import tachiyomi.core.preference.Preference
|
||||||
import tachiyomi.core.preference.PreferenceStore
|
import tachiyomi.core.preference.PreferenceStore
|
||||||
import tachiyomi.core.storage.FolderProvider
|
import tachiyomi.core.storage.FolderProvider
|
||||||
|
|
||||||
@ -8,5 +9,5 @@ class StoragePreferences(
|
|||||||
private val preferenceStore: PreferenceStore,
|
private val preferenceStore: PreferenceStore,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun baseStorageDirectory() = preferenceStore.getString("storage_dir", folderProvider.path())
|
fun baseStorageDirectory() = preferenceStore.getString(Preference.appStateKey("storage_dir"), folderProvider.path())
|
||||||
}
|
}
|
||||||
|
@ -182,6 +182,7 @@
|
|||||||
<string name="onboarding_action_skip">Skip</string>
|
<string name="onboarding_action_skip">Skip</string>
|
||||||
<string name="onboarding_storage_info">Select a folder where %1$s will store chapter downloads, backups, and more.\n\nA dedicated folder is recommended.\n\nSelected folder: %2$s</string>
|
<string name="onboarding_storage_info">Select a folder where %1$s will store chapter downloads, backups, and more.\n\nA dedicated folder is recommended.\n\nSelected folder: %2$s</string>
|
||||||
<string name="onboarding_storage_action_select">Select a folder</string>
|
<string name="onboarding_storage_action_select">Select a folder</string>
|
||||||
|
<string name="onboarding_storage_selection_required">A folder must be selected</string>
|
||||||
<string name="onboarding_guides_new_user">New to %s? We recommend checking out the getting started guide.</string>
|
<string name="onboarding_guides_new_user">New to %s? We recommend checking out the getting started guide.</string>
|
||||||
<string name="onboarding_guides_returning_user">Already used %s before?</string>
|
<string name="onboarding_guides_returning_user">Already used %s before?</string>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user