Fix warnings

This commit is contained in:
Shinokuni 2024-10-10 15:35:43 +02:00
parent 71898bf6e9
commit 70a81235b4
14 changed files with 27 additions and 30 deletions

View File

@ -21,7 +21,7 @@ object ApiUtils {
fun isMimeImage(type: String): Boolean =
type == "image" || type == "image/jpeg" || type == "image/jpg" || type == "image/png"
fun parseContentType(header: String?): String? {
fun parseContentType(header: String): String? {
val matcher = Pattern.compile(RSS_CONTENT_TYPE_REGEX)
.matcher(header)
return if (matcher.find()) {
@ -37,7 +37,7 @@ object ApiUtils {
* @param text string to clean
* @return cleaned text
*/
fun cleanText(text: String?): String {
fun cleanText(text: String): String {
return Jsoup.parse(text).text().trim()
}

View File

@ -3,17 +3,12 @@ package com.readrops.api.localfeed
import com.readrops.api.localfeed.atom.ATOMFeedAdapter
import com.readrops.api.localfeed.rss1.RSS1FeedAdapter
import com.readrops.api.localfeed.rss2.RSS2FeedAdapter
import junit.framework.Assert.assertTrue
import org.junit.Assert.assertThrows
import org.junit.Rule
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.rules.ExpectedException
class XmlAdapterTest {
@get:Rule
val expectedException: ExpectedException = ExpectedException.none()
@Test
fun xmlFeedAdapterFactoryTest() {
assertTrue(XmlAdapter.xmlFeedAdapterFactory(LocalRSSHelper.RSSType.RSS_1) is RSS1FeedAdapter)

View File

@ -4,9 +4,9 @@ import com.gitlab.mvysny.konsumexml.konsumeXml
import com.readrops.api.TestUtils
import com.readrops.api.utils.exceptions.ParseException
import com.readrops.db.util.DateUtils
import junit.framework.Assert.assertEquals
import junit.framework.Assert.assertNotNull
import junit.framework.TestCase
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertThrows
import org.junit.Assert.assertTrue
import org.junit.Test

View File

@ -39,7 +39,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.koin.koinScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import cafe.adriel.voyager.navigator.tab.Tab
@ -81,7 +81,7 @@ object AccountTab : Tab {
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
val context = LocalContext.current
val screenModel = getScreenModel<AccountScreenModel>()
val screenModel = koinScreenModel<AccountScreenModel>()
val closeHome by screenModel.closeHome.collectAsStateWithLifecycle()
val state by screenModel.accountState.collectAsStateWithLifecycle()

View File

@ -37,7 +37,7 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.koin.koinScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import com.readrops.app.R
@ -67,7 +67,7 @@ class AccountCredentialsScreen(
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
val screenModel =
getScreenModel<AccountCredentialsScreenModel>(parameters = { parametersOf(account, mode) })
koinScreenModel<AccountCredentialsScreenModel>(parameters = { parametersOf(account, mode) })
val state by screenModel.state.collectAsStateWithLifecycle()

View File

@ -33,7 +33,7 @@ import androidx.compose.ui.unit.dp
import androidx.core.content.res.ResourcesCompat
import androidx.core.graphics.drawable.toBitmap
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.koin.koinScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import com.readrops.api.utils.ApiUtils
@ -60,7 +60,7 @@ class AccountSelectionScreen : AndroidScreen() {
val navigator = LocalNavigator.currentOrThrow
val context = LocalContext.current
val screenModel = getScreenModel<AccountSelectionScreenModel>()
val screenModel = koinScreenModel<AccountSelectionScreenModel>()
val state by screenModel.state.collectAsStateWithLifecycle()
val opmlImportLauncher =

View File

@ -39,7 +39,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.koin.koinScreenModel
import cafe.adriel.voyager.navigator.tab.Tab
import cafe.adriel.voyager.navigator.tab.TabOptions
import com.readrops.app.R
@ -75,7 +75,7 @@ object FeedTab : Tab {
val uriHandler = LocalUriHandler.current
val context = LocalContext.current
val screenModel = getScreenModel<FeedScreenModel>()
val screenModel = koinScreenModel<FeedScreenModel>()
val state by screenModel.feedsState.collectAsStateWithLifecycle()
val snackbarHostState = remember { SnackbarHostState() }

View File

@ -11,6 +11,7 @@ import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MenuAnchorType
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@ -112,7 +113,7 @@ fun AddFeedDialog(
modifier = Modifier.size(24.dp)
)
},
modifier = Modifier.menuAnchor()
modifier = Modifier.menuAnchor(type = MenuAnchorType.PrimaryNotEditable)
)
}

View File

@ -6,6 +6,7 @@ import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MenuAnchorType
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@ -118,7 +119,7 @@ fun UpdateFeedDialog(
)
}
},
modifier = Modifier.menuAnchor()
modifier = Modifier.menuAnchor(type = MenuAnchorType.PrimaryNotEditable)
)
}

View File

@ -55,7 +55,7 @@ import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.net.toUri
import androidx.core.view.children
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.koin.koinScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import coil.compose.AsyncImage
@ -85,7 +85,7 @@ class ItemScreen(
val navigator = LocalNavigator.currentOrThrow
val screenModel =
getScreenModel<ItemScreenModel>(parameters = { parametersOf(itemId) })
koinScreenModel<ItemScreenModel>(parameters = { parametersOf(itemId) })
val state by screenModel.state.collectAsStateWithLifecycle()
val primaryColor = MaterialTheme.colorScheme.primary

View File

@ -30,7 +30,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.koin.koinScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import com.readrops.app.R
@ -51,7 +51,7 @@ class PreferencesScreen : AndroidScreen() {
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
val context = LocalContext.current
val screenModel = getScreenModel<PreferencesScreenModel>()
val screenModel = koinScreenModel<PreferencesScreenModel>()
val scrollState = rememberScrollState()
val coroutineScope = rememberCoroutineScope()

View File

@ -31,7 +31,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.koin.koinScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import com.google.accompanist.permissions.ExperimentalPermissionsApi
@ -60,7 +60,7 @@ class NotificationsScreen(val account: Account) : AndroidScreen() {
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
val context = LocalContext.current
val screenModel = getScreenModel<NotificationsScreenModel> { parametersOf(account) }
val screenModel = koinScreenModel<NotificationsScreenModel> { parametersOf(account) }
val state by screenModel.state.collectAsStateWithLifecycle()

View File

@ -51,7 +51,7 @@ import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
import androidx.paging.compose.collectAsLazyPagingItems
import androidx.paging.compose.itemKey
import cafe.adriel.voyager.koin.getScreenModel
import cafe.adriel.voyager.koin.koinScreenModel
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import cafe.adriel.voyager.navigator.tab.Tab
@ -89,7 +89,7 @@ object TimelineTab : Tab {
val navigator = LocalNavigator.currentOrThrow
val context = LocalContext.current
val screenModel = getScreenModel<TimelineScreenModel>()
val screenModel = koinScreenModel<TimelineScreenModel>()
val state by screenModel.timelineState.collectAsStateWithLifecycle()
val preferences = state.preferences
val items = state.itemState.collectAsLazyPagingItems()

View File

@ -9,7 +9,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalDrawerSheet
@ -172,7 +172,7 @@ fun DrawerDefaultItems(
@Composable
fun DrawerDivider() {
Divider(
HorizontalDivider(
thickness = 2.dp,
modifier = Modifier.padding(
vertical = MaterialTheme.spacing.drawerSpacing,