mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-07-26 22:42:17 +00:00
feat: support for 6 profiles
This commit is contained in:
parent
21a9e2df69
commit
1b4d08bbba
4 changed files with 8 additions and 5 deletions
|
|
@ -5,6 +5,8 @@ import com.nuvio.app.core.network.SyncBackendRepository
|
|||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
const val MAX_PROFILES = 6
|
||||
|
||||
@Serializable
|
||||
data class NuvioProfile(
|
||||
val id: String = "",
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ object ProfileRepository {
|
|||
}
|
||||
try {
|
||||
val params = buildJsonObject {
|
||||
put("p_client_max_profiles", MAX_PROFILES)
|
||||
put("p_profiles", json.encodeToJsonElement(profiles))
|
||||
}
|
||||
SupabaseProvider.client.postgrest.rpc("sync_push_profiles", params)
|
||||
|
|
@ -203,7 +204,7 @@ object ProfileRepository {
|
|||
usesPrimaryAddons: Boolean = false,
|
||||
) {
|
||||
val existing = _state.value.profiles
|
||||
val nextIndex = ((1..4).toSet() - existing.map { it.profileIndex }.toSet()).minOrNull() ?: return
|
||||
val nextIndex = ((1..MAX_PROFILES).toSet() - existing.map { it.profileIndex }.toSet()).minOrNull() ?: return
|
||||
|
||||
val allPayloads = existing.map { profile ->
|
||||
ProfilePushPayload(
|
||||
|
|
@ -478,7 +479,7 @@ object ProfileRepository {
|
|||
|
||||
private fun syncPinCache(profiles: List<NuvioProfile>) {
|
||||
val profilesByIndex = profiles.associateBy { it.profileIndex }
|
||||
for (profileIndex in 1..4) {
|
||||
for (profileIndex in 1..MAX_PROFILES) {
|
||||
val profile = profilesByIndex[profileIndex]
|
||||
if (profile == null || !profile.pinEnabled) {
|
||||
ProfilePinCacheStorage.removePayload(profileIndex)
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ fun ProfileSelectionScreen(
|
|||
Spacer(modifier = Modifier.height(if (isTabletLayout) 28.dp else 48.dp))
|
||||
|
||||
val profiles = profileState.profiles
|
||||
val items = profiles.size + if (profiles.size < 4) 1 else 0
|
||||
val items = profiles.size + if (profiles.size < MAX_PROFILES) 1 else 0
|
||||
|
||||
if (isTabletLayout) {
|
||||
Box(
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ fun ProfileSwitcherTab(
|
|||
)
|
||||
}
|
||||
|
||||
if (profiles.size < 4) {
|
||||
if (profiles.size < MAX_PROFILES) {
|
||||
PopupAddProfileBubble(
|
||||
delayMs = profiles.size * 50,
|
||||
onClick = {
|
||||
|
|
@ -473,7 +473,7 @@ fun NativeProfileSwitcherPopup(
|
|||
)
|
||||
}
|
||||
|
||||
if (profiles.size < 4) {
|
||||
if (profiles.size < MAX_PROFILES) {
|
||||
PopupAddProfileBubble(
|
||||
delayMs = profiles.size * 50,
|
||||
onClick = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue