diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/other/Constants.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/other/Constants.kt
index 85b1f94..d46e0ee 100644
--- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/other/Constants.kt
+++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/other/Constants.kt
@@ -17,4 +17,10 @@ data object Constants {
const val CLIENT = "AniListAuthClient"
}
}
+
+ data object Sponsor {
+ const val GITHUB = "https://github.com/sponsors/DatL4g"
+ const val POLAR = "https://polar.sh/DatL4g"
+ const val PATREON = "https://patreon.com/datlag"
+ }
}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/SettingsDialog.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/SettingsDialog.kt
index 5086d79..1624c18 100644
--- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/SettingsDialog.kt
+++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/SettingsDialog.kt
@@ -136,84 +136,19 @@ fun SettingsScreen(component: SettingsComponent) {
}
}
item {
- val uriHandler = LocalUriHandler.current
-
- Row(
- modifier = Modifier
- .fillParentMaxWidth()
- .defaultMinSize(minHeight = ButtonDefaults.MinHeight)
- .clip(MaterialTheme.shapes.small)
- .onClick {
- uriHandler.openUri(Constants.GITHUB_REPO)
- },
- verticalAlignment = Alignment.CenterVertically,
- horizontalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- Image(
- modifier = Modifier.size(24.dp),
- painter = painterResource(SharedRes.images.github),
- contentDescription = null,
- colorFilter = ColorFilter.tint(LocalContentColor.current)
- )
- Text(text = stringResource(SharedRes.strings.github_repository))
- }
+ GitHubRepoSection(modifier = Modifier.fillParentMaxWidth())
}
item {
- val uriHandler = LocalUriHandler.current
-
- Row(
- modifier = Modifier
- .fillParentMaxWidth()
- .defaultMinSize(minHeight = ButtonDefaults.MinHeight)
- .clip(MaterialTheme.shapes.medium)
- .onClick {
- uriHandler.openUri(Constants.GITHUB_OWNER)
- },
- verticalAlignment = Alignment.CenterVertically,
- horizontalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- Icon(
- imageVector = Icons.Rounded.Code,
- contentDescription = null,
- )
- Text(text = stringResource(SharedRes.strings.developed_by_datlag))
- }
+ GitHubOwnerSection(modifier = Modifier.fillParentMaxWidth())
}
item {
- var clicked by remember { mutableStateOf(0) }
-
- Row(
- modifier = Modifier
- .fillParentMaxWidth()
- .defaultMinSize(minHeight = ButtonDefaults.MinHeight)
- .clip(MaterialTheme.shapes.medium)
- .onClick {
- if (clicked >= 99) {
- component.nekos()
- } else {
- clicked++
- }
- },
- verticalAlignment = Alignment.CenterVertically,
- horizontalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- Image(
- modifier = Modifier.size(24.dp),
- painter = painterResource(SharedRes.images.cat_filled),
- contentDescription = null,
- colorFilter = ColorFilter.tint(LocalContentColor.current)
- )
- Text(text = stringResource(SharedRes.strings.nekos_api))
- AnimatedVisibility(
- visible = clicked >= 1,
- ) {
- Badge(
- containerColor = MaterialTheme.colorScheme.tertiaryContainer
- ) {
- Text(text = "$clicked")
- }
- }
- }
+ NekosSection(
+ modifier = Modifier.fillParentMaxWidth(),
+ onClick = component::nekos
+ )
+ }
+ item {
+ SponsorSection(modifier = Modifier.fillParentMaxWidth())
}
}
}
diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/GitHubOwnerSection.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/GitHubOwnerSection.kt
new file mode 100644
index 0000000..c914090
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/GitHubOwnerSection.kt
@@ -0,0 +1,45 @@
+package dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.component
+
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.defaultMinSize
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.rounded.Code
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.unit.dp
+import dev.datlag.aniflow.SharedRes
+import dev.datlag.aniflow.other.Constants
+import dev.datlag.tooling.compose.onClick
+import dev.icerock.moko.resources.compose.stringResource
+
+@Composable
+fun GitHubOwnerSection(
+ modifier: Modifier = Modifier,
+) {
+ val uriHandler = LocalUriHandler.current
+
+ Row(
+ modifier = modifier
+ .defaultMinSize(minHeight = ButtonDefaults.MinHeight)
+ .clip(MaterialTheme.shapes.medium)
+ .onClick {
+ uriHandler.openUri(Constants.GITHUB_OWNER)
+ },
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ Icon(
+ imageVector = Icons.Rounded.Code,
+ contentDescription = null,
+ )
+ Text(text = stringResource(SharedRes.strings.developed_by_datlag))
+ }
+}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/GitHubRepoSection.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/GitHubRepoSection.kt
new file mode 100644
index 0000000..ad905c2
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/GitHubRepoSection.kt
@@ -0,0 +1,49 @@
+package dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.component
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.defaultMinSize
+import androidx.compose.foundation.layout.size
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.LocalContentColor
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.ColorFilter
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.unit.dp
+import dev.datlag.aniflow.SharedRes
+import dev.datlag.aniflow.other.Constants
+import dev.datlag.tooling.compose.onClick
+import dev.icerock.moko.resources.compose.painterResource
+import dev.icerock.moko.resources.compose.stringResource
+
+@Composable
+fun GitHubRepoSection(
+ modifier: Modifier = Modifier,
+) {
+ val uriHandler = LocalUriHandler.current
+
+ Row(
+ modifier = modifier
+ .defaultMinSize(minHeight = ButtonDefaults.MinHeight)
+ .clip(MaterialTheme.shapes.small)
+ .onClick {
+ uriHandler.openUri(Constants.GITHUB_REPO)
+ },
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ Image(
+ modifier = Modifier.size(24.dp),
+ painter = painterResource(SharedRes.images.github),
+ contentDescription = null,
+ colorFilter = ColorFilter.tint(LocalContentColor.current)
+ )
+ Text(text = stringResource(SharedRes.strings.github_repository))
+ }
+}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/NekosSection.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/NekosSection.kt
new file mode 100644
index 0000000..224d4be
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/NekosSection.kt
@@ -0,0 +1,60 @@
+package dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.component
+
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.defaultMinSize
+import androidx.compose.foundation.layout.size
+import androidx.compose.material3.*
+import androidx.compose.runtime.*
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.ColorFilter
+import androidx.compose.ui.unit.dp
+import dev.datlag.aniflow.SharedRes
+import dev.datlag.tooling.compose.onClick
+import dev.icerock.moko.resources.compose.painterResource
+import dev.icerock.moko.resources.compose.stringResource
+
+@Composable
+fun NekosSection(
+ modifier: Modifier = Modifier,
+ onClick: () -> Unit
+) {
+ var clicked by remember { mutableStateOf(0) }
+
+ Row(
+ modifier = modifier
+ .defaultMinSize(minHeight = ButtonDefaults.MinHeight)
+ .clip(MaterialTheme.shapes.medium)
+ .onClick {
+ if (clicked >= 99) {
+ onClick()
+ } else {
+ clicked++
+ }
+ },
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ Image(
+ modifier = Modifier.size(24.dp),
+ painter = painterResource(SharedRes.images.cat_filled),
+ contentDescription = null,
+ colorFilter = ColorFilter.tint(LocalContentColor.current)
+ )
+ Text(text = stringResource(SharedRes.strings.nekos_api))
+ AnimatedVisibility(
+ visible = clicked >= 1,
+ ) {
+ Badge(
+ containerColor = MaterialTheme.colorScheme.tertiaryContainer
+ ) {
+ Text(text = "$clicked")
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/SponsorSection.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/SponsorSection.kt
new file mode 100644
index 0000000..c8b343d
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/dialog/settings/component/SponsorSection.kt
@@ -0,0 +1,87 @@
+package dev.datlag.aniflow.ui.navigation.screen.home.dialog.settings.component
+
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.defaultMinSize
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.rounded.Savings
+import androidx.compose.material3.*
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.unit.dp
+import com.maxkeppeker.sheets.core.models.base.Header
+import com.maxkeppeker.sheets.core.models.base.IconSource
+import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState
+import com.maxkeppeler.sheets.option.OptionDialog
+import com.maxkeppeler.sheets.option.models.DisplayMode
+import com.maxkeppeler.sheets.option.models.Option
+import com.maxkeppeler.sheets.option.models.OptionConfig
+import com.maxkeppeler.sheets.option.models.OptionSelection
+import dev.datlag.aniflow.SharedRes
+import dev.datlag.aniflow.other.Constants
+import dev.datlag.tooling.compose.onClick
+import dev.icerock.moko.resources.compose.painterResource
+import dev.icerock.moko.resources.compose.stringResource
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun SponsorSection(
+ modifier: Modifier = Modifier,
+) {
+ val sponsorDialog = rememberUseCaseState()
+ val uriHandler = LocalUriHandler.current
+
+ OptionDialog(
+ state = sponsorDialog,
+ config = OptionConfig(
+ mode = DisplayMode.LIST
+ ),
+ selection = OptionSelection.Single(
+ options = listOf(
+ Option(
+ icon = IconSource(painter = painterResource(SharedRes.images.github)),
+ titleText = stringResource(SharedRes.strings.github)
+ ),
+ Option(
+ icon = IconSource(painter = painterResource(SharedRes.images.polar)),
+ titleText = stringResource(SharedRes.strings.polar)
+ ),
+ Option(
+ icon = IconSource(painter = painterResource(SharedRes.images.patreon)),
+ titleText = stringResource(SharedRes.strings.patreon)
+ )
+ ),
+ onSelectOption = { option, _ ->
+ when (option) {
+ 0 -> uriHandler.openUri(Constants.Sponsor.GITHUB)
+ 1 -> uriHandler.openUri(Constants.Sponsor.POLAR)
+ 2 -> uriHandler.openUri(Constants.Sponsor.PATREON)
+ }
+ }
+ ),
+ header = Header.Default(
+ title = stringResource(SharedRes.strings.sponsor),
+ icon = IconSource(imageVector = Icons.Rounded.Savings)
+ )
+ )
+
+ Row(
+ modifier = modifier
+ .defaultMinSize(minHeight = ButtonDefaults.MinHeight)
+ .clip(MaterialTheme.shapes.medium)
+ .onClick {
+ sponsorDialog.show()
+ },
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ Icon(
+ imageVector = Icons.Rounded.Savings,
+ contentDescription = null,
+ )
+ Text(text = stringResource(SharedRes.strings.sponsor))
+ }
+}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/moko-resources/base/strings.xml b/composeApp/src/commonMain/moko-resources/base/strings.xml
index d8e063f..d865e07 100644
--- a/composeApp/src/commonMain/moko-resources/base/strings.xml
+++ b/composeApp/src/commonMain/moko-resources/base/strings.xml
@@ -80,4 +80,8 @@
Developed by DatLag
Profile Color
Login with [AniList](%s)
+ GitHub
+ Polar
+ Patreon
+ Sponsor
diff --git a/composeApp/src/commonMain/moko-resources/images/patreon.svg b/composeApp/src/commonMain/moko-resources/images/patreon.svg
new file mode 100644
index 0000000..4d5b7cd
--- /dev/null
+++ b/composeApp/src/commonMain/moko-resources/images/patreon.svg
@@ -0,0 +1,8 @@
+
+
+
diff --git a/composeApp/src/commonMain/moko-resources/images/polar.svg b/composeApp/src/commonMain/moko-resources/images/polar.svg
new file mode 100644
index 0000000..6fc6b62
--- /dev/null
+++ b/composeApp/src/commonMain/moko-resources/images/polar.svg
@@ -0,0 +1 @@
+