From e64efcbfa926e5d02236c21c2d24c1f86da9d20c Mon Sep 17 00:00:00 2001 From: michaelbel Date: Fri, 23 Feb 2024 21:16:43 +0300 Subject: [PATCH] Glance app widget --- config/detekt/detekt.yml | 1 + .../michaelbel/movies/repository/impl/MovieRepositoryImpl.kt | 4 ++-- .../org/michaelbel/movies/ui/placeholder/Placeholder.kt | 1 - .../movies/widget/work/MoviesGlanceStateDefinition.kt | 4 ++-- .../kotlin/org/michaelbel/movies/search/SearchNavigation.kt | 1 - 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 3ad4cd5b7..5baf48c4d 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -262,6 +262,7 @@ exceptions: - 'MalformedURLException' - 'NumberFormatException' - 'ParseException' + - 'SerializationException' allowedExceptionNameRegex: '_|(ignore|expected).*' ThrowingExceptionFromFinally: active: true diff --git a/core/repository/src/main/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt b/core/repository/src/main/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt index 4a0eb3252..9410cb436 100644 --- a/core/repository/src/main/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt +++ b/core/repository/src/main/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt @@ -55,7 +55,7 @@ internal class MovieRepositoryImpl @Inject constructor( override suspend fun movieDetails(pagingKey: String, movieId: Int): MovieDb { return try { movieDao.movieById(pagingKey, movieId) ?: movieService.movie(movieId, localeController.language).mapToMovieDb - } catch (e: Exception) { + } catch (ignored: Exception) { throw MovieDetailsException } } @@ -76,7 +76,7 @@ internal class MovieRepositoryImpl @Inject constructor( movieDao.removeMovies(MovieDb.MOVIES_WIDGET) movieDao.insertMovies(moviesDb) movieDao.moviesMini(MovieDb.MOVIES_WIDGET, MovieResponse.DEFAULT_PAGE_SIZE) - } catch (e: Exception) { + } catch (ignored: Exception) { movieDao.moviesMini(MovieDb.MOVIES_WIDGET, MovieResponse.DEFAULT_PAGE_SIZE).ifEmpty { throw MoviesUpcomingException } diff --git a/core/ui/src/main/kotlin/org/michaelbel/movies/ui/placeholder/Placeholder.kt b/core/ui/src/main/kotlin/org/michaelbel/movies/ui/placeholder/Placeholder.kt index 5471abeb9..ddebcfe31 100644 --- a/core/ui/src/main/kotlin/org/michaelbel/movies/ui/placeholder/Placeholder.kt +++ b/core/ui/src/main/kotlin/org/michaelbel/movies/ui/placeholder/Placeholder.kt @@ -30,7 +30,6 @@ import androidx.compose.animation.core.updateTransition import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableFloatStateOf -import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier diff --git a/core/widget/src/main/kotlin/org/michaelbel/movies/widget/work/MoviesGlanceStateDefinition.kt b/core/widget/src/main/kotlin/org/michaelbel/movies/widget/work/MoviesGlanceStateDefinition.kt index 2e9151ece..9e681aa08 100644 --- a/core/widget/src/main/kotlin/org/michaelbel/movies/widget/work/MoviesGlanceStateDefinition.kt +++ b/core/widget/src/main/kotlin/org/michaelbel/movies/widget/work/MoviesGlanceStateDefinition.kt @@ -34,8 +34,8 @@ internal object MoviesGlanceStateDefinition: GlanceStateDefinition