mirror of
https://github.com/bbara04/Purefin.git
synced 2026-03-31 17:10:08 +02:00
Removed online/offline toggle button from tv ui and also from the references
This commit is contained in:
@@ -36,7 +36,6 @@ fun TvHomeScreen(
|
|||||||
) {
|
) {
|
||||||
var selectedTabIndex by remember { mutableIntStateOf(1) }
|
var selectedTabIndex by remember { mutableIntStateOf(1) }
|
||||||
val libraries by viewModel.libraries.collectAsState()
|
val libraries by viewModel.libraries.collectAsState()
|
||||||
val isOfflineMode by viewModel.isOfflineMode.collectAsState()
|
|
||||||
val continueWatching by viewModel.continueWatching.collectAsState()
|
val continueWatching by viewModel.continueWatching.collectAsState()
|
||||||
val nextUp by viewModel.nextUp.collectAsState()
|
val nextUp by viewModel.nextUp.collectAsState()
|
||||||
val latestLibraryContent by viewModel.latestLibraryContent.collectAsState()
|
val latestLibraryContent by viewModel.latestLibraryContent.collectAsState()
|
||||||
@@ -96,9 +95,7 @@ fun TvHomeScreen(
|
|||||||
selectedTabIndex = safeSelectedTabIndex,
|
selectedTabIndex = safeSelectedTabIndex,
|
||||||
onTabSelected = { index, _ ->
|
onTabSelected = { index, _ ->
|
||||||
selectedTabIndex = index
|
selectedTabIndex = index
|
||||||
},
|
}
|
||||||
isOfflineMode = isOfflineMode,
|
|
||||||
onToggleOfflineMode = viewModel::toggleOfflineMode
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import androidx.compose.foundation.layout.Row
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.statusBarsPadding
|
import androidx.compose.foundation.layout.statusBarsPadding
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.outlined.Cloud
|
|
||||||
import androidx.compose.material.icons.outlined.CloudOff
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@@ -21,7 +18,6 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.zIndex
|
import androidx.compose.ui.zIndex
|
||||||
import hu.bbara.purefin.common.ui.components.PurefinIconButton
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -29,8 +25,6 @@ fun TvHomeTopBar(
|
|||||||
tabs: List<TvHomeTabItem>,
|
tabs: List<TvHomeTabItem>,
|
||||||
selectedTabIndex: Int,
|
selectedTabIndex: Int,
|
||||||
onTabSelected: (Int, TvHomeTabItem) -> Unit,
|
onTabSelected: (Int, TvHomeTabItem) -> Unit,
|
||||||
isOfflineMode: Boolean,
|
|
||||||
onToggleOfflineMode: () -> Unit,
|
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val scheme = MaterialTheme.colorScheme
|
val scheme = MaterialTheme.colorScheme
|
||||||
@@ -75,11 +69,6 @@ fun TvHomeTopBar(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PurefinIconButton(
|
|
||||||
icon = if (isOfflineMode) Icons.Outlined.CloudOff else Icons.Outlined.Cloud,
|
|
||||||
contentDescription = if (isOfflineMode) "Switch to Online" else "Switch to Offline",
|
|
||||||
onClick = onToggleOfflineMode
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,10 +51,4 @@ class UserSessionRepository @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val isOfflineMode: Flow<Boolean> = session.map { it.isOfflineMode }.distinctUntilChanged()
|
val isOfflineMode: Flow<Boolean> = session.map { it.isOfflineMode }.distinctUntilChanged()
|
||||||
|
|
||||||
suspend fun setOfflineMode(isOffline: Boolean) {
|
|
||||||
userSessionDataStore.updateData {
|
|
||||||
it.copy(isOfflineMode = isOffline)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,12 +61,6 @@ class AppViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), emptyList())
|
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), emptyList())
|
||||||
|
|
||||||
val isOfflineMode = userSessionRepository.isOfflineMode.stateIn(
|
|
||||||
scope = viewModelScope,
|
|
||||||
started = SharingStarted.Eagerly,
|
|
||||||
initialValue = false
|
|
||||||
)
|
|
||||||
|
|
||||||
val continueWatching = combine(
|
val continueWatching = combine(
|
||||||
appContentRepository.continueWatching,
|
appContentRepository.continueWatching,
|
||||||
appContentRepository.movies,
|
appContentRepository.movies,
|
||||||
@@ -232,10 +226,4 @@ class AppViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toggleOfflineMode() {
|
|
||||||
viewModelScope.launch {
|
|
||||||
userSessionRepository.setOfflineMode(!isOfflineMode.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user