Skip to content

Commit

Permalink
refactor: remove donation & store external links
Browse files Browse the repository at this point in the history
  • Loading branch information
zyrouge committed Nov 24, 2023
1 parent 1852bc3 commit 947902a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .phrasey/schema.toml
Original file line number Diff line number Diff line change
Expand Up @@ -588,3 +588,6 @@ name = "Equalizer"
[[keys]]
name = "LaunchingEqualizerFailedX"
parameters = ["x"]

[[keys]]
name = "ConsiderContributing"
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fun HomeView(context: ViewContext) {
Text(context.symphony.t.Rescan)
},
onClick = {
showOptionsDropdown = false
context.symphony.radio.stop()
coroutineScope.launch {
context.symphony.groove.refetch()
Expand Down
90 changes: 12 additions & 78 deletions app/src/main/java/io/github/zyrouge/symphony/ui/view/Settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ import androidx.compose.material.icons.filled.Recommend
import androidx.compose.material.icons.filled.RuleFolder
import androidx.compose.material.icons.filled.SkipNext
import androidx.compose.material.icons.filled.Storage
import androidx.compose.material.icons.filled.Store
import androidx.compose.material.icons.filled.TextFormat
import androidx.compose.material.icons.filled.TextIncrease
import androidx.compose.material.icons.filled.Update
import androidx.compose.material.icons.twotone.Redeem
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
Expand Down Expand Up @@ -182,7 +180,7 @@ fun SettingsView(context: ViewContext) {
.fillMaxSize()
) {
val scrollState = rememberScrollState()
var donationsOffsetY: Int? = null
var contributeOffsetY: Int? = null

Column(
modifier = Modifier.verticalScroll(scrollState)
Expand All @@ -194,7 +192,7 @@ fun SettingsView(context: ViewContext) {
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primary)
.clickable {
donationsOffsetY?.let {
contributeOffsetY?.let {
coroutineScope.launch {
scrollState.animateScrollTo(
it,
Expand All @@ -219,7 +217,7 @@ fun SettingsView(context: ViewContext) {
)
Box(modifier = Modifier.width(4.dp))
Text(
context.symphony.t.ConsiderDonating,
context.symphony.t.ConsiderContributing,
style = MaterialTheme.typography.labelLarge.copy(
fontWeight = FontWeight.Bold,
color = contentColor,
Expand Down Expand Up @@ -792,55 +790,20 @@ fun SettingsView(context: ViewContext) {
Box(
modifier = Modifier
.onGloballyPositioned { coordinates ->
donationsOffsetY = coordinates.positionInParent().y.toInt()
contributeOffsetY = coordinates.positionInParent().y.toInt()
}
) {
SettingsDonationTile(
SettingsLinkTile(
context,
text = context.symphony.t.SponsorViaGitHub,
url = AppMeta.githubSponsorsUrl
icon = {
Icon(Icons.Filled.Code, null)
},
title = {
Text(context.symphony.t.GitHub)
},
url = AppMeta.githubRepositoryUrl
)
}
SettingsDonationTile(
context,
text = context.symphony.t.SponsorViaKoFi,
url = AppMeta.koFiUrl
)
SettingsDonationTile(
context,
text = context.symphony.t.SponsorViaPatreon,
url = AppMeta.patreonUrl
)
SettingsLinkTile(
context,
icon = {
Icon(Icons.Filled.Code, null)
},
title = {
Text(context.symphony.t.GitHub)
},
url = AppMeta.githubRepositoryUrl
)
SettingsLinkTile(
context,
icon = {
Icon(Icons.Filled.Store, null)
},
title = {
Text(context.symphony.t.IzzyOnDroid)
},
url = AppMeta.izzyOnDroidUrl
)
SettingsLinkTile(
context,
icon = {
Icon(Icons.Filled.Store, null)
},
title = {
Text(context.symphony.t.FDroid)
},
url = AppMeta.fdroidUrl
)
}
}
}
Expand All @@ -861,32 +824,3 @@ fun NowPlayingControlsLayout.label(context: ViewContext): String {
NowPlayingControlsLayout.Traditional -> context.symphony.t.Traditional
}
}

@Composable
private fun SettingsDonationTile(
context: ViewContext,
text: String,
url: String,
) {
val primaryColor = MaterialTheme.colorScheme.primary

SettingsLinkTile(
context,
icon = {
Icon(
Icons.TwoTone.Redeem,
null,
tint = primaryColor,
)
},
title = {
Text(
text,
style = MaterialTheme.typography.bodyLarge.copy(
color = primaryColor,
),
)
},
url = url,
)
}
2 changes: 2 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,5 @@ RenamePlaylist = "Rename playlist"
Rename = "Rename"
Equalizer = "Equalizer"
LaunchingEqualizerFailedX = "Launching equalizer failed (Error: {x})"
ConsiderContributing = "Consider contributing!"

0 comments on commit 947902a

Please sign in to comment.