remove usage of non-js library
This commit is contained in:
@@ -95,7 +95,6 @@ kotlin {
|
||||
implementation(libs.haze.materials)
|
||||
implementation(libs.kstore)
|
||||
implementation(libs.napier)
|
||||
implementation(libs.message.bar)
|
||||
}
|
||||
|
||||
commonTest.dependencies {
|
||||
|
||||
+29
-16
@@ -1,7 +1,6 @@
|
||||
package dev.meloda.overseerr.screens.requests.presentation
|
||||
|
||||
import ContentWithMessageBar
|
||||
import MessageBarPosition
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
@@ -30,14 +29,15 @@ import dev.chrisbanes.haze.materials.HazeMaterials
|
||||
import dev.meloda.overseerr.screens.requests.RequestsViewModel
|
||||
import dev.meloda.overseerr.screens.requests.RequestsViewModelImpl
|
||||
import dev.meloda.overseerr.screens.requests.model.RequestsScreenState
|
||||
import kotlinx.coroutines.delay
|
||||
import org.koin.compose.viewmodel.koinViewModel
|
||||
import rememberMessageBarState
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class RequestsScreen : Screen {
|
||||
|
||||
@OptIn(
|
||||
ExperimentalMaterial3Api::class,
|
||||
ExperimentalHazeMaterialsApi::class
|
||||
ExperimentalHazeMaterialsApi::class, ExperimentalMaterial3Api::class
|
||||
)
|
||||
@Composable
|
||||
override fun Content() {
|
||||
@@ -49,17 +49,16 @@ class RequestsScreen : Screen {
|
||||
val hazeStyle = HazeMaterials.ultraThin()
|
||||
|
||||
val refreshState = rememberPullToRefreshState()
|
||||
val messageBarState = rememberMessageBarState()
|
||||
|
||||
LaunchedEffect(screenState) {
|
||||
if (screenState.apiErrorText != null) {
|
||||
messageBarState.addError(Exception(screenState.apiErrorText))
|
||||
viewModel.onErrorMessageShown()
|
||||
if (screenState.apiInfo != null) {
|
||||
delay(5.seconds)
|
||||
viewModel.onSuccessMessageShown()
|
||||
}
|
||||
|
||||
if (screenState.apiInfo != null) {
|
||||
messageBarState.addSuccess(screenState.apiInfo.toString())
|
||||
viewModel.onSuccessMessageShown()
|
||||
if (screenState.apiErrorText != null) {
|
||||
delay(5.seconds)
|
||||
viewModel.onErrorMessageShown()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,10 +96,6 @@ class RequestsScreen : Screen {
|
||||
) { padding ->
|
||||
val bottomPadding = padding.calculateBottomPadding()
|
||||
|
||||
ContentWithMessageBar(
|
||||
messageBarState = messageBarState,
|
||||
position = MessageBarPosition.BOTTOM
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
@@ -123,6 +118,25 @@ class RequestsScreen : Screen {
|
||||
item {
|
||||
Spacer(modifier = Modifier.height(padding.calculateTopPadding()))
|
||||
}
|
||||
item {
|
||||
AnimatedVisibility(screenState.apiErrorText != null || screenState.apiInfo != null) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(
|
||||
if (screenState.apiInfo != null) Color(0xffb00b69)
|
||||
else Color.Red
|
||||
),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Text(
|
||||
text = screenState.apiErrorText ?: screenState.apiInfo.toString(),
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
modifier = Modifier.padding(10.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
items(items = screenState.dummyItems) { index ->
|
||||
Text(
|
||||
text = "Text #${index + 1}",
|
||||
@@ -159,5 +173,4 @@ class RequestsScreen : Screen {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ haze = "0.7.3"
|
||||
kstore = "0.8.0"
|
||||
appdirs = "1.2.2"
|
||||
napier = "2.7.1"
|
||||
message-bar = "1.0.5"
|
||||
|
||||
[libraries]
|
||||
|
||||
@@ -49,7 +48,6 @@ kstore-file = { module = "io.github.xxfast:kstore-file", version.ref = "kstore"
|
||||
kstore-storage = { module = "io.github.xxfast:kstore-storage", version.ref = "kstore" }
|
||||
appdirs = { module = "net.harawata:appdirs", version.ref = "appdirs" }
|
||||
napier = { module = "io.github.aakira:napier", version.ref = "napier" }
|
||||
message-bar = { module = "com.stevdza-san:messagebarkmp", version.ref = "message-bar" }
|
||||
|
||||
[plugins]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user