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