mirror of
https://github.com/meowarex/rl-mobile.git
synced 2026-08-26 14:07:45 +10:00
feat(waze patch): waze media menu browse source options
This commit is contained in:
@@ -140,6 +140,22 @@ enum class KnownPatch(
|
||||
titleRes = R.string.patch_waze_integration_title,
|
||||
descRes = R.string.patch_waze_integration_desc,
|
||||
default = Disabled,
|
||||
advancedOptions = listOf(
|
||||
PatchOption.Choice(
|
||||
key = "browse_root",
|
||||
titleRes = R.string.patch_waze_browse_root_title,
|
||||
entries = listOf(
|
||||
ChoiceEntry(R.string.patch_waze_root_auto, value = "ROOT_AUTO"),
|
||||
ChoiceEntry(R.string.patch_waze_root_home, value = "HOME_V2::home_page_v2_id"),
|
||||
ChoiceEntry(
|
||||
R.string.patch_waze_root_recents,
|
||||
value = "RECENTLY_PLAYED::home/pages/CONTINUE_LISTEN_TO/view-all",
|
||||
),
|
||||
),
|
||||
defaultIndex = 0,
|
||||
token = "RL_WAZE_ROOT_ID",
|
||||
),
|
||||
),
|
||||
),
|
||||
LyricsProgressPill(
|
||||
order = 40,
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ sealed interface PatchOption {
|
||||
data class Choice(
|
||||
override val key: String,
|
||||
@StringRes override val titleRes: Int,
|
||||
@StringRes override val descRes: Int,
|
||||
@StringRes override val descRes: Int = 0,
|
||||
val entries: List<ChoiceEntry>,
|
||||
val defaultIndex: Int = 0,
|
||||
val requiresOption: String? = null,
|
||||
|
||||
@@ -187,7 +187,7 @@ private fun PatchOption.toSpec(resolve: (Int) -> String): OptionSpec = when (thi
|
||||
is PatchOption.Choice -> OptionSpec.Choice(
|
||||
key = key,
|
||||
title = resolve(titleRes),
|
||||
description = resolve(descRes),
|
||||
description = if (descRes != 0) resolve(descRes) else "",
|
||||
entries = entries.map { resolve(it.labelRes) },
|
||||
defaultIndex = defaultIndex,
|
||||
values = entries.map { it.value ?: "" },
|
||||
|
||||
+33
@@ -378,6 +378,39 @@ private fun ChoiceOptionRow(
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
if (entries.size > 3) {
|
||||
var expanded by rememberSaveable { mutableStateOf(false) }
|
||||
val selectedLabel = entries.getOrNull(selectedIndex).orEmpty()
|
||||
|
||||
Box(modifier = Modifier.fillMaxWidth()) {
|
||||
OutlinedButton(
|
||||
onClick = { expanded = true },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
) {
|
||||
Text(
|
||||
text = selectedLabel,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
DropdownMenu(
|
||||
expanded = expanded,
|
||||
onDismissRequest = { expanded = false },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
) {
|
||||
entries.forEachIndexed { index, entry ->
|
||||
DropdownMenuItem(
|
||||
text = { Text(entry) },
|
||||
onClick = {
|
||||
onSelect(index)
|
||||
expanded = false
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@Column
|
||||
}
|
||||
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) {
|
||||
entries.forEachIndexed { index, entry ->
|
||||
SegmentedButton(
|
||||
|
||||
@@ -288,6 +288,10 @@
|
||||
>Reveals TIDAL\'s hidden Debug Menu in Settings. (Unlocks Feature Flags & the legacy Debug Options)</string>
|
||||
<string name="patch_waze_integration_title">Waze Integration</string>
|
||||
<string name="patch_waze_integration_desc">Control TIDAL playback from the Waze app</string>
|
||||
<string name="patch_waze_browse_root_title">Media Menu</string>
|
||||
<string name="patch_waze_root_auto">Auto Menu</string>
|
||||
<string name="patch_waze_root_home">Home</string>
|
||||
<string name="patch_waze_root_recents">Recents</string>
|
||||
<string name="patch_enable_legacy_ui_title">Enable Legacy UI</string>
|
||||
<string
|
||||
name="patch_enable_legacy_ui_desc"
|
||||
|
||||
Reference in New Issue
Block a user