Repository: 1RandomDev/showly-oss
Branch: master
Commit: 8f8e2754e232
Files: 2285
Total size: 33.3 MB
Directory structure:
gitextract_7hdornwr/
├── .editorconfig
├── .github/
│ └── ISSUE_TEMPLATE/
│ └── bug-problem-report.md
├── .gitignore
├── LICENSE
├── README.md
├── app/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── assets/
│ │ │ └── release_notes.txt
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── showly_oss/
│ │ │ ├── App.kt
│ │ │ ├── di/
│ │ │ │ └── module/
│ │ │ │ ├── PreferencesModule.kt
│ │ │ │ ├── ServicesModule.kt
│ │ │ │ └── WorkModule.kt
│ │ │ ├── fcm/
│ │ │ │ └── FcmExtra.kt
│ │ │ ├── ui/
│ │ │ │ ├── BaseActivity.kt
│ │ │ │ ├── main/
│ │ │ │ │ ├── MainActivity.kt
│ │ │ │ │ ├── MainUiState.kt
│ │ │ │ │ ├── MainViewModel.kt
│ │ │ │ │ ├── cases/
│ │ │ │ │ │ ├── MainAnnouncementsCase.kt
│ │ │ │ │ │ ├── MainClearingCase.kt
│ │ │ │ │ │ ├── MainInitialsCase.kt
│ │ │ │ │ │ ├── MainModesCase.kt
│ │ │ │ │ │ ├── MainRateAppCase.kt
│ │ │ │ │ │ ├── MainSettingsCase.kt
│ │ │ │ │ │ ├── MainTipsCase.kt
│ │ │ │ │ │ ├── MainTraktCase.kt
│ │ │ │ │ │ └── deeplink/
│ │ │ │ │ │ ├── ImdbDeepLinkCase.kt
│ │ │ │ │ │ ├── MainDeepLinksCase.kt
│ │ │ │ │ │ ├── TmdbDeepLinkCase.kt
│ │ │ │ │ │ └── TraktDeepLinkCase.kt
│ │ │ │ │ └── delegates/
│ │ │ │ │ └── TipsDelegate.kt
│ │ │ │ └── views/
│ │ │ │ ├── BottomMenuView.kt
│ │ │ │ ├── WelcomeLanguageView.kt
│ │ │ │ ├── WelcomeNoteView.kt
│ │ │ │ └── WhatsNewView.kt
│ │ │ └── utilities/
│ │ │ └── deeplink/
│ │ │ ├── DeepLinkBundle.kt
│ │ │ ├── DeepLinkResolver.kt
│ │ │ ├── DeepLinkSource.kt
│ │ │ └── resolvers/
│ │ │ ├── ImdbSourceResolver.kt
│ │ │ ├── SourceResolver.kt
│ │ │ ├── TmdbSourceResolver.kt
│ │ │ └── TraktSourceResolver.kt
│ │ ├── play/
│ │ │ └── release-notes/
│ │ │ └── en-GB/
│ │ │ └── default.txt
│ │ └── res/
│ │ ├── drawable/
│ │ │ ├── bg_dialog.xml
│ │ │ ├── ic_eye_off.xml
│ │ │ ├── ic_languages.xml
│ │ │ ├── ic_launcher_foreground.xml
│ │ │ ├── ic_launcher_mono.xml
│ │ │ └── selector_bottom_menu.xml
│ │ ├── layout/
│ │ │ ├── activity_main.xml
│ │ │ ├── view_bottom_menu.xml
│ │ │ ├── view_welcome_language.xml
│ │ │ ├── view_welcome_note.xml
│ │ │ └── view_whats_new.xml
│ │ ├── menu/
│ │ │ └── bottom_navigation_menu.xml
│ │ ├── mipmap-anydpi-v26/
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ ├── ic_launcher_background.xml
│ │ │ └── strings.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-sw600dp/
│ │ │ └── dimens.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ ├── values-zh/
│ │ │ └── strings.xml
│ │ └── xml/
│ │ ├── locales_config.xml
│ │ └── shortcuts.xml
│ └── test/
│ └── java/
│ ├── BaseMockTest.kt
│ └── com/
│ └── michaldrabik/
│ └── showly_oss/
│ └── ui/
│ └── main/
│ └── cases/
│ ├── MainRateAppCaseTest.kt
│ └── MainTipsCaseTest.kt
├── assets/
│ ├── codestyle.xml
│ ├── graphics/
│ │ ├── video_preview_feature_graphic.xcf
│ │ └── web_feature_graphic.xcf
│ └── screenshots/
│ └── screenshots.xcf
├── build.gradle
├── common/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── debug/
│ │ └── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── common/
│ │ └── ConfigVariant.kt
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ └── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── common/
│ │ ├── Config.kt
│ │ ├── Mode.kt
│ │ ├── di/
│ │ │ └── CommonBindingModule.kt
│ │ ├── dispatchers/
│ │ │ ├── CoroutineDispatchers.kt
│ │ │ └── DefaultCoroutineDispatchers.kt
│ │ ├── errors/
│ │ │ ├── ErrorHelper.kt
│ │ │ └── ShowlyError.kt
│ │ └── extensions/
│ │ └── DateExtensions.kt
│ └── release/
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── common/
│ └── ConfigVariant.kt
├── common-test/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── common_test/
│ ├── MainDispatcherRule.kt
│ └── UnconfinedCoroutineDispatchers.kt
├── crowdin.yml
├── data-local/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── data_local/
│ │ └── database/
│ │ └── dao/
│ │ ├── BaseDaoTest.kt
│ │ ├── DiscoverShowsDaoTest.kt
│ │ ├── EpisodesDaoTest.kt
│ │ ├── EpisodesSyncLogDaoTest.kt
│ │ ├── MyShowsDaoTest.kt
│ │ ├── RecentSearchDaoTest.kt
│ │ ├── RelatedShowsDaoTest.kt
│ │ ├── SeasonsDaoTest.kt
│ │ ├── SettingsDaoTest.kt
│ │ ├── ShowImagesDaoTest.kt
│ │ ├── ShowsDaoTest.kt
│ │ ├── UserDaoTest.kt
│ │ ├── WatchlistShowsDaoTest.kt
│ │ ├── converters/
│ │ │ └── DateConverterTest.kt
│ │ └── helpers/
│ │ └── TestData.kt
│ └── main/
│ ├── AndroidManifest.xml
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── data_local/
│ ├── LocalDataSource.kt
│ ├── database/
│ │ ├── AppDatabase.kt
│ │ ├── converters/
│ │ │ └── DateConverter.kt
│ │ ├── dao/
│ │ │ ├── ArchiveMoviesDao.kt
│ │ │ ├── ArchiveShowsDao.kt
│ │ │ ├── BaseDao.kt
│ │ │ ├── CustomImagesDao.kt
│ │ │ ├── CustomListsDao.kt
│ │ │ ├── CustomListsItemsDao.kt
│ │ │ ├── DiscoverMoviesDao.kt
│ │ │ ├── DiscoverShowsDao.kt
│ │ │ ├── EpisodeTranslationsDao.kt
│ │ │ ├── EpisodesDao.kt
│ │ │ ├── EpisodesSyncLogDao.kt
│ │ │ ├── MovieCollectionsDao.kt
│ │ │ ├── MovieCollectionsItemsDao.kt
│ │ │ ├── MovieImagesDao.kt
│ │ │ ├── MovieRatingsDao.kt
│ │ │ ├── MovieStreamingsDao.kt
│ │ │ ├── MovieTranslationsDao.kt
│ │ │ ├── MoviesDao.kt
│ │ │ ├── MoviesSyncLogDao.kt
│ │ │ ├── MyMoviesDao.kt
│ │ │ ├── MyShowsDao.kt
│ │ │ ├── NewsDao.kt
│ │ │ ├── PeopleCreditsDao.kt
│ │ │ ├── PeopleDao.kt
│ │ │ ├── PeopleImagesDao.kt
│ │ │ ├── PeopleShowsMoviesDao.kt
│ │ │ ├── RatingsDao.kt
│ │ │ ├── RecentSearchDao.kt
│ │ │ ├── RelatedMoviesDao.kt
│ │ │ ├── RelatedShowsDao.kt
│ │ │ ├── SeasonsDao.kt
│ │ │ ├── SettingsDao.kt
│ │ │ ├── ShowImagesDao.kt
│ │ │ ├── ShowRatingsDao.kt
│ │ │ ├── ShowStreamingsDao.kt
│ │ │ ├── ShowTranslationsDao.kt
│ │ │ ├── ShowsDao.kt
│ │ │ ├── TraktSyncLogDao.kt
│ │ │ ├── TraktSyncQueueDao.kt
│ │ │ ├── TranslationsMoviesSyncLogDao.kt
│ │ │ ├── TranslationsSyncLogDao.kt
│ │ │ ├── UserDao.kt
│ │ │ ├── WatchlistMoviesDao.kt
│ │ │ └── WatchlistShowsDao.kt
│ │ ├── migrations/
│ │ │ └── Migrations.kt
│ │ └── model/
│ │ ├── ArchiveMovie.kt
│ │ ├── ArchiveShow.kt
│ │ ├── CustomImage.kt
│ │ ├── CustomList.kt
│ │ ├── CustomListItem.kt
│ │ ├── DiscoverMovie.kt
│ │ ├── DiscoverShow.kt
│ │ ├── Episode.kt
│ │ ├── EpisodeTranslation.kt
│ │ ├── EpisodesSyncLog.kt
│ │ ├── Movie.kt
│ │ ├── MovieCollection.kt
│ │ ├── MovieCollectionItem.kt
│ │ ├── MovieImage.kt
│ │ ├── MovieRatings.kt
│ │ ├── MovieStreaming.kt
│ │ ├── MovieTranslation.kt
│ │ ├── MoviesSyncLog.kt
│ │ ├── MyMovie.kt
│ │ ├── MyShow.kt
│ │ ├── News.kt
│ │ ├── Person.kt
│ │ ├── PersonCredits.kt
│ │ ├── PersonImage.kt
│ │ ├── PersonShowMovie.kt
│ │ ├── Rating.kt
│ │ ├── RecentSearch.kt
│ │ ├── RelatedMovie.kt
│ │ ├── RelatedShow.kt
│ │ ├── Season.kt
│ │ ├── Settings.kt
│ │ ├── Show.kt
│ │ ├── ShowImage.kt
│ │ ├── ShowRatings.kt
│ │ ├── ShowStreaming.kt
│ │ ├── ShowTranslation.kt
│ │ ├── TraktSyncLog.kt
│ │ ├── TraktSyncQueue.kt
│ │ ├── TranslationsMoviesSyncLog.kt
│ │ ├── TranslationsSyncLog.kt
│ │ ├── User.kt
│ │ ├── WatchlistMovie.kt
│ │ └── WatchlistShow.kt
│ ├── di/
│ │ ├── LocalDataModule.kt
│ │ ├── SourcesModule.kt
│ │ └── StorageModule.kt
│ ├── sources/
│ │ ├── ArchiveMoviesLocalDataSource.kt
│ │ ├── ArchiveShowsLocalDataSource.kt
│ │ ├── CustomImagesLocalDataSource.kt
│ │ ├── CustomListsItemsLocalDataSource.kt
│ │ ├── CustomListsLocalDataSource.kt
│ │ ├── DiscoverMoviesLocalDataSource.kt
│ │ ├── DiscoverShowsLocalDataSource.kt
│ │ ├── EpisodeTranslationsLocalDataSource.kt
│ │ ├── EpisodesLocalDataSource.kt
│ │ ├── EpisodesSyncLogLocalDataSource.kt
│ │ ├── MovieCollectionsItemsLocalDataSource.kt
│ │ ├── MovieCollectionsLocalDataSource.kt
│ │ ├── MovieImagesLocalDataSource.kt
│ │ ├── MovieRatingsLocalDataSource.kt
│ │ ├── MovieStreamingsLocalDataSource.kt
│ │ ├── MovieTranslationsLocalDataSource.kt
│ │ ├── MoviesLocalDataSource.kt
│ │ ├── MoviesSyncLogLocalDataSource.kt
│ │ ├── MyMoviesLocalDataSource.kt
│ │ ├── MyShowsLocalDataSource.kt
│ │ ├── NewsLocalDataSource.kt
│ │ ├── PeopleCreditsLocalDataSource.kt
│ │ ├── PeopleImagesLocalDataSource.kt
│ │ ├── PeopleLocalDataSource.kt
│ │ ├── PeopleShowsMoviesLocalDataSource.kt
│ │ ├── RatingsLocalDataSource.kt
│ │ ├── RecentSearchLocalDataSource.kt
│ │ ├── RelatedMoviesLocalDataSource.kt
│ │ ├── RelatedShowsLocalDataSource.kt
│ │ ├── SeasonsLocalDataSource.kt
│ │ ├── SettingsLocalDataSource.kt
│ │ ├── ShowImagesLocalDataSource.kt
│ │ ├── ShowRatingsLocalDataSource.kt
│ │ ├── ShowStreamingsLocalDataSource.kt
│ │ ├── ShowTranslationsLocalDataSource.kt
│ │ ├── ShowsLocalDataSource.kt
│ │ ├── TraktSyncLogLocalDataSource.kt
│ │ ├── TraktSyncQueueLocalDataSource.kt
│ │ ├── TranslationsMoviesSyncLogLocalDataSource.kt
│ │ ├── TranslationsShowsSyncLogLocalDataSource.kt
│ │ ├── UserLocalDataSource.kt
│ │ ├── WatchlistMoviesLocalDataSource.kt
│ │ └── WatchlistShowsLocalDataSource.kt
│ └── utilities/
│ └── TransactionsProvider.kt
├── data-remote/
│ ├── .gitignore
│ ├── build.gradle
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── data_remote/
│ ├── Config.kt
│ ├── RemoteDataSource.kt
│ ├── aws/
│ │ ├── AwsRemoteDataSource.kt
│ │ ├── api/
│ │ │ ├── AwsApi.kt
│ │ │ └── AwsService.kt
│ │ └── model/
│ │ ├── AwsImage.kt
│ │ └── AwsImagesList.kt
│ ├── di/
│ │ └── module/
│ │ ├── AwsModule.kt
│ │ ├── OkHttpModule.kt
│ │ ├── OmdbModule.kt
│ │ ├── PreferencesModule.kt
│ │ ├── RedditModule.kt
│ │ ├── RemoteDataModule.kt
│ │ ├── RetrofitModule.kt
│ │ ├── TmdbModule.kt
│ │ └── TraktModule.kt
│ ├── omdb/
│ │ ├── OmdbInterceptor.kt
│ │ ├── OmdbRemoteDataSource.kt
│ │ ├── api/
│ │ │ ├── OmdbApi.kt
│ │ │ └── OmdbService.kt
│ │ └── model/
│ │ └── OmdbResult.kt
│ ├── reddit/
│ │ ├── RedditRemoteDataSource.kt
│ │ ├── api/
│ │ │ ├── RedditApi.kt
│ │ │ ├── RedditAuthApi.kt
│ │ │ ├── RedditListingApi.kt
│ │ │ └── RedditService.kt
│ │ └── model/
│ │ ├── RedditAuthResponse.kt
│ │ ├── RedditData.kt
│ │ ├── RedditDataItem.kt
│ │ ├── RedditItem.kt
│ │ └── RedditResponse.kt
│ ├── tmdb/
│ │ ├── TmdbInterceptor.kt
│ │ ├── TmdbRemoteDataSource.kt
│ │ ├── api/
│ │ │ ├── TmdbApi.kt
│ │ │ └── TmdbService.kt
│ │ └── model/
│ │ ├── TmdbImage.kt
│ │ ├── TmdbImages.kt
│ │ ├── TmdbPeople.kt
│ │ ├── TmdbPerson.kt
│ │ ├── TmdbStreamingCountry.kt
│ │ ├── TmdbStreamingService.kt
│ │ ├── TmdbStreamings.kt
│ │ ├── TmdbTranslation.kt
│ │ └── TmdbTranslationResponse.kt
│ ├── token/
│ │ ├── TokenProvider.kt
│ │ └── TraktTokenProvider.kt
│ └── trakt/
│ ├── TraktRemoteDataSource.kt
│ ├── api/
│ │ ├── TraktApi.kt
│ │ └── service/
│ │ ├── TraktAuthService.kt
│ │ ├── TraktCommentsService.kt
│ │ ├── TraktMoviesService.kt
│ │ ├── TraktPeopleService.kt
│ │ ├── TraktSearchService.kt
│ │ ├── TraktShowsService.kt
│ │ ├── TraktSyncService.kt
│ │ └── TraktUsersService.kt
│ ├── interceptors/
│ │ ├── TraktAuthenticator.kt
│ │ ├── TraktAuthorizationInterceptor.kt
│ │ ├── TraktHeadersInterceptor.kt
│ │ ├── TraktRefreshTokenInterceptor.kt
│ │ └── TraktRetryInterceptor.kt
│ └── model/
│ ├── AirTime.kt
│ ├── Comment.kt
│ ├── CustomList.kt
│ ├── Episode.kt
│ ├── HiddenItem.kt
│ ├── Ids.kt
│ ├── Movie.kt
│ ├── MovieCollection.kt
│ ├── MovieCollectionItem.kt
│ ├── MovieResult.kt
│ ├── OAuthResponse.kt
│ ├── Person.kt
│ ├── PersonCredit.kt
│ ├── PersonCreditsResult.kt
│ ├── RatingResultMovie.kt
│ ├── RatingResultShow.kt
│ ├── RatingResultValue.kt
│ ├── SearchResult.kt
│ ├── Season.kt
│ ├── SeasonTranslation.kt
│ ├── Show.kt
│ ├── ShowResult.kt
│ ├── SyncExportItem.kt
│ ├── SyncExportRequest.kt
│ ├── SyncExportResult.kt
│ ├── SyncItem.kt
│ ├── TraktUser.kt
│ ├── Translation.kt
│ ├── User.kt
│ └── request/
│ ├── CommentRequest.kt
│ ├── CreateListRequest.kt
│ ├── OAuthRefreshRequest.kt
│ ├── OAuthRequest.kt
│ ├── OAuthRevokeRequest.kt
│ └── RatingRequest.kt
├── gradle/
│ ├── libs.versions.toml
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── repository/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ └── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── repository/
│ │ ├── CommentsRepository.kt
│ │ ├── EpisodesManager.kt
│ │ ├── ListsRepository.kt
│ │ ├── NewsRepository.kt
│ │ ├── OnHoldItemsRepository.kt
│ │ ├── PeopleRepository.kt
│ │ ├── PinnedItemsRepository.kt
│ │ ├── RatingsRepository.kt
│ │ ├── StreamingsRepository.kt
│ │ ├── TranslationsRepository.kt
│ │ ├── UserRedditManager.kt
│ │ ├── UserTraktManager.kt
│ │ ├── images/
│ │ │ ├── EpisodeImagesProvider.kt
│ │ │ ├── MovieImagesProvider.kt
│ │ │ ├── PeopleImagesProvider.kt
│ │ │ └── ShowImagesProvider.kt
│ │ ├── mappers/
│ │ │ ├── CollectionMapper.kt
│ │ │ ├── CommentMapper.kt
│ │ │ ├── CustomListMapper.kt
│ │ │ ├── EpisodeMapper.kt
│ │ │ ├── IdsMapper.kt
│ │ │ ├── ImageMapper.kt
│ │ │ ├── Mappers.kt
│ │ │ ├── MovieMapper.kt
│ │ │ ├── NewsMapper.kt
│ │ │ ├── PersonMapper.kt
│ │ │ ├── RatingsMapper.kt
│ │ │ ├── SeasonMapper.kt
│ │ │ ├── SettingsMapper.kt
│ │ │ ├── ShowMapper.kt
│ │ │ ├── StreamingsMapper.kt
│ │ │ ├── TranslationMapper.kt
│ │ │ └── UserRatingsMapper.kt
│ │ ├── movies/
│ │ │ ├── DiscoverMoviesRepository.kt
│ │ │ ├── HiddenMoviesRepository.kt
│ │ │ ├── MovieCollectionsRepository.kt
│ │ │ ├── MovieDetailsRepository.kt
│ │ │ ├── MovieStreamingsRepository.kt
│ │ │ ├── MoviesRepository.kt
│ │ │ ├── MyMoviesRepository.kt
│ │ │ ├── RelatedMoviesRepository.kt
│ │ │ ├── WatchlistMoviesRepository.kt
│ │ │ └── ratings/
│ │ │ ├── MoviesExternalRatingsRepository.kt
│ │ │ └── MoviesRatingsRepository.kt
│ │ ├── settings/
│ │ │ ├── SettingsFiltersRepository.kt
│ │ │ ├── SettingsRepository.kt
│ │ │ ├── SettingsSortRepository.kt
│ │ │ ├── SettingsSpoilersRepository.kt
│ │ │ ├── SettingsViewModeRepository.kt
│ │ │ └── SettingsWidgetsRepository.kt
│ │ ├── shows/
│ │ │ ├── DiscoverShowsRepository.kt
│ │ │ ├── HiddenShowsRepository.kt
│ │ │ ├── MyShowsRepository.kt
│ │ │ ├── RelatedShowsRepository.kt
│ │ │ ├── ShowDetailsRepository.kt
│ │ │ ├── ShowStreamingsRepository.kt
│ │ │ ├── ShowsRepository.kt
│ │ │ ├── WatchlistShowsRepository.kt
│ │ │ └── ratings/
│ │ │ ├── ShowsExternalRatingsRepository.kt
│ │ │ └── ShowsRatingsRepository.kt
│ │ └── utilities/
│ │ └── PreferencesDelegates.kt
│ └── test/
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── repository/
│ ├── DiscoverShowsRepositoryTest.kt
│ ├── MyShowsRepositoryTest.kt
│ ├── PeopleRepositoryTest.kt
│ ├── RelatedShowsRepositoryTest.kt
│ ├── SettingsRepositoryTest.kt
│ ├── ShowDetailsRepositoryTest.kt
│ ├── WatchlistShowsRepositoryTest.kt
│ └── common/
│ └── BaseMockTest.kt
├── settings.gradle
├── ui-base/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_base/
│ │ ├── Analytics.kt
│ │ ├── BaseAdapter.kt
│ │ ├── BaseBottomSheetFragment.kt
│ │ ├── BaseFragment.kt
│ │ ├── BaseMovieAdapter.kt
│ │ ├── Logger.kt
│ │ ├── common/
│ │ │ ├── AppCountry.kt
│ │ │ ├── AppScopeProvider.kt
│ │ │ ├── FastLinearLayoutManager.kt
│ │ │ ├── ListItem.kt
│ │ │ ├── ListViewMode.kt
│ │ │ ├── MovieListItem.kt
│ │ │ ├── OnScrollResetListener.kt
│ │ │ ├── OnSearchClickListener.kt
│ │ │ ├── OnShowsMoviesSyncedListener.kt
│ │ │ ├── OnTabReselectedListener.kt
│ │ │ ├── OnTraktAuthorizeListener.kt
│ │ │ ├── SafeOnClickListener.kt
│ │ │ ├── WidgetsProvider.kt
│ │ │ ├── behaviour/
│ │ │ │ ├── ScrollableViewBehaviour.kt
│ │ │ │ └── SearchViewBehaviour.kt
│ │ │ ├── sheets/
│ │ │ │ ├── context_menu/
│ │ │ │ │ ├── ContextMenuBottomSheet.kt
│ │ │ │ │ ├── events/
│ │ │ │ │ │ ├── FinishUiEvent.kt
│ │ │ │ │ │ └── RemoveTraktUiEvent.kt
│ │ │ │ │ ├── movie/
│ │ │ │ │ │ ├── MovieContextMenuBottomSheet.kt
│ │ │ │ │ │ ├── MovieContextMenuUiState.kt
│ │ │ │ │ │ ├── MovieContextMenuViewModel.kt
│ │ │ │ │ │ ├── cases/
│ │ │ │ │ │ │ ├── MovieContextMenuHiddenCase.kt
│ │ │ │ │ │ │ ├── MovieContextMenuLoadItemCase.kt
│ │ │ │ │ │ │ ├── MovieContextMenuMyMoviesCase.kt
│ │ │ │ │ │ │ ├── MovieContextMenuPinnedCase.kt
│ │ │ │ │ │ │ └── MovieContextMenuWatchlistCase.kt
│ │ │ │ │ │ └── helpers/
│ │ │ │ │ │ └── MovieContextItem.kt
│ │ │ │ │ └── show/
│ │ │ │ │ ├── ShowContextMenuBottomSheet.kt
│ │ │ │ │ ├── ShowContextMenuUiState.kt
│ │ │ │ │ ├── ShowContextMenuViewModel.kt
│ │ │ │ │ ├── cases/
│ │ │ │ │ │ ├── ShowContextMenuHiddenCase.kt
│ │ │ │ │ │ ├── ShowContextMenuLoadItemCase.kt
│ │ │ │ │ │ ├── ShowContextMenuMyShowsCase.kt
│ │ │ │ │ │ ├── ShowContextMenuOnHoldCase.kt
│ │ │ │ │ │ ├── ShowContextMenuPinnedCase.kt
│ │ │ │ │ │ └── ShowContextMenuWatchlistCase.kt
│ │ │ │ │ └── helpers/
│ │ │ │ │ └── ShowContextItem.kt
│ │ │ │ ├── links/
│ │ │ │ │ ├── LinksBottomSheet.kt
│ │ │ │ │ ├── LinksViewModel.kt
│ │ │ │ │ └── views/
│ │ │ │ │ └── LinkItemView.kt
│ │ │ │ ├── ratings/
│ │ │ │ │ ├── RatingsBottomSheet.kt
│ │ │ │ │ ├── RatingsSheetViewModel.kt
│ │ │ │ │ ├── RatingsUiEvents.kt
│ │ │ │ │ ├── RatingsUiState.kt
│ │ │ │ │ └── cases/
│ │ │ │ │ ├── RatingsEpisodeCase.kt
│ │ │ │ │ ├── RatingsMovieCase.kt
│ │ │ │ │ ├── RatingsSeasonCase.kt
│ │ │ │ │ └── RatingsShowCase.kt
│ │ │ │ ├── remove_trakt/
│ │ │ │ │ ├── RemoveTraktBottomSheet.kt
│ │ │ │ │ ├── remove_trakt_hidden/
│ │ │ │ │ │ ├── RemoveTraktHiddenBottomSheet.kt
│ │ │ │ │ │ ├── RemoveTraktHiddenUiState.kt
│ │ │ │ │ │ ├── RemoveTraktHiddenViewModel.kt
│ │ │ │ │ │ └── cases/
│ │ │ │ │ │ └── RemoveTraktHiddenCase.kt
│ │ │ │ │ ├── remove_trakt_progress/
│ │ │ │ │ │ ├── RemoveTraktProgressBottomSheet.kt
│ │ │ │ │ │ ├── RemoveTraktProgressUiState.kt
│ │ │ │ │ │ ├── RemoveTraktProgressViewModel.kt
│ │ │ │ │ │ └── cases/
│ │ │ │ │ │ └── RemoveTraktProgressCase.kt
│ │ │ │ │ └── remove_trakt_watchlist/
│ │ │ │ │ ├── RemoveTraktWatchlistBottomSheet.kt
│ │ │ │ │ ├── RemoveTraktWatchlistUiState.kt
│ │ │ │ │ ├── RemoveTraktWatchlistViewModel.kt
│ │ │ │ │ └── cases/
│ │ │ │ │ └── RemoveTraktWatchlistCase.kt
│ │ │ │ └── sort_order/
│ │ │ │ ├── SortOrderBottomSheet.kt
│ │ │ │ └── views/
│ │ │ │ └── SortOrderItemView.kt
│ │ │ └── views/
│ │ │ ├── EmptySearchView.kt
│ │ │ ├── FoldableTextView.kt
│ │ │ ├── ModeTabsView.kt
│ │ │ ├── MovieView.kt
│ │ │ ├── PremiumAdView.kt
│ │ │ ├── RateValueView.kt
│ │ │ ├── RatingsStripView.kt
│ │ │ ├── ScrollableImageView.kt
│ │ │ ├── ScrollableTabLayout.kt
│ │ │ ├── SearchLocalView.kt
│ │ │ ├── SearchView.kt
│ │ │ ├── SecretTextView.kt
│ │ │ ├── ShowView.kt
│ │ │ └── tips/
│ │ │ ├── TipOverlayView.kt
│ │ │ └── TipView.kt
│ │ ├── dates/
│ │ │ ├── AppDateFormat.kt
│ │ │ └── DateFormatProvider.kt
│ │ ├── events/
│ │ │ ├── Event.kt
│ │ │ └── EventsManager.kt
│ │ ├── fcm/
│ │ │ └── NotificationChannel.kt
│ │ ├── network/
│ │ │ ├── NetworkCallbackAdapter.kt
│ │ │ └── NetworkStatusProvider.kt
│ │ ├── notifications/
│ │ │ ├── AnnouncementManager.kt
│ │ │ ├── AnnouncementWorker.kt
│ │ │ └── schedulers/
│ │ │ ├── MovieAnnouncementScheduler.kt
│ │ │ └── ShowAnnouncementScheduler.kt
│ │ ├── sync/
│ │ │ ├── ShowsMoviesSyncWorker.kt
│ │ │ └── runners/
│ │ │ ├── MoviesSyncRunner.kt
│ │ │ └── ShowsSyncRunner.kt
│ │ ├── trakt/
│ │ │ ├── TraktNotificationWorker.kt
│ │ │ ├── TraktSyncRunner.kt
│ │ │ ├── TraktSyncWorker.kt
│ │ │ ├── exports/
│ │ │ │ ├── TraktExportListsRunner.kt
│ │ │ │ ├── TraktExportWatchedRunner.kt
│ │ │ │ └── TraktExportWatchlistRunner.kt
│ │ │ ├── imports/
│ │ │ │ ├── TraktImportListsRunner.kt
│ │ │ │ ├── TraktImportWatchedRunner.kt
│ │ │ │ └── TraktImportWatchlistRunner.kt
│ │ │ └── quicksync/
│ │ │ ├── QuickSyncManager.kt
│ │ │ ├── QuickSyncWorker.kt
│ │ │ └── runners/
│ │ │ ├── QuickSyncListsRunner.kt
│ │ │ ├── QuickSyncRunner.kt
│ │ │ └── cases/
│ │ │ ├── QuickSyncDuplicateEpisodesCase.kt
│ │ │ └── QuickSyncDuplicateMoviesCase.kt
│ │ ├── utilities/
│ │ │ ├── DurationPrinter.kt
│ │ │ ├── FragmentViewBindingDelegate.kt
│ │ │ ├── ModeHost.kt
│ │ │ ├── MoviesStatusHost.kt
│ │ │ ├── NavigationHost.kt
│ │ │ ├── NetworkIconProvider.kt
│ │ │ ├── SnackbarHost.kt
│ │ │ ├── TipsHost.kt
│ │ │ ├── events/
│ │ │ │ ├── Event.kt
│ │ │ │ └── MessageEvent.kt
│ │ │ ├── extensions/
│ │ │ │ ├── BuildExtensions.kt
│ │ │ │ ├── BundleExtensions.kt
│ │ │ │ ├── ContextExtensions.kt
│ │ │ │ ├── Extensions.kt
│ │ │ │ ├── FlowCombineExtensions.kt
│ │ │ │ ├── GlideExtensions.kt
│ │ │ │ ├── LayoutExtensions.kt
│ │ │ │ ├── LifecycleExtensions.kt
│ │ │ │ ├── SnackbarExtensions.kt
│ │ │ │ ├── UiExtensions.kt
│ │ │ │ ├── ViewModelExtensions.kt
│ │ │ │ └── WebExtensions.kt
│ │ │ └── ui/
│ │ │ └── EqualSpacingItemDecoration.kt
│ │ └── viewmodel/
│ │ ├── ChannelsDelegate.kt
│ │ └── DefaultChannelsDelegate.kt
│ └── res/
│ ├── anim/
│ │ ├── anim_recycler_fall_down.xml
│ │ ├── anim_recycler_fall_down_fast.xml
│ │ ├── anim_recycler_fall_down_item.xml
│ │ ├── anim_recycler_fall_down_item_fast.xml
│ │ ├── anim_slide_in_from_left.xml
│ │ ├── anim_slide_in_from_right.xml
│ │ ├── anim_slide_out_from_left.xml
│ │ └── anim_slide_out_from_right.xml
│ ├── anim-ar/
│ │ ├── anim_slide_in_from_left.xml
│ │ ├── anim_slide_in_from_right.xml
│ │ ├── anim_slide_out_from_left.xml
│ │ └── anim_slide_out_from_right.xml
│ ├── color/
│ │ ├── selector_chip_background.xml
│ │ ├── selector_chip_stroke.xml
│ │ ├── selector_chip_text.xml
│ │ ├── selector_discover_chip_background.xml
│ │ ├── selector_discover_chip_text.xml
│ │ ├── selector_main_button.xml
│ │ └── selector_main_checkbox.xml
│ ├── color-notnight/
│ │ ├── selector_chip_background.xml
│ │ ├── selector_chip_stroke.xml
│ │ └── selector_main_checkbox.xml
│ ├── drawable/
│ │ ├── bg_badge.xml
│ │ ├── bg_bottom_sheet.xml
│ │ ├── bg_dialog.xml
│ │ ├── bg_filters_sheet.xml
│ │ ├── bg_item_menu_elevation.xml
│ │ ├── bg_item_menu_placeholder.xml
│ │ ├── bg_link_item.xml
│ │ ├── bg_link_item_ripple.xml
│ │ ├── bg_media_view_elevation.xml
│ │ ├── bg_media_view_elevation_card.xml
│ │ ├── bg_media_view_placeholder.xml
│ │ ├── bg_media_view_ripple.xml
│ │ ├── bg_premium_ad.xml
│ │ ├── bg_snackbar_error.xml
│ │ ├── bg_snackbar_info.xml
│ │ ├── bg_sort_item_badge.xml
│ │ ├── bg_text_on_surface.xml
│ │ ├── bg_tip_view.xml
│ │ ├── divider_item_menu.xml
│ │ ├── ic_abc.xml
│ │ ├── ic_amc.xml
│ │ ├── ic_anim_search_to_close.xml
│ │ ├── ic_arrow_alt.xml
│ │ ├── ic_arrow_alt_down.xml
│ │ ├── ic_arrow_alt_up.xml
│ │ ├── ic_arrow_back.xml
│ │ ├── ic_arrow_right.xml
│ │ ├── ic_bookmark.xml
│ │ ├── ic_bookmark_full.xml
│ │ ├── ic_calendar.xml
│ │ ├── ic_check.xml
│ │ ├── ic_check_small.xml
│ │ ├── ic_circle.xml
│ │ ├── ic_clock.xml
│ │ ├── ic_clock_compact.xml
│ │ ├── ic_clock_small.xml
│ │ ├── ic_close.xml
│ │ ├── ic_comment.xml
│ │ ├── ic_crown.xml
│ │ ├── ic_crown_small.xml
│ │ ├── ic_custom_image.xml
│ │ ├── ic_delete.xml
│ │ ├── ic_duckduck.xml
│ │ ├── ic_eye.xml
│ │ ├── ic_eye_no.xml
│ │ ├── ic_film.xml
│ │ ├── ic_giphy.xml
│ │ ├── ic_github.xml
│ │ ├── ic_google.xml
│ │ ├── ic_history.xml
│ │ ├── ic_imdb.xml
│ │ ├── ic_info.xml
│ │ ├── ic_insight.xml
│ │ ├── ic_link.xml
│ │ ├── ic_link_color.xml
│ │ ├── ic_list_alt.xml
│ │ ├── ic_lists.xml
│ │ ├── ic_news.xml
│ │ ├── ic_notification_bell.xml
│ │ ├── ic_open_browser.xml
│ │ ├── ic_pause.xml
│ │ ├── ic_person_outline.xml
│ │ ├── ic_pin.xml
│ │ ├── ic_play.xml
│ │ ├── ic_remove_list.xml
│ │ ├── ic_search.xml
│ │ ├── ic_settings.xml
│ │ ├── ic_share.xml
│ │ ├── ic_star.xml
│ │ ├── ic_star_empty.xml
│ │ ├── ic_star_small.xml
│ │ ├── ic_stars_round.xml
│ │ ├── ic_television.xml
│ │ ├── ic_tmdb.xml
│ │ ├── ic_trakt.xml
│ │ ├── ic_twitter.xml
│ │ ├── ic_view_grid.xml
│ │ ├── ic_view_list.xml
│ │ ├── ic_wikipedia.xml
│ │ └── ic_youtube.xml
│ ├── drawable-ar/
│ │ └── ic_arrow_back.xml
│ ├── drawable-notnight/
│ │ ├── ic_github.xml
│ │ └── ic_wikipedia.xml
│ ├── layout/
│ │ ├── view_context_menu.xml
│ │ ├── view_links.xml
│ │ ├── view_links_item.xml
│ │ ├── view_mode_tabs.xml
│ │ ├── view_premium_ad.xml
│ │ ├── view_premium_ad_list.xml
│ │ ├── view_rate_sheet.xml
│ │ ├── view_rate_value.xml
│ │ ├── view_ratings_strip.xml
│ │ ├── view_remove_trakt_hidden.xml
│ │ ├── view_remove_trakt_progress.xml
│ │ ├── view_remove_trakt_watchlist.xml
│ │ ├── view_search.xml
│ │ ├── view_search_empty.xml
│ │ ├── view_search_local.xml
│ │ ├── view_sort_order.xml
│ │ ├── view_sort_order_item.xml
│ │ ├── view_tip.xml
│ │ └── view_tip_overlay.xml
│ ├── layout-sw600dp/
│ │ └── view_ratings_strip.xml
│ ├── values/
│ │ ├── attrs.xml
│ │ ├── bool.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── misc.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-notnight/
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── misc.xml
│ │ └── styles.xml
│ ├── values-notnight-v27/
│ │ └── styles.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ ├── bool.xml
│ │ ├── dimens.xml
│ │ └── styles.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-comments/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_comments/
│ │ ├── CommentItemDiffCallback.kt
│ │ ├── CommentView.kt
│ │ ├── CommentsAdapter.kt
│ │ ├── fragment/
│ │ │ ├── CommentsFragment.kt
│ │ │ ├── CommentsUiState.kt
│ │ │ ├── CommentsViewModel.kt
│ │ │ └── cases/
│ │ │ ├── DeleteCommentCase.kt
│ │ │ ├── LoadCommentsCase.kt
│ │ │ └── LoadRepliesCase.kt
│ │ ├── post/
│ │ │ ├── PostCommentBottomSheet.kt
│ │ │ ├── PostCommentUiState.kt
│ │ │ └── PostCommentViewModel.kt
│ │ └── utilities/
│ │ └── Extensions.kt
│ └── res/
│ ├── color/
│ │ ├── selector_comment_button.xml
│ │ └── selector_comment_input.xml
│ ├── drawable/
│ │ ├── bg_comment_rating.xml
│ │ ├── divider_comments_list.xml
│ │ ├── ic_add_comment.xml
│ │ ├── ic_delete.xml
│ │ └── ic_reply.xml
│ ├── layout/
│ │ ├── fragment_comments.xml
│ │ ├── view_comment.xml
│ │ └── view_post_comment.xml
│ ├── layout-sw600dp/
│ │ └── view_comment.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-discover/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_discover/
│ │ │ ├── DiscoverFragment.kt
│ │ │ ├── DiscoverUiState.kt
│ │ │ ├── DiscoverViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── DiscoverFiltersCase.kt
│ │ │ │ ├── DiscoverShowsCase.kt
│ │ │ │ └── DiscoverTwitterCase.kt
│ │ │ ├── di/
│ │ │ │ └── DiscoverModule.kt
│ │ │ ├── filters/
│ │ │ │ ├── feed/
│ │ │ │ │ ├── DiscoverFiltersFeedBottomSheet.kt
│ │ │ │ │ ├── DiscoverFiltersFeedUiEvent.kt
│ │ │ │ │ ├── DiscoverFiltersFeedUiState.kt
│ │ │ │ │ └── DiscoverFiltersFeedViewModel.kt
│ │ │ │ ├── genres/
│ │ │ │ │ ├── DiscoverFiltersGenresBottomSheet.kt
│ │ │ │ │ ├── DiscoverFiltersGenresUiEvent.kt
│ │ │ │ │ ├── DiscoverFiltersGenresUiState.kt
│ │ │ │ │ └── DiscoverFiltersGenresViewModel.kt
│ │ │ │ ├── networks/
│ │ │ │ │ ├── DiscoverFiltersNetworksBottomSheet.kt
│ │ │ │ │ ├── DiscoverFiltersNetworksUiEvent.kt
│ │ │ │ │ ├── DiscoverFiltersNetworksUiState.kt
│ │ │ │ │ └── DiscoverFiltersNetworksViewModel.kt
│ │ │ │ └── views/
│ │ │ │ └── DiscoverFiltersView.kt
│ │ │ ├── helpers/
│ │ │ │ ├── DiscoverLayoutManagerProvider.kt
│ │ │ │ └── itemtype/
│ │ │ │ ├── ImageTypeProvider.kt
│ │ │ │ ├── PhoneImageTypeProvider.kt
│ │ │ │ └── TabletImageTypeProvider.kt
│ │ │ ├── recycler/
│ │ │ │ ├── DiscoverAdapter.kt
│ │ │ │ ├── DiscoverItemDiffCallback.kt
│ │ │ │ └── DiscoverListItem.kt
│ │ │ └── views/
│ │ │ ├── ShowFanartView.kt
│ │ │ ├── ShowPosterView.kt
│ │ │ ├── ShowPremiumView.kt
│ │ │ └── ShowTwitterView.kt
│ │ └── res/
│ │ ├── color/
│ │ │ └── selector_filters_button.xml
│ │ ├── drawable/
│ │ │ ├── bg_twitter.xml
│ │ │ └── bg_twitter_cancel.xml
│ │ ├── layout/
│ │ │ ├── fragment_discover.xml
│ │ │ ├── view_discover_filters.xml
│ │ │ ├── view_discover_filters_feed.xml
│ │ │ ├── view_discover_filters_genres.xml
│ │ │ ├── view_discover_filters_networks.xml
│ │ │ ├── view_show_fanart.xml
│ │ │ ├── view_show_poster.xml
│ │ │ ├── view_show_premium.xml
│ │ │ └── view_show_twitter.xml
│ │ ├── values/
│ │ │ └── strings.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ ├── BaseMockTest.kt
│ ├── TestData.kt
│ └── com/
│ └── michaldrabik/
│ └── ui_discover/
│ └── DiscoverViewModelTest.kt
├── ui-discover-movies/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_discover_movies/
│ │ ├── DiscoverMoviesFragment.kt
│ │ ├── DiscoverMoviesUiState.kt
│ │ ├── DiscoverMoviesViewModel.kt
│ │ ├── cases/
│ │ │ ├── DiscoverFiltersCase.kt
│ │ │ └── DiscoverMoviesCase.kt
│ │ ├── di/
│ │ │ └── DiscoverMoviesModule.kt
│ │ ├── filters/
│ │ │ ├── feed/
│ │ │ │ ├── DiscoverMoviesFiltersFeedBottomSheet.kt
│ │ │ │ ├── DiscoverMoviesFiltersFeedUiEvent.kt
│ │ │ │ ├── DiscoverMoviesFiltersFeedUiState.kt
│ │ │ │ └── DiscoverMoviesFiltersFeedViewModel.kt
│ │ │ ├── genres/
│ │ │ │ ├── DiscoverMoviesFiltersGenresBottomSheet.kt
│ │ │ │ ├── DiscoverMoviesFiltersGenresUiEvent.kt
│ │ │ │ ├── DiscoverMoviesFiltersGenresUiState.kt
│ │ │ │ └── DiscoverMoviesFiltersGenresViewModel.kt
│ │ │ └── views/
│ │ │ └── DiscoverMoviesFiltersView.kt
│ │ ├── helpers/
│ │ │ ├── DiscoverMoviesLayoutManagerProvider.kt
│ │ │ └── itemtype/
│ │ │ ├── ImageTypeProvider.kt
│ │ │ ├── PhoneImageTypeProvider.kt
│ │ │ └── TabletImageTypeProvider.kt
│ │ ├── recycler/
│ │ │ ├── DiscoverMovieItemDiffCallback.kt
│ │ │ ├── DiscoverMovieListItem.kt
│ │ │ └── DiscoverMoviesAdapter.kt
│ │ └── views/
│ │ ├── MovieFanartView.kt
│ │ ├── MoviePosterView.kt
│ │ └── MoviePremiumView.kt
│ └── res/
│ ├── layout/
│ │ ├── fragment_discover_movies.xml
│ │ ├── view_discover_movies_filters.xml
│ │ ├── view_discover_movies_filters_feed.xml
│ │ ├── view_discover_movies_filters_genres.xml
│ │ ├── view_movie_fanart.xml
│ │ ├── view_movie_poster.xml
│ │ └── view_movie_premium.xml
│ ├── values/
│ │ └── strings.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-episodes/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_episodes/
│ │ └── details/
│ │ ├── EpisodeDetailsBottomSheet.kt
│ │ ├── EpisodeDetailsUiState.kt
│ │ ├── EpisodeDetailsViewModel.kt
│ │ └── cases/
│ │ ├── EpisodeDetailsSeasonCase.kt
│ │ └── EpisodeDetailsWatchedCase.kt
│ └── res/
│ ├── color/
│ │ └── selector_comment_button.xml
│ ├── drawable/
│ │ ├── bg_bottom_sheet_placeholder.xml
│ │ └── divider_comments_list.xml
│ ├── layout/
│ │ └── view_episode_details.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ ├── integers.xml
│ │ └── strings.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ ├── integers.xml
│ │ └── strings.xml
│ ├── values-es/
│ │ ├── integers.xml
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ ├── integers.xml
│ │ └── strings.xml
│ ├── values-it/
│ │ ├── integers.xml
│ │ └── strings.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ ├── integers.xml
│ │ └── strings.xml
│ ├── values-ru/
│ │ ├── integers.xml
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ ├── integers.xml
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-gallery/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_gallery/
│ │ ├── custom/
│ │ │ ├── CustomImagesBottomSheet.kt
│ │ │ ├── CustomImagesUiState.kt
│ │ │ └── CustomImagesViewModel.kt
│ │ └── fanart/
│ │ ├── ArtGalleryFragment.kt
│ │ ├── ArtGalleryUiState.kt
│ │ ├── ArtGalleryViewModel.kt
│ │ ├── cases/
│ │ │ └── ArtLoadImagesCase.kt
│ │ └── recycler/
│ │ ├── ArtGalleryAdapter.kt
│ │ ├── ImageItemDiffCallback.kt
│ │ └── views/
│ │ ├── ArtGalleryFanartView.kt
│ │ ├── ArtGalleryPosterView.kt
│ │ └── ArtGalleryUrlView.kt
│ └── res/
│ ├── color/
│ │ └── selector_url_input_layout.xml
│ ├── drawable/
│ │ ├── bg_custom_image_frame.xml
│ │ ├── bg_delete_circle.xml
│ │ ├── bg_indicator_circle.xml
│ │ ├── ic_custom_image2x.xml
│ │ ├── ic_delete.xml
│ │ └── ic_download.xml
│ ├── drawable-notnight/
│ │ └── bg_indicator_circle.xml
│ ├── layout/
│ │ ├── fragment_art_gallery.xml
│ │ ├── view_custom_images.xml
│ │ ├── view_gallery_fanart_image.xml
│ │ ├── view_gallery_poster_image.xml
│ │ └── view_gallery_url_dialog.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-notnight/
│ │ └── styles.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-lists/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_lists/
│ │ ├── create/
│ │ │ ├── CreateListBottomSheet.kt
│ │ │ ├── CreateListUiState.kt
│ │ │ ├── CreateListViewModel.kt
│ │ │ └── cases/
│ │ │ ├── CreateListCase.kt
│ │ │ └── ListDetailsCase.kt
│ │ ├── details/
│ │ │ ├── ListDetailsFragment.kt
│ │ │ ├── ListDetailsUiEvents.kt
│ │ │ ├── ListDetailsUiState.kt
│ │ │ ├── ListDetailsViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── ListDetailsItemsCase.kt
│ │ │ │ ├── ListDetailsMainCase.kt
│ │ │ │ ├── ListDetailsSortCase.kt
│ │ │ │ ├── ListDetailsTipsCase.kt
│ │ │ │ ├── ListDetailsTranslationsCase.kt
│ │ │ │ └── ListDetailsViewModeCase.kt
│ │ │ ├── helpers/
│ │ │ │ ├── ListDetailsSorter.kt
│ │ │ │ ├── ListItemDragListener.kt
│ │ │ │ ├── ListItemSwipeListener.kt
│ │ │ │ ├── ReorderListCallback.kt
│ │ │ │ └── ReorderListCallbackAdapter.kt
│ │ │ ├── recycler/
│ │ │ │ ├── ListDetailsAdapter.kt
│ │ │ │ ├── ListDetailsDiffCallback.kt
│ │ │ │ ├── ListDetailsItem.kt
│ │ │ │ └── helpers/
│ │ │ │ ├── ListDetailsGridItemDecoration.kt
│ │ │ │ ├── ListDetailsLayoutManagerProvider.kt
│ │ │ │ └── ListDetailsListItemDecoration.kt
│ │ │ └── views/
│ │ │ ├── ListDetailsDeleteConfirmView.kt
│ │ │ ├── ListDetailsFilterView.kt
│ │ │ ├── ListDetailsItemView.kt
│ │ │ ├── ListDetailsMovieItemView.kt
│ │ │ ├── ListDetailsShowItemView.kt
│ │ │ ├── compact/
│ │ │ │ ├── ListDetailsCompactMovieItemView.kt
│ │ │ │ └── ListDetailsCompactShowItemView.kt
│ │ │ └── grid/
│ │ │ ├── ListDetailsGridItemView.kt
│ │ │ └── ListDetailsGridTitleItemView.kt
│ │ ├── lists/
│ │ │ ├── ListsFragment.kt
│ │ │ ├── ListsUiState.kt
│ │ │ ├── ListsViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── MainListsCase.kt
│ │ │ │ └── SortOrderListsCase.kt
│ │ │ ├── helpers/
│ │ │ │ ├── ListsItemImage.kt
│ │ │ │ ├── ListsLayoutManagerProvider.kt
│ │ │ │ └── ListsSorter.kt
│ │ │ ├── recycler/
│ │ │ │ ├── ListsAdapter.kt
│ │ │ │ ├── ListsItem.kt
│ │ │ │ └── ListsItemDiffCallback.kt
│ │ │ └── views/
│ │ │ ├── ListsFiltersView.kt
│ │ │ ├── ListsItemView.kt
│ │ │ └── ListsTripleImageView.kt
│ │ └── manage/
│ │ ├── ManageListsBottomSheet.kt
│ │ ├── ManageListsUiState.kt
│ │ ├── ManageListsViewModel.kt
│ │ ├── cases/
│ │ │ └── ManageListsCase.kt
│ │ ├── recycler/
│ │ │ ├── ManageListsAdapter.kt
│ │ │ ├── ManageListsItem.kt
│ │ │ └── ManageListsItemDiffCallback.kt
│ │ └── views/
│ │ └── ManageListsItemView.kt
│ └── res/
│ ├── color/
│ │ ├── selector_create_list_button.xml
│ │ ├── selector_create_list_input.xml
│ │ ├── selector_list_chip_background.xml
│ │ └── selector_list_chip_text.xml
│ ├── color-notnight/
│ │ └── selector_list_chip_background.xml
│ ├── drawable/
│ │ ├── bg_rank.xml
│ │ ├── ic_edit.xml
│ │ ├── ic_handle.xml
│ │ ├── ic_list_create.xml
│ │ ├── ic_more.xml
│ │ └── ic_reorder.xml
│ ├── layout/
│ │ ├── fragment_list_details.xml
│ │ ├── fragment_lists.xml
│ │ ├── layout_list_details_empty.xml
│ │ ├── layout_list_details_item_grid.xml
│ │ ├── layout_lists_empty.xml
│ │ ├── layout_manage_lists_empty.xml
│ │ ├── view_create_list.xml
│ │ ├── view_list_delete_confirm.xml
│ │ ├── view_list_details_filters.xml
│ │ ├── view_list_details_item_grid.xml
│ │ ├── view_list_details_item_grid_title.xml
│ │ ├── view_list_details_movie_item.xml
│ │ ├── view_list_details_movie_item_compact.xml
│ │ ├── view_list_details_show_item.xml
│ │ ├── view_list_details_show_item_compact.xml
│ │ ├── view_lists_filters.xml
│ │ ├── view_lists_item.xml
│ │ ├── view_manage_lists.xml
│ │ ├── view_manage_lists_item.xml
│ │ └── view_triple_image.xml
│ ├── menu/
│ │ └── menu_list_details.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-notnight/
│ │ └── dimens.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-model/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_model/
│ │ ├── AirTime.kt
│ │ ├── CalendarMode.kt
│ │ ├── Comment.kt
│ │ ├── CustomList.kt
│ │ ├── DiscoverFilters.kt
│ │ ├── DiscoverSortOrder.kt
│ │ ├── Episode.kt
│ │ ├── EpisodeBundle.kt
│ │ ├── Genre.kt
│ │ ├── Ids.kt
│ │ ├── Image.kt
│ │ ├── ImageFamily.kt
│ │ ├── ImageSource.kt
│ │ ├── ImageStatus.kt
│ │ ├── ImageType.kt
│ │ ├── Movie.kt
│ │ ├── MovieCollection.kt
│ │ ├── MovieStatus.kt
│ │ ├── MyMoviesSection.kt
│ │ ├── MyShowsSection.kt
│ │ ├── Network.kt
│ │ ├── NewsItem.kt
│ │ ├── NotificationDelay.kt
│ │ ├── Person.kt
│ │ ├── PersonCredit.kt
│ │ ├── PremiumFeature.kt
│ │ ├── ProgressNextEpisodeType.kt
│ │ ├── ProgressType.kt
│ │ ├── RatingState.kt
│ │ ├── Ratings.kt
│ │ ├── RecentSearch.kt
│ │ ├── SearchResult.kt
│ │ ├── Season.kt
│ │ ├── SeasonBundle.kt
│ │ ├── SeasonTranslation.kt
│ │ ├── Settings.kt
│ │ ├── Show.kt
│ │ ├── ShowStatus.kt
│ │ ├── SortOrder.kt
│ │ ├── SortType.kt
│ │ ├── SpoilersSettings.kt
│ │ ├── StreamingService.kt
│ │ ├── Tip.kt
│ │ ├── TraktRating.kt
│ │ ├── TraktSyncSchedule.kt
│ │ ├── Translation.kt
│ │ └── User.kt
│ └── res/
│ ├── values/
│ │ └── strings.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-movie/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_movie/
│ │ ├── MovieDetailsFragment.kt
│ │ ├── MovieDetailsUiEvents.kt
│ │ ├── MovieDetailsUiState.kt
│ │ ├── MovieDetailsViewModel.kt
│ │ ├── cases/
│ │ │ ├── MovieDetailsHiddenCase.kt
│ │ │ ├── MovieDetailsListsCase.kt
│ │ │ ├── MovieDetailsMainCase.kt
│ │ │ ├── MovieDetailsMyMoviesCase.kt
│ │ │ ├── MovieDetailsTranslationCase.kt
│ │ │ └── MovieDetailsWatchlistCase.kt
│ │ ├── helpers/
│ │ │ ├── MovieDetailsMeta.kt
│ │ │ └── MovieLink.kt
│ │ ├── sections/
│ │ │ ├── collections/
│ │ │ │ ├── details/
│ │ │ │ │ ├── MovieDetailsCollectionBottomSheet.kt
│ │ │ │ │ ├── MovieDetailsCollectionUiState.kt
│ │ │ │ │ ├── MovieDetailsCollectionViewModel.kt
│ │ │ │ │ ├── cases/
│ │ │ │ │ │ ├── MovieDetailsCollectionDetailsCase.kt
│ │ │ │ │ │ ├── MovieDetailsCollectionImagesCase.kt
│ │ │ │ │ │ ├── MovieDetailsCollectionMoviesCase.kt
│ │ │ │ │ │ └── MovieDetailsCollectionTranslationsCase.kt
│ │ │ │ │ └── recycler/
│ │ │ │ │ ├── MovieDetailsCollectionAdapter.kt
│ │ │ │ │ ├── MovieDetailsCollectionItem.kt
│ │ │ │ │ ├── MovieDetailsCollectionItemDiffCallback.kt
│ │ │ │ │ └── views/
│ │ │ │ │ ├── MovieDetailsCollectionHeaderView.kt
│ │ │ │ │ ├── MovieDetailsCollectionItemView.kt
│ │ │ │ │ └── MovieDetailsCollectionLoadingView.kt
│ │ │ │ └── list/
│ │ │ │ ├── MovieDetailsCollectionsFragment.kt
│ │ │ │ ├── MovieDetailsCollectionsUiState.kt
│ │ │ │ ├── MovieDetailsCollectionsViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ └── MovieDetailsCollectionsCase.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── MovieCollectionAdapter.kt
│ │ │ │ ├── MovieCollectionDiffCallback.kt
│ │ │ │ └── MovieCollectionItemView.kt
│ │ │ ├── people/
│ │ │ │ ├── MovieDetailsPeopleFragment.kt
│ │ │ │ ├── MovieDetailsPeopleUiState.kt
│ │ │ │ ├── MovieDetailsPeopleViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ └── MovieDetailsPeopleCase.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── ActorView.kt
│ │ │ │ └── ActorsAdapter.kt
│ │ │ ├── ratings/
│ │ │ │ ├── MovieDetailsRatingsFragment.kt
│ │ │ │ ├── MovieDetailsRatingsUiState.kt
│ │ │ │ ├── MovieDetailsRatingsViewModel.kt
│ │ │ │ └── cases/
│ │ │ │ ├── MovieDetailsRatingCase.kt
│ │ │ │ └── MovieDetailsRatingSpoilersCase.kt
│ │ │ ├── related/
│ │ │ │ ├── MovieDetailsRelatedFragment.kt
│ │ │ │ ├── MovieDetailsRelatedUiState.kt
│ │ │ │ ├── MovieDetailsRelatedViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ └── MovieDetailsRelatedCase.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── RelatedItemDiffCallback.kt
│ │ │ │ ├── RelatedListItem.kt
│ │ │ │ ├── RelatedMovieAdapter.kt
│ │ │ │ └── RelatedMovieView.kt
│ │ │ └── streamings/
│ │ │ ├── MovieDetailsStreamingsFragment.kt
│ │ │ ├── MovieDetailsStreamingsUiState.kt
│ │ │ ├── MovieDetailsStreamingsViewModel.kt
│ │ │ └── cases/
│ │ │ └── MovieDetailsStreamingCase.kt
│ │ └── views/
│ │ └── AddToMoviesButton.kt
│ └── res/
│ ├── drawable/
│ │ ├── bg_check_ripple.xml
│ │ ├── bg_collection.xml
│ │ ├── bg_collection_ripple.xml
│ │ ├── bg_rank.xml
│ │ └── divider_horizontal_list.xml
│ ├── layout/
│ │ ├── fragment_movie_details.xml
│ │ ├── fragment_movie_details_collection.xml
│ │ ├── fragment_movie_details_people.xml
│ │ ├── fragment_movie_details_ratings.xml
│ │ ├── fragment_movie_details_related.xml
│ │ ├── fragment_movie_details_streamings.xml
│ │ ├── view_actor_movie.xml
│ │ ├── view_add_to_movies_button.xml
│ │ ├── view_movie_collection.xml
│ │ ├── view_movie_collection_details.xml
│ │ ├── view_movie_collection_items_list.xml
│ │ ├── view_movie_collection_list_header.xml
│ │ ├── view_movie_collection_list_item.xml
│ │ ├── view_movie_collection_list_loading.xml
│ │ └── view_related_movie.xml
│ ├── layout-sw600dp/
│ │ ├── fragment_movie_details.xml
│ │ ├── fragment_movie_details_collection.xml
│ │ ├── fragment_movie_details_people.xml
│ │ ├── fragment_movie_details_related.xml
│ │ ├── fragment_movie_details_streamings.xml
│ │ └── view_movie_collection.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-my-movies/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_my_movies/
│ │ ├── common/
│ │ │ ├── helpers/
│ │ │ │ ├── CollectionItemFilter.kt
│ │ │ │ └── CollectionItemSorter.kt
│ │ │ ├── layout/
│ │ │ │ ├── CollectionMovieGridItemDecoration.kt
│ │ │ │ ├── CollectionMovieLayoutManagerProvider.kt
│ │ │ │ └── CollectionMovieListItemDecoration.kt
│ │ │ ├── recycler/
│ │ │ │ ├── CollectionAdapter.kt
│ │ │ │ ├── CollectionItemDiffCallback.kt
│ │ │ │ └── CollectionListItem.kt
│ │ │ └── views/
│ │ │ ├── CollectionMovieCompactView.kt
│ │ │ ├── CollectionMovieFiltersView.kt
│ │ │ ├── CollectionMovieGridTitleView.kt
│ │ │ ├── CollectionMovieGridView.kt
│ │ │ └── CollectionMovieView.kt
│ │ ├── filters/
│ │ │ ├── CollectionFiltersOrigin.kt
│ │ │ ├── CollectionFiltersUiEvent.kt
│ │ │ └── genre/
│ │ │ ├── CollectionFiltersGenreBottomSheet.kt
│ │ │ ├── CollectionFiltersGenreUiState.kt
│ │ │ └── CollectionFiltersGenreViewModel.kt
│ │ ├── hidden/
│ │ │ ├── HiddenFragment.kt
│ │ │ ├── HiddenUiState.kt
│ │ │ ├── HiddenViewModel.kt
│ │ │ └── cases/
│ │ │ ├── HiddenLoadMoviesCase.kt
│ │ │ ├── HiddenRatingsCase.kt
│ │ │ ├── HiddenSortOrderCase.kt
│ │ │ └── HiddenViewModeCase.kt
│ │ ├── main/
│ │ │ ├── FollowedMoviesFragment.kt
│ │ │ ├── FollowedMoviesUiEvent.kt
│ │ │ ├── FollowedMoviesUiState.kt
│ │ │ ├── FollowedMoviesViewModel.kt
│ │ │ └── FollowedPagesAdapter.kt
│ │ ├── mymovies/
│ │ │ ├── MyMoviesFragment.kt
│ │ │ ├── MyMoviesUiState.kt
│ │ │ ├── MyMoviesViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── MyMoviesLoadCase.kt
│ │ │ │ ├── MyMoviesRatingsCase.kt
│ │ │ │ ├── MyMoviesSortingCase.kt
│ │ │ │ └── MyMoviesViewModeCase.kt
│ │ │ ├── helpers/
│ │ │ │ └── MyMoviesSorter.kt
│ │ │ ├── recycler/
│ │ │ │ ├── MyMoviesAdapter.kt
│ │ │ │ ├── MyMoviesItem.kt
│ │ │ │ ├── MyMoviesItemDiffCallback.kt
│ │ │ │ └── MyMoviesLayoutManagerProvider.kt
│ │ │ ├── utilities/
│ │ │ │ ├── MyMoviesGridItemDecoration.kt
│ │ │ │ └── MyMoviesListItemDecoration.kt
│ │ │ └── views/
│ │ │ ├── MyMovieAllCompactView.kt
│ │ │ ├── MyMovieAllGridTitleView.kt
│ │ │ ├── MyMovieAllGridView.kt
│ │ │ ├── MyMovieAllView.kt
│ │ │ ├── MyMovieFanartView.kt
│ │ │ ├── MyMovieHeaderView.kt
│ │ │ └── MyMoviesRecentsView.kt
│ │ └── watchlist/
│ │ ├── WatchlistFragment.kt
│ │ ├── WatchlistUiState.kt
│ │ ├── WatchlistViewModel.kt
│ │ ├── cases/
│ │ │ ├── WatchlistFiltersCase.kt
│ │ │ ├── WatchlistLoadMoviesCase.kt
│ │ │ ├── WatchlistRatingsCase.kt
│ │ │ ├── WatchlistSortOrderCase.kt
│ │ │ └── WatchlistViewModeCase.kt
│ │ └── recycler/
│ │ └── WatchlistListItem.kt
│ └── res/
│ ├── drawable/
│ │ ├── divider_my_movies_fanart.xml
│ │ └── divider_my_movies_horizontal.xml
│ ├── layout/
│ │ ├── fragment_followed_movies.xml
│ │ ├── fragment_hidden_movies.xml
│ │ ├── fragment_my_movies.xml
│ │ ├── fragment_watchlist_movies.xml
│ │ ├── layout_hidden_empty.xml
│ │ ├── layout_my_movies_empty.xml
│ │ ├── layout_watchlist_movies_empty.xml
│ │ ├── view_collection_movie.xml
│ │ ├── view_collection_movie_compact.xml
│ │ ├── view_collection_movie_grid.xml
│ │ ├── view_collection_movie_grid_title.xml
│ │ ├── view_filters_genres.xml
│ │ ├── view_movies_filters.xml
│ │ ├── view_my_movies_all.xml
│ │ ├── view_my_movies_fanart.xml
│ │ ├── view_my_movies_header.xml
│ │ └── view_my_movies_recents.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-de/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-my-shows/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_my_shows/
│ │ ├── common/
│ │ │ ├── filters/
│ │ │ │ ├── CollectionFiltersOrigin.kt
│ │ │ │ ├── CollectionFiltersUiEvent.kt
│ │ │ │ ├── genre/
│ │ │ │ │ ├── CollectionFiltersGenreBottomSheet.kt
│ │ │ │ │ ├── CollectionFiltersGenreUiState.kt
│ │ │ │ │ └── CollectionFiltersGenreViewModel.kt
│ │ │ │ └── network/
│ │ │ │ ├── CollectionFiltersNetworkBottomSheet.kt
│ │ │ │ ├── CollectionFiltersNetworkUiState.kt
│ │ │ │ └── CollectionFiltersNetworkViewModel.kt
│ │ │ ├── layout/
│ │ │ │ ├── CollectionShowGridItemDecoration.kt
│ │ │ │ ├── CollectionShowLayoutManagerProvider.kt
│ │ │ │ └── CollectionShowListItemDecoration.kt
│ │ │ ├── recycler/
│ │ │ │ ├── CollectionAdapter.kt
│ │ │ │ ├── CollectionItemDiffCallback.kt
│ │ │ │ └── CollectionListItem.kt
│ │ │ └── views/
│ │ │ ├── CollectionShowCompactView.kt
│ │ │ ├── CollectionShowFiltersView.kt
│ │ │ ├── CollectionShowGridTitleView.kt
│ │ │ ├── CollectionShowGridView.kt
│ │ │ └── CollectionShowView.kt
│ │ ├── hidden/
│ │ │ ├── HiddenFragment.kt
│ │ │ ├── HiddenUiState.kt
│ │ │ ├── HiddenViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── HiddenLoadShowsCase.kt
│ │ │ │ ├── HiddenRatingsCase.kt
│ │ │ │ ├── HiddenSortOrderCase.kt
│ │ │ │ ├── HiddenTranslationsCase.kt
│ │ │ │ └── HiddenViewModeCase.kt
│ │ │ └── helpers/
│ │ │ └── HiddenItemSorter.kt
│ │ ├── main/
│ │ │ ├── FollowedPagesAdapter.kt
│ │ │ ├── FollowedShowsFragment.kt
│ │ │ ├── FollowedShowsUiEvent.kt
│ │ │ ├── FollowedShowsUiState.kt
│ │ │ └── FollowedShowsViewModel.kt
│ │ ├── myshows/
│ │ │ ├── MyShowsFragment.kt
│ │ │ ├── MyShowsUiState.kt
│ │ │ ├── MyShowsViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── MyShowsLoadShowsCase.kt
│ │ │ │ ├── MyShowsRatingsCase.kt
│ │ │ │ ├── MyShowsSortingCase.kt
│ │ │ │ ├── MyShowsTranslationsCase.kt
│ │ │ │ └── MyShowsViewModeCase.kt
│ │ │ ├── filters/
│ │ │ │ ├── MyShowsFiltersBottomSheet.kt
│ │ │ │ ├── MyShowsFiltersUiEvent.kt
│ │ │ │ ├── MyShowsFiltersUiState.kt
│ │ │ │ ├── MyShowsFiltersViewModel.kt
│ │ │ │ └── views/
│ │ │ │ └── MyShowsFilterItemView.kt
│ │ │ ├── helpers/
│ │ │ │ └── MyShowsItemSorter.kt
│ │ │ ├── recycler/
│ │ │ │ ├── MyShowsAdapter.kt
│ │ │ │ ├── MyShowsItem.kt
│ │ │ │ ├── MyShowsItemDiffCallback.kt
│ │ │ │ └── MyShowsLayoutManagerProvider.kt
│ │ │ └── views/
│ │ │ ├── MyShowAllCompactView.kt
│ │ │ ├── MyShowAllView.kt
│ │ │ ├── MyShowFanartView.kt
│ │ │ ├── MyShowGridTitleView.kt
│ │ │ ├── MyShowGridView.kt
│ │ │ ├── MyShowHeaderView.kt
│ │ │ └── MyShowsRecentsView.kt
│ │ ├── utilities/
│ │ │ ├── MyShowsGridItemDecoration.kt
│ │ │ └── MyShowsListItemDecoration.kt
│ │ └── watchlist/
│ │ ├── WatchlistFragment.kt
│ │ ├── WatchlistUiState.kt
│ │ ├── WatchlistViewModel.kt
│ │ ├── cases/
│ │ │ ├── WatchlistFiltersCase.kt
│ │ │ ├── WatchlistLoadShowsCase.kt
│ │ │ ├── WatchlistRatingsCase.kt
│ │ │ ├── WatchlistSortOrderCase.kt
│ │ │ ├── WatchlistTranslationsCase.kt
│ │ │ └── WatchlistViewModeCase.kt
│ │ └── helpers/
│ │ ├── WatchlistItemFilter.kt
│ │ └── WatchlistItemSorter.kt
│ └── res/
│ ├── layout/
│ │ ├── fragment_followed_shows.xml
│ │ ├── fragment_hidden.xml
│ │ ├── fragment_my_shows.xml
│ │ ├── fragment_watchlist.xml
│ │ ├── layout_archive_empty.xml
│ │ ├── layout_my_shows_empty.xml
│ │ ├── layout_watchlist_empty.xml
│ │ ├── view_collection_show.xml
│ │ ├── view_collection_show_compact.xml
│ │ ├── view_collection_show_grid.xml
│ │ ├── view_collection_show_grid_title.xml
│ │ ├── view_filters_genres.xml
│ │ ├── view_filters_networks.xml
│ │ ├── view_my_shows_fanart.xml
│ │ ├── view_my_shows_header.xml
│ │ ├── view_my_shows_recents.xml
│ │ ├── view_my_shows_type_filter_item.xml
│ │ ├── view_my_shows_type_filters.xml
│ │ └── view_shows_filters.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-de/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-navigation/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com.michaldrabik.ui_navigation.java/
│ │ └── NavigationArgs.kt
│ └── res/
│ ├── anim/
│ │ ├── anim_fade_in.xml
│ │ ├── anim_fade_out.xml
│ │ ├── anim_in_from_left.xml
│ │ ├── anim_in_from_right.xml
│ │ ├── anim_out_from_left.xml
│ │ └── anim_out_from_right.xml
│ ├── anim-ar/
│ │ ├── anim_in_from_left.xml
│ │ ├── anim_in_from_right.xml
│ │ ├── anim_out_from_left.xml
│ │ └── anim_out_from_right.xml
│ └── navigation/
│ └── navigation_graph.xml
├── ui-news/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_news/
│ │ │ ├── NewsFragment.kt
│ │ │ ├── NewsUiState.kt
│ │ │ ├── NewsViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── NewsFiltersCase.kt
│ │ │ │ ├── NewsLoadItemsCase.kt
│ │ │ │ └── NewsViewTypeCase.kt
│ │ │ ├── providers/
│ │ │ │ └── NewsLayoutManagerProvider.kt
│ │ │ ├── recycler/
│ │ │ │ ├── NewsAdapter.kt
│ │ │ │ ├── NewsListItem.kt
│ │ │ │ └── NewsListItemDiffCallback.kt
│ │ │ └── views/
│ │ │ ├── NewsFiltersView.kt
│ │ │ ├── NewsHeaderView.kt
│ │ │ └── item/
│ │ │ ├── NewsItemCardView.kt
│ │ │ ├── NewsItemRowView.kt
│ │ │ └── NewsItemViewType.kt
│ │ └── res/
│ │ ├── drawable/
│ │ │ ├── bg_news_card_view_elevation.xml
│ │ │ ├── bg_news_card_view_placeholder.xml
│ │ │ ├── bg_play_circle.xml
│ │ │ ├── divider_news.xml
│ │ │ ├── ic_play_arrow.xml
│ │ │ ├── ic_view_cards.xml
│ │ │ └── iv_view_list.xml
│ │ ├── layout/
│ │ │ ├── fragment_news.xml
│ │ │ ├── layout_news_empty.xml
│ │ │ ├── view_news_filters.xml
│ │ │ ├── view_news_header.xml
│ │ │ ├── view_news_item.xml
│ │ │ └── view_news_item_card.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-sw600dp/
│ │ │ └── dimens.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── ui_news/
│ └── ExampleUnitTest.kt
├── ui-people/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_people/
│ │ │ ├── details/
│ │ │ │ ├── PersonDetailsArgs.kt
│ │ │ │ ├── PersonDetailsBottomSheet.kt
│ │ │ │ ├── PersonDetailsUiEvent.kt
│ │ │ │ ├── PersonDetailsUiState.kt
│ │ │ │ ├── PersonDetailsViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ ├── PersonDetailsCreditsCase.kt
│ │ │ │ │ ├── PersonDetailsImagesCase.kt
│ │ │ │ │ ├── PersonDetailsLoadCase.kt
│ │ │ │ │ └── PersonDetailsTranslationsCase.kt
│ │ │ │ ├── links/
│ │ │ │ │ └── PersonLinksBottomSheet.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── PersonDetailsAdapter.kt
│ │ │ │ ├── PersonDetailsItem.kt
│ │ │ │ ├── PersonDetailsItemDiffCallback.kt
│ │ │ │ └── views/
│ │ │ │ ├── PersonDetailsBioView.kt
│ │ │ │ ├── PersonDetailsCreditsItemView.kt
│ │ │ │ ├── PersonDetailsFiltersView.kt
│ │ │ │ ├── PersonDetailsHeaderView.kt
│ │ │ │ ├── PersonDetailsInfoView.kt
│ │ │ │ └── PersonDetailsLoadingView.kt
│ │ │ ├── gallery/
│ │ │ │ ├── PersonGalleryFragment.kt
│ │ │ │ ├── PersonGalleryUiState.kt
│ │ │ │ ├── PersonGalleryViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ └── PersonGalleryImagesCase.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── ImageItemDiffCallback.kt
│ │ │ │ ├── PersonGalleryAdapter.kt
│ │ │ │ └── views/
│ │ │ │ └── PersonGalleryImageView.kt
│ │ │ └── list/
│ │ │ ├── PeopleListBottomSheet.kt
│ │ │ ├── PeopleListUiState.kt
│ │ │ ├── PeopleListViewModel.kt
│ │ │ ├── cases/
│ │ │ │ └── PeopleListItemsCase.kt
│ │ │ └── recycler/
│ │ │ ├── PeopleItemDiffCallback.kt
│ │ │ ├── PeopleListAdapter.kt
│ │ │ ├── PeopleListItem.kt
│ │ │ └── views/
│ │ │ ├── PeopleListHeaderView.kt
│ │ │ └── PeopleListItemView.kt
│ │ └── res/
│ │ ├── color/
│ │ │ ├── selector_search_chip_background.xml
│ │ │ └── selector_search_chip_text.xml
│ │ ├── drawable/
│ │ │ ├── bg_indicator_circle.xml
│ │ │ ├── bg_person_image_elevation.xml
│ │ │ └── bg_person_placeholder.xml
│ │ ├── drawable-notnight/
│ │ │ └── bg_indicator_circle.xml
│ │ ├── layout/
│ │ │ ├── fragment_person_gallery.xml
│ │ │ ├── view_people_list.xml
│ │ │ ├── view_people_list_header.xml
│ │ │ ├── view_people_list_item.xml
│ │ │ ├── view_person_details.xml
│ │ │ ├── view_person_details_bio.xml
│ │ │ ├── view_person_details_credits_item.xml
│ │ │ ├── view_person_details_filters.xml
│ │ │ ├── view_person_details_header.xml
│ │ │ ├── view_person_details_info.xml
│ │ │ ├── view_person_details_loading.xml
│ │ │ ├── view_person_gallery_image.xml
│ │ │ └── view_person_links.xml
│ │ ├── layout-sw600dp/
│ │ │ └── view_person_details_credits_item.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-sw600dp/
│ │ │ └── dimens.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── ui_people/
│ └── ExampleUnitTest.kt
├── ui-premium/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_premium/
│ │ ├── PremiumFragment.kt
│ │ ├── PremiumUiEvent.kt
│ │ ├── PremiumUiState.kt
│ │ ├── PremiumViewModel.kt
│ │ └── views/
│ │ └── PurchaseItemView.kt
│ └── res/
│ ├── drawable/
│ │ ├── divider_purchase_items.xml
│ │ ├── ic_flash.xml
│ │ ├── ic_genie.xml
│ │ ├── ic_homer.xml
│ │ ├── ic_spongebob.xml
│ │ ├── ic_walter_white.xml
│ │ ├── ic_yoda.xml
│ │ └── ic_zoidberg.xml
│ ├── layout/
│ │ ├── fragment_premium.xml
│ │ └── view_purchase_item.xml
│ ├── values/
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-progress/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_progress/
│ │ ├── calendar/
│ │ │ ├── CalendarFragment.kt
│ │ │ ├── CalendarUiState.kt
│ │ │ ├── CalendarViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── CalendarRatingsCase.kt
│ │ │ │ └── items/
│ │ │ │ ├── CalendarFutureCase.kt
│ │ │ │ ├── CalendarItemsCase.kt
│ │ │ │ └── CalendarRecentsCase.kt
│ │ │ ├── helpers/
│ │ │ │ ├── WatchlistAppender.kt
│ │ │ │ ├── filters/
│ │ │ │ │ ├── CalendarFilter.kt
│ │ │ │ │ ├── CalendarFutureFilter.kt
│ │ │ │ │ └── CalendarRecentsFilter.kt
│ │ │ │ └── groupers/
│ │ │ │ ├── CalendarFutureGrouper.kt
│ │ │ │ ├── CalendarGrouper.kt
│ │ │ │ └── CalendarRecentsGrouper.kt
│ │ │ ├── recycler/
│ │ │ │ ├── CalendarAdapter.kt
│ │ │ │ ├── CalendarItemDiffCallback.kt
│ │ │ │ └── CalendarListItem.kt
│ │ │ └── views/
│ │ │ ├── CalendarHeaderView.kt
│ │ │ └── CalendarItemView.kt
│ │ ├── helpers/
│ │ │ ├── ProgressItemsSorter.kt
│ │ │ ├── ProgressLayoutManagerProvider.kt
│ │ │ ├── TopOverscrollAdapter.kt
│ │ │ └── TranslationsBundle.kt
│ │ ├── main/
│ │ │ ├── ProgressMainFragment.kt
│ │ │ ├── ProgressMainUiEvents.kt
│ │ │ ├── ProgressMainUiState.kt
│ │ │ ├── ProgressMainViewModel.kt
│ │ │ ├── adapters/
│ │ │ │ └── ProgressMainAdapter.kt
│ │ │ └── cases/
│ │ │ └── ProgressMainEpisodesCase.kt
│ │ └── progress/
│ │ ├── ProgressFragment.kt
│ │ ├── ProgressUiState.kt
│ │ ├── ProgressViewModel.kt
│ │ ├── cases/
│ │ │ ├── ProgressFiltersCase.kt
│ │ │ ├── ProgressHeadersCase.kt
│ │ │ ├── ProgressItemsCase.kt
│ │ │ ├── ProgressRatingsCase.kt
│ │ │ └── ProgressSortOrderCase.kt
│ │ ├── recycler/
│ │ │ ├── ProgressAdapter.kt
│ │ │ ├── ProgressItemDiffCallback.kt
│ │ │ └── ProgressListItem.kt
│ │ └── views/
│ │ ├── ProgressFiltersView.kt
│ │ ├── ProgressHeaderView.kt
│ │ └── ProgressItemView.kt
│ └── res/
│ ├── layout/
│ │ ├── fragment_calendar.xml
│ │ ├── fragment_progress.xml
│ │ ├── fragment_progress_main.xml
│ │ ├── layout_calendar_empty.xml
│ │ ├── layout_progress_empty.xml
│ │ ├── layout_recents_empty.xml
│ │ ├── view_calendar_header.xml
│ │ ├── view_calendar_item.xml
│ │ ├── view_progress_filters.xml
│ │ ├── view_progress_header.xml
│ │ └── view_progress_item.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-ar/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-de/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-pt/
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-progress-movies/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_progress_movies/
│ │ │ ├── calendar/
│ │ │ │ ├── CalendarMoviesFragment.kt
│ │ │ │ ├── CalendarMoviesUiState.kt
│ │ │ │ ├── CalendarMoviesViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ ├── CalendarMoviesRatingsCase.kt
│ │ │ │ │ └── items/
│ │ │ │ │ ├── CalendarMoviesFutureCase.kt
│ │ │ │ │ ├── CalendarMoviesItemsCase.kt
│ │ │ │ │ └── CalendarMoviesRecentsCase.kt
│ │ │ │ ├── helpers/
│ │ │ │ │ ├── filters/
│ │ │ │ │ │ ├── CalendarFilter.kt
│ │ │ │ │ │ ├── CalendarFutureFilter.kt
│ │ │ │ │ │ └── CalendarRecentsFilter.kt
│ │ │ │ │ ├── groupers/
│ │ │ │ │ │ ├── CalendarFutureGrouper.kt
│ │ │ │ │ │ ├── CalendarGrouper.kt
│ │ │ │ │ │ └── CalendarRecentsGrouper.kt
│ │ │ │ │ └── sorter/
│ │ │ │ │ ├── CalendarFutureSorter.kt
│ │ │ │ │ ├── CalendarRecentsSorter.kt
│ │ │ │ │ └── CalendarSorter.kt
│ │ │ │ ├── recycler/
│ │ │ │ │ ├── CalendarMovieItemDiffCallback.kt
│ │ │ │ │ ├── CalendarMovieListItem.kt
│ │ │ │ │ └── CalendarMoviesAdapter.kt
│ │ │ │ └── views/
│ │ │ │ ├── CalendarMoviesHeaderView.kt
│ │ │ │ └── CalendarMoviesItemView.kt
│ │ │ ├── helpers/
│ │ │ │ ├── ProgressMoviesItemsSorter.kt
│ │ │ │ ├── ProgressMoviesLayoutManagerProvider.kt
│ │ │ │ └── TopOverscrollAdapter.kt
│ │ │ ├── main/
│ │ │ │ ├── ProgressMoviesMainAdapter.kt
│ │ │ │ ├── ProgressMoviesMainFragment.kt
│ │ │ │ ├── ProgressMoviesMainUiEvents.kt
│ │ │ │ ├── ProgressMoviesMainUiState.kt
│ │ │ │ ├── ProgressMoviesMainViewModel.kt
│ │ │ │ └── cases/
│ │ │ │ └── ProgressMoviesMainCase.kt
│ │ │ └── progress/
│ │ │ ├── ProgressMoviesFragment.kt
│ │ │ ├── ProgressMoviesUiState.kt
│ │ │ ├── ProgressMoviesViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── ProgressMoviesItemsCase.kt
│ │ │ │ ├── ProgressMoviesPinnedCase.kt
│ │ │ │ └── ProgressMoviesSortCase.kt
│ │ │ ├── recycler/
│ │ │ │ ├── ProgressMovieItemDiffCallback.kt
│ │ │ │ ├── ProgressMovieListItem.kt
│ │ │ │ └── ProgressMoviesAdapter.kt
│ │ │ └── views/
│ │ │ ├── ProgressMoviesFiltersView.kt
│ │ │ └── ProgressMoviesItemView.kt
│ │ └── res/
│ │ ├── layout/
│ │ │ ├── fragment_calendar_movies.xml
│ │ │ ├── fragment_progress_main_movies.xml
│ │ │ ├── fragment_progress_movies.xml
│ │ │ ├── layout_calendar_movies_future_empty.xml
│ │ │ ├── layout_calendar_movies_recents_empty.xml
│ │ │ ├── layout_progress_movies_empty.xml
│ │ │ ├── view_calendar_movies_header.xml
│ │ │ ├── view_progress_movies_calendar_item.xml
│ │ │ ├── view_progress_movies_filters.xml
│ │ │ └── view_progress_movies_main_item.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-ar/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-pl/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-sw600dp/
│ │ │ └── dimens.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── ui_progress_movies/
│ ├── BaseMockTest.kt
│ ├── calendar/
│ │ ├── CalendarMoviesViewModelTest.kt
│ │ ├── cases/
│ │ │ └── CalendarMoviesRatingsCaseTest.kt
│ │ └── helpers/
│ │ ├── filters/
│ │ │ ├── CalendarFutureFilterTest.kt
│ │ │ └── CalendarRecentsFilterTest.kt
│ │ ├── groupers/
│ │ │ ├── CalendarFutureGrouperTest.kt
│ │ │ └── CalendarRecentsGrouperTest.kt
│ │ └── sorter/
│ │ ├── CalendarFutureSorterTest.kt
│ │ └── CalendarRecentsSorterTest.kt
│ ├── main/
│ │ ├── ProgressMoviesMainViewModelTest.kt
│ │ └── cases/
│ │ └── ProgressMoviesMainCaseTest.kt
│ └── progress/
│ ├── ProgressMoviesViewModelTest.kt
│ └── cases/
│ ├── ProgressMoviesItemsCaseTest.kt
│ ├── ProgressMoviesPinnedCaseTest.kt
│ └── ProgressMoviesSortCaseTest.kt
├── ui-search/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_search/
│ │ │ ├── SearchFragment.kt
│ │ │ ├── SearchUiState.kt
│ │ │ ├── SearchViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── SearchFiltersCase.kt
│ │ │ │ ├── SearchInvalidateItemCase.kt
│ │ │ │ ├── SearchQueryCase.kt
│ │ │ │ ├── SearchRecentsCase.kt
│ │ │ │ ├── SearchSortingCase.kt
│ │ │ │ ├── SearchSuggestionsCase.kt
│ │ │ │ └── SearchTranslationsCase.kt
│ │ │ ├── recycler/
│ │ │ │ ├── SearchAdapter.kt
│ │ │ │ ├── SearchItemDiffCallback.kt
│ │ │ │ ├── SearchListItem.kt
│ │ │ │ └── suggestions/
│ │ │ │ ├── SuggestionAdapter.kt
│ │ │ │ └── SuggestionItemDiffCallback.kt
│ │ │ ├── utilities/
│ │ │ │ ├── SearchLayoutManagerProvider.kt
│ │ │ │ ├── SearchOptions.kt
│ │ │ │ └── TextWatcherAdapter.kt
│ │ │ └── views/
│ │ │ ├── InitialSearchView.kt
│ │ │ ├── RecentSearchView.kt
│ │ │ ├── SearchFiltersView.kt
│ │ │ ├── SearchItemView.kt
│ │ │ └── SearchSuggestionView.kt
│ │ └── res/
│ │ ├── color/
│ │ │ ├── selector_search_chip_background.xml
│ │ │ └── selector_search_chip_text.xml
│ │ ├── color-notnight/
│ │ │ └── selector_search_chip_background.xml
│ │ ├── drawable/
│ │ │ └── bg_suggestions.xml
│ │ ├── layout/
│ │ │ ├── fragment_search.xml
│ │ │ ├── view_search_filters.xml
│ │ │ ├── view_search_initial.xml
│ │ │ ├── view_search_recent.xml
│ │ │ ├── view_show_search.xml
│ │ │ └── view_suggestion_search.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-sw600dp/
│ │ │ └── dimens.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ └── com.michaldrabik.ui_search/
│ ├── BaseMockTest.kt
│ ├── SearchViewModelTest.kt
│ ├── cases/
│ │ ├── SearchFiltersCaseTest.kt
│ │ ├── SearchQueryCaseTest.kt
│ │ ├── SearchRecentsCaseTest.kt
│ │ ├── SearchSortingCaseTest.kt
│ │ ├── SearchSuggestionsCaseTest.kt
│ │ └── SearchTranslationsCaseTest.kt
│ └── helpers/
│ └── TestData.kt
├── ui-settings/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_settings/
│ │ └── ExampleInstrumentedTest.kt
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_settings/
│ │ │ ├── SettingsFragment.kt
│ │ │ ├── SettingsUiState.kt
│ │ │ ├── SettingsViewModel.kt
│ │ │ ├── helpers/
│ │ │ │ ├── AppLanguage.kt
│ │ │ │ ├── AppTheme.kt
│ │ │ │ └── WidgetTransparency.kt
│ │ │ └── sections/
│ │ │ ├── general/
│ │ │ │ ├── SettingsGeneralFragment.kt
│ │ │ │ ├── SettingsGeneralUiState.kt
│ │ │ │ ├── SettingsGeneralViewModel.kt
│ │ │ │ └── cases/
│ │ │ │ ├── SettingsGeneralMainCase.kt
│ │ │ │ ├── SettingsGeneralStreamingsCase.kt
│ │ │ │ └── SettingsGeneralThemesCase.kt
│ │ │ ├── misc/
│ │ │ │ ├── SettingsMiscFragment.kt
│ │ │ │ ├── SettingsMiscUiState.kt
│ │ │ │ ├── SettingsMiscViewModel.kt
│ │ │ │ └── cases/
│ │ │ │ ├── SettingsMiscCacheCase.kt
│ │ │ │ └── SettingsMiscUserCase.kt
│ │ │ ├── notifications/
│ │ │ │ ├── SettingsNotificationsFragment.kt
│ │ │ │ ├── SettingsNotificationsUiEvent.kt
│ │ │ │ ├── SettingsNotificationsUiState.kt
│ │ │ │ ├── SettingsNotificationsViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ └── SettingsNotificationsMainCase.kt
│ │ │ │ └── views/
│ │ │ │ └── NotificationsRationaleView.kt
│ │ │ ├── spoilers/
│ │ │ │ ├── SettingsSpoilersFragment.kt
│ │ │ │ ├── SettingsSpoilersUiState.kt
│ │ │ │ ├── SettingsSpoilersViewModel.kt
│ │ │ │ ├── episodes/
│ │ │ │ │ ├── SpoilersEpisodesBottomSheet.kt
│ │ │ │ │ ├── SpoilersEpisodesUiState.kt
│ │ │ │ │ └── SpoilersEpisodesViewModel.kt
│ │ │ │ ├── helpers/
│ │ │ │ │ └── SettingsSpoilersHelper.kt
│ │ │ │ ├── movies/
│ │ │ │ │ ├── SpoilersMoviesBottomSheet.kt
│ │ │ │ │ ├── SpoilersMoviesUiState.kt
│ │ │ │ │ └── SpoilersMoviesViewModel.kt
│ │ │ │ └── shows/
│ │ │ │ ├── SpoilersShowsBottomSheet.kt
│ │ │ │ ├── SpoilersShowsUiState.kt
│ │ │ │ └── SpoilersShowsViewModel.kt
│ │ │ ├── trakt/
│ │ │ │ ├── SettingsTraktFragment.kt
│ │ │ │ ├── SettingsTraktUiEvent.kt
│ │ │ │ ├── SettingsTraktUiState.kt
│ │ │ │ ├── SettingsTraktViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ ├── SettingsRatingsCase.kt
│ │ │ │ │ ├── SettingsTraktCase.kt
│ │ │ │ │ └── SettingsTraktMainCase.kt
│ │ │ │ └── views/
│ │ │ │ └── TraktNotificationsRationaleView.kt
│ │ │ └── widgets/
│ │ │ ├── SettingsWidgetsFragment.kt
│ │ │ ├── SettingsWidgetsUiState.kt
│ │ │ ├── SettingsWidgetsViewModel.kt
│ │ │ └── cases/
│ │ │ ├── SettingsWidgetsMainCase.kt
│ │ │ └── SettingsWidgetsThemesCase.kt
│ │ └── res/
│ │ ├── drawable/
│ │ │ └── bg_premium_ad.xml
│ │ ├── layout/
│ │ │ ├── fragment_settings.xml
│ │ │ ├── fragment_settings_general.xml
│ │ │ ├── fragment_settings_misc.xml
│ │ │ ├── fragment_settings_notifications.xml
│ │ │ ├── fragment_settings_spoilers.xml
│ │ │ ├── fragment_settings_trakt.xml
│ │ │ ├── fragment_settings_widgets.xml
│ │ │ ├── sheet_spoilers_episodes.xml
│ │ │ ├── sheet_spoilers_movies.xml
│ │ │ ├── sheet_spoilers_shows.xml
│ │ │ ├── view_notifications_rationale.xml
│ │ │ └── view_trakt_notifications_rationale.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-sw600dp/
│ │ │ ├── dimens.xml
│ │ │ └── styles.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ └── com/
│ └── michaldrabik/
│ └── ui_settings/
│ └── ExampleUnitTest.kt
├── ui-show/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_show/
│ │ ├── ShowDetailsFragment.kt
│ │ ├── ShowDetailsUiEvents.kt
│ │ ├── ShowDetailsUiState.kt
│ │ ├── ShowDetailsViewModel.kt
│ │ ├── cases/
│ │ │ ├── ShowDetailsHiddenCase.kt
│ │ │ ├── ShowDetailsListsCase.kt
│ │ │ ├── ShowDetailsMainCase.kt
│ │ │ ├── ShowDetailsMyShowsCase.kt
│ │ │ ├── ShowDetailsTranslationCase.kt
│ │ │ └── ShowDetailsWatchlistCase.kt
│ │ ├── episodes/
│ │ │ ├── ShowDetailsEpisodesFragment.kt
│ │ │ ├── ShowDetailsEpisodesUiEvents.kt
│ │ │ ├── ShowDetailsEpisodesUiState.kt
│ │ │ ├── ShowDetailsEpisodesViewModel.kt
│ │ │ ├── cases/
│ │ │ │ ├── EpisodesAnnouncementsCase.kt
│ │ │ │ ├── EpisodesLoadShowCase.kt
│ │ │ │ ├── EpisodesMarkWatchedCase.kt
│ │ │ │ ├── EpisodesRatingCase.kt
│ │ │ │ ├── EpisodesSetEpisodeWatchedCase.kt
│ │ │ │ ├── EpisodesSetSeasonWatchedCase.kt
│ │ │ │ └── EpisodesTranslationCase.kt
│ │ │ └── recycler/
│ │ │ ├── EpisodeListItem.kt
│ │ │ ├── EpisodeListItemDiffCallback.kt
│ │ │ ├── EpisodeView.kt
│ │ │ └── EpisodesAdapter.kt
│ │ ├── helpers/
│ │ │ └── ShowDetailsMeta.kt
│ │ ├── quicksetup/
│ │ │ ├── QuickSetupAdapter.kt
│ │ │ ├── QuickSetupItemDiffCallback.kt
│ │ │ ├── QuickSetupListItem.kt
│ │ │ ├── QuickSetupView.kt
│ │ │ └── views/
│ │ │ ├── QuickSetupHeaderView.kt
│ │ │ └── QuickSetupItemView.kt
│ │ ├── sections/
│ │ │ ├── nextepisode/
│ │ │ │ ├── ShowDetailsNextEpisodeFragment.kt
│ │ │ │ ├── ShowDetailsNextEpisodeUiState.kt
│ │ │ │ ├── ShowDetailsNextEpisodeViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ ├── ShowDetailsNextEpisodeCase.kt
│ │ │ │ │ ├── ShowDetailsTranslationCase.kt
│ │ │ │ │ └── ShowDetailsWatchedCase.kt
│ │ │ │ └── helpers/
│ │ │ │ └── NextEpisodeBundle.kt
│ │ │ ├── people/
│ │ │ │ ├── ShowDetailsPeopleFragment.kt
│ │ │ │ ├── ShowDetailsPeopleUiState.kt
│ │ │ │ ├── ShowDetailsPeopleViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ └── ShowDetailsPeopleCase.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── ActorView.kt
│ │ │ │ └── ActorsAdapter.kt
│ │ │ ├── ratings/
│ │ │ │ ├── ShowDetailsRatingsFragment.kt
│ │ │ │ ├── ShowDetailsRatingsUiState.kt
│ │ │ │ ├── ShowDetailsRatingsViewModel.kt
│ │ │ │ ├── ShowLink.kt
│ │ │ │ └── cases/
│ │ │ │ ├── ShowDetailsRatingCase.kt
│ │ │ │ └── ShowDetailsRatingSpoilersCase.kt
│ │ │ ├── related/
│ │ │ │ ├── ShowDetailsRelatedFragment.kt
│ │ │ │ ├── ShowDetailsRelatedUiState.kt
│ │ │ │ ├── ShowDetailsRelatedViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ └── ShowDetailsRelatedCase.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── RelatedItemDiffCallback.kt
│ │ │ │ ├── RelatedListItem.kt
│ │ │ │ ├── RelatedShowAdapter.kt
│ │ │ │ └── RelatedShowView.kt
│ │ │ ├── seasons/
│ │ │ │ ├── ShowDetailsSeasonsFragment.kt
│ │ │ │ ├── ShowDetailsSeasonsUiEvents.kt
│ │ │ │ ├── ShowDetailsSeasonsUiState.kt
│ │ │ │ ├── ShowDetailsSeasonsViewModel.kt
│ │ │ │ ├── cases/
│ │ │ │ │ ├── ShowDetailsLoadSeasonsCase.kt
│ │ │ │ │ ├── ShowDetailsQuickProgressCase.kt
│ │ │ │ │ └── ShowDetailsWatchedSeasonCase.kt
│ │ │ │ ├── helpers/
│ │ │ │ │ ├── SeasonsBundle.kt
│ │ │ │ │ └── SeasonsCache.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── SeasonListItem.kt
│ │ │ │ ├── SeasonListItemDiffCallback.kt
│ │ │ │ ├── SeasonView.kt
│ │ │ │ ├── SeasonsAdapter.kt
│ │ │ │ └── helpers/
│ │ │ │ ├── SeasonsGridItemDecoration.kt
│ │ │ │ └── SeasonsLayoutManagerProvider.kt
│ │ │ └── streamings/
│ │ │ ├── ShowDetailsStreamingsFragment.kt
│ │ │ ├── ShowDetailsStreamingsUiState.kt
│ │ │ ├── ShowDetailsStreamingsViewModel.kt
│ │ │ └── cases/
│ │ │ └── ShowDetailsStreamingCase.kt
│ │ └── views/
│ │ └── AddToShowsButton.kt
│ └── res/
│ ├── drawable/
│ │ ├── divider_horizontal_list.xml
│ │ ├── ic_arrow_right.xml
│ │ ├── ic_locked.xml
│ │ ├── ic_quick_setup.xml
│ │ └── ic_unlocked.xml
│ ├── drawable-ar/
│ │ └── ic_arrow_right.xml
│ ├── layout/
│ │ ├── fragment_show_details.xml
│ │ ├── fragment_show_details_episodes.xml
│ │ ├── fragment_show_details_next_episode.xml
│ │ ├── fragment_show_details_people.xml
│ │ ├── fragment_show_details_ratings.xml
│ │ ├── fragment_show_details_related.xml
│ │ ├── fragment_show_details_seasons.xml
│ │ ├── fragment_show_details_streamings.xml
│ │ ├── view_actor.xml
│ │ ├── view_add_to_shows_button.xml
│ │ ├── view_episode.xml
│ │ ├── view_quick_setup.xml
│ │ ├── view_quick_setup_header.xml
│ │ ├── view_quick_setup_item.xml
│ │ ├── view_related_show.xml
│ │ └── view_season.xml
│ ├── layout-sw600dp/
│ │ ├── fragment_show_details.xml
│ │ ├── fragment_show_details_next_episode.xml
│ │ ├── fragment_show_details_people.xml
│ │ ├── fragment_show_details_related.xml
│ │ ├── fragment_show_details_seasons.xml
│ │ └── view_season.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-fi/
│ │ └── strings.xml
│ ├── values-fr/
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-pt/
│ │ ├── dimens.xml
│ │ └── strings.xml
│ ├── values-ru/
│ │ └── strings.xml
│ ├── values-sw600dp/
│ │ └── dimens.xml
│ ├── values-tr/
│ │ └── strings.xml
│ ├── values-uk/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── values-zh/
│ └── strings.xml
├── ui-statistics/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_statistics/
│ │ │ ├── StatisticsFragment.kt
│ │ │ ├── StatisticsUiState.kt
│ │ │ ├── StatisticsViewModel.kt
│ │ │ ├── cases/
│ │ │ │ └── StatisticsLoadRatingsCase.kt
│ │ │ └── views/
│ │ │ ├── StatisticsTopGenresView.kt
│ │ │ ├── StatisticsTotalEpisodesView.kt
│ │ │ ├── StatisticsTotalTimeSpentView.kt
│ │ │ ├── mostWatched/
│ │ │ │ ├── StatisticsMostWatchedItem.kt
│ │ │ │ ├── StatisticsMostWatchedItemView.kt
│ │ │ │ ├── StatisticsMostWatchedShowsView.kt
│ │ │ │ └── recycler/
│ │ │ │ ├── MostWatchedAdapter.kt
│ │ │ │ └── MostWatchedItemDiffCallback.kt
│ │ │ └── ratings/
│ │ │ ├── StatisticsRateItemView.kt
│ │ │ ├── StatisticsRatingsView.kt
│ │ │ └── recycler/
│ │ │ ├── StatisticsRatingItem.kt
│ │ │ ├── StatisticsRatingsAdapter.kt
│ │ │ └── StatisticsRatingsDiffCallback.kt
│ │ └── res/
│ │ ├── drawable/
│ │ │ ├── divider_statistics_most_watched.xml
│ │ │ └── divider_statistics_ratings.xml
│ │ ├── layout/
│ │ │ ├── fragment_statistics.xml
│ │ │ ├── layout_statistics_empty.xml
│ │ │ ├── view_statistics_card_most_watched_shows.xml
│ │ │ ├── view_statistics_card_ratings.xml
│ │ │ ├── view_statistics_card_top_genre.xml
│ │ │ ├── view_statistics_card_total_episodes.xml
│ │ │ ├── view_statistics_card_total_time.xml
│ │ │ ├── view_statistics_most_watched_item.xml
│ │ │ └── view_statistics_rate_item.xml
│ │ ├── layout-sw600dp/
│ │ │ └── fragment_statistics.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-notnight/
│ │ │ └── dimens.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-sw600dp/
│ │ │ └── dimens.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ ├── BaseMockTest.kt
│ ├── TestData.kt
│ └── com/
│ └── michaldrabik/
│ └── ui_statistics/
│ ├── StatisticsViewModelTest.kt
│ └── cases/
│ └── StatisticsLoadRatingsCaseTest.kt
├── ui-statistics-movies/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_statistics_movies/
│ │ │ ├── StatisticsMoviesFragment.kt
│ │ │ ├── StatisticsMoviesUiState.kt
│ │ │ ├── StatisticsMoviesViewModel.kt
│ │ │ ├── cases/
│ │ │ │ └── StatisticsMoviesLoadRatingsCase.kt
│ │ │ └── views/
│ │ │ ├── StatisticsMoviesTopGenresView.kt
│ │ │ ├── StatisticsMoviesTotalMoviesView.kt
│ │ │ ├── StatisticsMoviesTotalTimeSpentView.kt
│ │ │ └── ratings/
│ │ │ ├── StatisticsMoviesRateItemView.kt
│ │ │ ├── StatisticsMoviesRatingsView.kt
│ │ │ └── recycler/
│ │ │ ├── StatisticsMoviesRatingItem.kt
│ │ │ ├── StatisticsMoviesRatingsAdapter.kt
│ │ │ └── StatisticsMoviesRatingsDiffCallback.kt
│ │ └── res/
│ │ ├── drawable/
│ │ │ └── divider_statistics_ratings.xml
│ │ ├── layout/
│ │ │ ├── fragment_statistics_movies.xml
│ │ │ ├── layout_statistics_movies_empty.xml
│ │ │ ├── view_statistics_movies_card_ratings.xml
│ │ │ ├── view_statistics_movies_card_top_genre.xml
│ │ │ ├── view_statistics_movies_card_total_movies.xml
│ │ │ ├── view_statistics_movies_card_total_time.xml
│ │ │ └── view_statistics_movies_rate_item.xml
│ │ ├── layout-sw600dp/
│ │ │ └── fragment_statistics_movies.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-notnight/
│ │ │ └── dimens.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ ├── BaseMockTest.kt
│ └── com/
│ └── michaldrabik/
│ └── ui_statistics_movies/
│ ├── StatisticsMoviesViewModelTest.kt
│ └── cases/
│ └── StatisticsMoviesLoadRatingsCaseTest.kt
├── ui-streamings/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_streamings/
│ │ ├── recycler/
│ │ │ ├── StreamingAdapter.kt
│ │ │ └── StreamingItemDiffCallback.kt
│ │ └── views/
│ │ └── StreamingView.kt
│ └── res/
│ ├── drawable/
│ │ ├── bg_streaming.xml
│ │ └── bg_streaming_ripple.xml
│ ├── layout/
│ │ └── view_streaming.xml
│ ├── layout-sw600dp/
│ │ └── view_streaming.xml
│ ├── values/
│ │ └── dimens.xml
│ └── values-sw600dp/
│ └── dimens.xml
├── ui-trakt-sync/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── michaldrabik/
│ │ │ └── ui_trakt_sync/
│ │ │ ├── TraktSyncFragment.kt
│ │ │ ├── TraktSyncUiEvent.kt
│ │ │ ├── TraktSyncUiState.kt
│ │ │ ├── TraktSyncViewModel.kt
│ │ │ ├── cases/
│ │ │ │ └── TraktSyncRatingsCase.kt
│ │ │ └── views/
│ │ │ └── NotificationsRationaleView.kt
│ │ └── res/
│ │ ├── drawable/
│ │ │ └── ic_sync.xml
│ │ ├── layout/
│ │ │ ├── fragment_trakt_sync.xml
│ │ │ └── view_trakt_notifications_rationale.xml
│ │ ├── values/
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── values-ar/
│ │ │ └── strings.xml
│ │ ├── values-de/
│ │ │ └── strings.xml
│ │ ├── values-es/
│ │ │ └── strings.xml
│ │ ├── values-fi/
│ │ │ └── strings.xml
│ │ ├── values-fr/
│ │ │ └── strings.xml
│ │ ├── values-it/
│ │ │ └── strings.xml
│ │ ├── values-pl/
│ │ │ └── strings.xml
│ │ ├── values-pt/
│ │ │ └── strings.xml
│ │ ├── values-ru/
│ │ │ └── strings.xml
│ │ ├── values-sw600dp/
│ │ │ └── dimens.xml
│ │ ├── values-tr/
│ │ │ └── strings.xml
│ │ ├── values-uk/
│ │ │ └── strings.xml
│ │ ├── values-vi/
│ │ │ └── strings.xml
│ │ └── values-zh/
│ │ └── strings.xml
│ └── test/
│ └── java/
│ ├── BaseMockTest.kt
│ └── com/
│ └── michaldrabik/
│ └── ui_trakt_sync/
│ └── TraktSyncViewModelTest.kt
├── ui-widgets/
│ ├── .gitignore
│ ├── build.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── michaldrabik/
│ │ └── ui_widgets/
│ │ ├── BaseWidgetProvider.kt
│ │ ├── calendar/
│ │ │ ├── CalendarWidgetProvider.kt
│ │ │ ├── CalendarWidgetService.kt
│ │ │ └── CalendarWidgetViewsFactory.kt
│ │ ├── calendar_movies/
│ │ │ ├── CalendarMoviesWidgetProvider.kt
│ │ │ ├── CalendarMoviesWidgetService.kt
│ │ │ └── CalendarMoviesWidgetViewsFactory.kt
│ │ ├── progress/
│ │ │ ├── ProgressWidgetEpisodeCheckService.kt
│ │ │ ├── ProgressWidgetProvider.kt
│ │ │ ├── ProgressWidgetService.kt
│ │ │ └── ProgressWidgetViewsFactory.kt
│ │ ├── progress_movies/
│ │ │ ├── ProgressMoviesWidgetCheckService.kt
│ │ │ ├── ProgressMoviesWidgetProvider.kt
│ │ │ ├── ProgressMoviesWidgetService.kt
│ │ │ └── ProgressMoviesWidgetViewsFactory.kt
│ │ └── search/
│ │ └── SearchWidgetProvider.kt
│ └── res/
│ ├── drawable/
│ │ ├── bg_widget.xml
│ │ ├── bg_widget_0.xml
│ │ ├── bg_widget_25.xml
│ │ ├── bg_widget_50.xml
│ │ ├── bg_widget_75.xml
│ │ ├── bg_widget_check_button.xml
│ │ ├── bg_widget_media_view_elevation.xml
│ │ ├── bg_widget_search.xml
│ │ └── bg_widget_toolbar.xml
│ ├── layout/
│ │ ├── layout_widget_calendar.xml
│ │ ├── layout_widget_calendar_item.xml
│ │ ├── layout_widget_header.xml
│ │ ├── layout_widget_movies_calendar.xml
│ │ ├── layout_widget_movies_calendar_item.xml
│ │ ├── layout_widget_movies_progress.xml
│ │ ├── layout_widget_movies_progress_item.xml
│ │ ├── layout_widget_progress.xml
│ │ ├── layout_widget_progress_item.xml
│ │ ├── widget_calendar_day.xml
│ │ ├── widget_calendar_item_day.xml
│ │ ├── widget_calendar_item_night.xml
│ │ ├── widget_calendar_night.xml
│ │ ├── widget_header_day.xml
│ │ ├── widget_header_night.xml
│ │ ├── widget_loading_item.xml
│ │ ├── widget_movies_calendar_day.xml
│ │ ├── widget_movies_calendar_item_day.xml
│ │ ├── widget_movies_calendar_item_night.xml
│ │ ├── widget_movies_calendar_night.xml
│ │ ├── widget_movies_progress_day.xml
│ │ ├── widget_movies_progress_item_day.xml
│ │ ├── widget_movies_progress_item_night.xml
│ │ ├── widget_movies_progress_night.xml
│ │ ├── widget_progress_day.xml
│ │ ├── widget_progress_item_day.xml
│ │ ├── widget_progress_item_night.xml
│ │ ├── widget_progress_night.xml
│ │ └── widget_search.xml
│ ├── values/
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-ar/
│ │ └── strings.xml
│ ├── values-de/
│ │ └── strings.xml
│ ├── values-es/
│ │ └── strings.xml
│ ├── values-it/
│ │ └── strings.xml
│ ├── values-pl/
│ │ └── strings.xml
│ ├── values-vi/
│ │ └── strings.xml
│ └── xml/
│ ├── calendar_movies_widgets_provider.xml
│ ├── calendar_widgets_provider.xml
│ ├── progress_movies_widgets_provider.xml
│ ├── progress_widgets_provider.xml
│ └── search_widgets_provider.xml
└── versions.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
[*.{kt,kts}]
indent_size=2
insert_final_newline=true
max_line_length=150
disabled_rules=import-ordering
================================================
FILE: .github/ISSUE_TEMPLATE/bug-problem-report.md
================================================
---
name: Bug/Problem Report
about: Create a report of bug/problem you have encountered
title: ''
labels: ''
assignees: ''
---
If you have an idea for a new feature or how to improve the app please use [Discussions](https://github.com/michaldrabik/showly-2.0/discussions) for that purpose.
**Describe the bug**
A clear description of what the problem is.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
================================================
FILE: .gitignore
================================================
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
ktlint2.jar
/app/keystore.properties
/app/keystore
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: README.md
================================================


> [!NOTE]
> Since the official Showly app is now open source (only APK on GitHub, not the PlayStore version), this fork becomes obsolete and will therefor be archived. You can download the latest OSS version from the [official repo](https://github.com/michaldrabik/showly/releases).
# Showly OSS
Showly 2.0 is modern, slick, open source Android TV Shows Tracker.
This fork gets rid of all proprietary tracking libraries.
## Screenshots
## Project Setup
1. Clone repository and open project in the latest version of Android Studio.
2. Create `keystore.properties` file and put it in the `/app` folder.
3. Add following properties into `keystore.properties` file (values are not important at this moment):
```
keyAlias=github
keyPassword=github
storePassword=github
```
4. Add your [Trakt.tv](https://trakt.tv/oauth/applications), [TMDB](https://developers.themoviedb.org/3/), [OMDB](http://www.omdbapi.com) and [Reddit](https://www.reddit.com/prefs/apps) API keys as following properties into your `local.properties` file located in the root directory of the project:
```
traktClientId="your trakt client id"
traktClientSecret="your trakt client secret"
tmdbApiKey="your tmdb api key (v4)"
omdbApiKey="your omdb api key"
redditClientId="your reddit client id"
```
5. Rebuild and start the app.
## Issues & Contributions
Feel free to post problems with the app as Github [Issues](https://github.com/1RandomDev/showly-oss/issues).
Features ideas should be posted as new Github [Discussion](https://github.com/michaldrabik/showly-2.0/discussions).
Pull requests are welcome. Remember about leaving a comment in the relevant issue if you are working on something.
### Language Translations
We're always looking for help with translating app into more languages.
If you are interested in helping now or in the future, please visit our CrowdIn project and join:
https://crwd.in/showly-android-app
## FAQ
**1. Can I watch/stream/download shows and movies with Showly app?**
No, that is not possible. Showly is a progress tracking type of app - not a streaming service.
**2. Show/Episode/Movie I'm looking for seems to be missing. What can I do?**
Showly uses [Trakt.tv](https://trakt.tv) as its main data source.
If something is missing please use "Import Show" / "Import Movie" option located at the bottom of Trakt.tv website.
It's also possible to contact Trakt.tv support about any related issue.
================================================
FILE: app/.gitignore
================================================
/build
/release
================================================
FILE: app/build.gradle
================================================
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.google.devtools.ksp'
id 'dagger.hilt.android.plugin'
}
apply from: '../versions.gradle'
android {
kotlinOptions { jvmTarget = "17" }
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
buildFeatures {
buildConfig = true
viewBinding true
}
hilt {
enableExperimentalClasspathAggregation = true
}
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.michaldrabik.showly_oss"
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
compileSdkVersion versions.compileSdk
compileSdkVersion versions.compileSdk
versionCode versions.versionCode
versionName versions.versionName
resourceConfigurations += ['en', 'ar', 'de', 'es', 'fi', 'fr', 'it', 'pl', 'pt', 'ru', 'tr', 'zh', 'uk', 'vi']
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-debug'
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_gray",
appIconRound: "@mipmap/ic_launcher_round_gray"
]
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher",
appIconRound: "@mipmap/ic_launcher_round"
]
}
}
lint {
checkReleaseBuilds false
}
namespace 'com.michaldrabik.showly_oss'
}
dependencies {
implementation project(':common')
implementation project(':data-remote')
implementation project(':data-local')
implementation project(':repository')
implementation project(':ui-base')
implementation project(':ui-model')
implementation project(':ui-navigation')
implementation project(':ui-trakt-sync')
implementation project(':ui-discover')
implementation project(':ui-discover-movies')
implementation project(':ui-episodes')
implementation project(':ui-comments')
implementation project(':ui-lists')
implementation project(':ui-show')
implementation project(':ui-movie')
implementation project(':ui-gallery')
implementation project(':ui-my-shows')
implementation project(':ui-my-movies')
implementation project(':ui-search')
implementation project(':ui-statistics')
implementation project(':ui-statistics-movies')
implementation project(':ui-settings')
implementation project(':ui-progress')
implementation project(':ui-progress-movies')
implementation project(':ui-premium')
implementation project(':ui-news')
implementation project(':ui-widgets')
implementation libs.hilt.android
ksp libs.hilt.compiler
implementation libs.hilt.work
ksp libs.hilt.work.compiler
testImplementation libs.bundles.testing
androidTestImplementation libs.android.test.runner
// debugImplementation "com.squareup.leakcanary:leakcanary-android:$versions.leakCanary"
coreLibraryDesugaring libs.android.desugar
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn okhttp3.internal.platform.ConscryptPlatform
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
================================================
FILE: app/src/main/assets/release_notes.txt
================================================
* Fix issue where actors list of shows and movies would not return to its scrolled position
* Other bugfixes
Do you enjoy Showly and want to support the one and only developer?
Become a Premium user and gain access to cool bonus features! Check Settings to learn more!
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/App.kt
================================================
package com.michaldrabik.showly_oss
import android.app.Application
import android.app.NotificationChannel
import android.os.Build
import android.os.StrictMode
import androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import com.jakewharton.processphoenix.ProcessPhoenix
import com.michaldrabik.repository.settings.SettingsRepository
import com.michaldrabik.ui_base.common.AppScopeProvider
import com.michaldrabik.ui_base.common.WidgetsProvider
import com.michaldrabik.ui_base.utilities.extensions.notificationManager
import com.michaldrabik.ui_model.Settings
import com.michaldrabik.ui_widgets.calendar.CalendarWidgetProvider
import com.michaldrabik.ui_widgets.calendar_movies.CalendarMoviesWidgetProvider
import com.michaldrabik.ui_widgets.progress.ProgressWidgetProvider
import com.michaldrabik.ui_widgets.progress_movies.ProgressMoviesWidgetProvider
import dagger.hilt.android.HiltAndroidApp
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import timber.log.Timber
import javax.inject.Inject
import com.michaldrabik.ui_base.fcm.NotificationChannel as AppNotificationChannel
@HiltAndroidApp
class App :
Application(),
AppScopeProvider,
Configuration.Provider,
WidgetsProvider {
override val appScope = MainScope()
@Inject lateinit var workerFactory: HiltWorkerFactory
@Inject lateinit var settingsRepository: SettingsRepository
override fun onCreate() {
fun setupSettings() = runBlocking {
if (!settingsRepository.isInitialized()) {
settingsRepository.update(Settings.createInitial())
}
}
fun setupStrictMode() {
if (BuildConfig.DEBUG) {
StrictMode
.setThreadPolicy(
StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build()
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
StrictMode.setVmPolicy(
StrictMode.VmPolicy.Builder()
.detectUnsafeIntentLaunch()
.penaltyDeath()
.build()
)
}
}
}
fun setupNotificationChannels() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
fun createChannel(channel: AppNotificationChannel) =
NotificationChannel(
/* id = */ channel.name,
/* name = */ channel.displayName,
/* importance = */ channel.importance
).apply {
description = channel.description
}
notificationManager().run {
createNotificationChannel(createChannel(AppNotificationChannel.GENERAL_INFO))
createNotificationChannel(createChannel(AppNotificationChannel.SHOWS_INFO))
createNotificationChannel(createChannel(AppNotificationChannel.EPISODES_ANNOUNCEMENTS))
createNotificationChannel(createChannel(AppNotificationChannel.MOVIES_ANNOUNCEMENTS))
}
}
fun setupTheme() {
setDefaultNightMode(settingsRepository.theme)
}
super.onCreate()
if (ProcessPhoenix.isPhoenixProcess(this)) return
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
setupSettings()
setupStrictMode()
setupNotificationChannels()
setupTheme()
}
override fun requestShowsWidgetsUpdate() {
appScope.launch {
ProgressWidgetProvider.requestUpdate(applicationContext)
CalendarWidgetProvider.requestUpdate(applicationContext)
}
}
override fun requestMoviesWidgetsUpdate() {
appScope.launch {
ProgressMoviesWidgetProvider.requestUpdate(applicationContext)
CalendarMoviesWidgetProvider.requestUpdate(applicationContext)
}
}
override fun getWorkManagerConfiguration() =
Configuration.Builder()
.setWorkerFactory(workerFactory)
.build()
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/di/module/PreferencesModule.kt
================================================
package com.michaldrabik.showly_oss.di.module
import android.content.Context
import android.content.SharedPreferences
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Named
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
class PreferencesModule {
@Provides
@Singleton
@Named("tipsPreferences")
fun providesTutorialsPreferences(@ApplicationContext context: Context): SharedPreferences =
context.applicationContext.getSharedPreferences(
"PREFERENCES_TUTORIALS",
Context.MODE_PRIVATE
)
@Provides
@Singleton
@Named("watchlistPreferences")
fun providesProgressShowsPreferences(@ApplicationContext context: Context): SharedPreferences =
context.applicationContext.getSharedPreferences(
"PREFERENCES_WATCHLIST",
Context.MODE_PRIVATE
)
@Provides
@Singleton
@Named("progressOnHoldPreferences")
fun providesProgressShowsOnHoldPreferences(@ApplicationContext context: Context): SharedPreferences =
context.applicationContext.getSharedPreferences(
"PREFERENCES_PROGRESS_SHOWS_ON_HOLD",
Context.MODE_PRIVATE
)
@Provides
@Singleton
@Named("progressMoviesPreferences")
fun providesProgressMoviesPreferences(@ApplicationContext context: Context): SharedPreferences =
context.applicationContext.getSharedPreferences(
"PREFERENCES_PROGRESS_MOVIES",
Context.MODE_PRIVATE
)
@Provides
@Singleton
@Named("miscPreferences")
fun providesMiscPreferences(@ApplicationContext context: Context): SharedPreferences =
context.applicationContext.getSharedPreferences(
"PREFERENCES_MISC",
Context.MODE_PRIVATE
)
@Provides
@Singleton
@Named("spoilersPreferences")
fun providesSpoilersPreferences(@ApplicationContext context: Context): SharedPreferences =
context.applicationContext.getSharedPreferences(
"PREFERENCES_SPOILERS",
Context.MODE_PRIVATE
)
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/di/module/ServicesModule.kt
================================================
package com.michaldrabik.showly_oss.di.module
import android.content.Context
import android.net.ConnectivityManager
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
class ServicesModule {
@Provides
@Singleton
fun providesConnectivityManager(@ApplicationContext context: Context) =
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/di/module/WorkModule.kt
================================================
package com.michaldrabik.showly_oss.di.module
import android.content.Context
import androidx.work.WorkManager
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
class WorkModule {
@Provides
@Singleton
fun providesWorkManager(@ApplicationContext context: Context) =
WorkManager.getInstance(context)
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/fcm/FcmExtra.kt
================================================
package com.michaldrabik.showly_oss.fcm
enum class FcmExtra(val key: String) {
SHOW_ID("extra_show_id")
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/BaseActivity.kt
================================================
package com.michaldrabik.showly_oss.ui
import android.annotation.SuppressLint
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.fragment.findNavController
import com.michaldrabik.showly_oss.R
import com.michaldrabik.showly_oss.fcm.FcmExtra
import com.michaldrabik.ui_base.Logger
import com.michaldrabik.ui_base.common.OnTraktAuthorizeListener
import com.michaldrabik.ui_navigation.java.NavigationArgs.ARG_MOVIE_ID
import com.michaldrabik.ui_navigation.java.NavigationArgs.ARG_SHOW_ID
import com.michaldrabik.ui_widgets.BaseWidgetProvider.Companion.EXTRA_MOVIE_ID
import com.michaldrabik.ui_widgets.BaseWidgetProvider.Companion.EXTRA_SHOW_ID
import com.michaldrabik.ui_widgets.search.SearchWidgetProvider
abstract class BaseActivity : AppCompatActivity() {
private val actionKeys = arrayOf(
FcmExtra.SHOW_ID.key,
EXTRA_SHOW_ID,
EXTRA_MOVIE_ID
)
protected fun findNavHostFragment() = supportFragmentManager.findFragmentById(R.id.navigationHost) as? NavHostFragment
protected abstract fun handleSearchWidgetClick(bundle: Bundle?)
fun handleNotification(extras: Bundle?, action: () -> Unit = {}) {
if (extras == null) return
if (extras.containsKey(SearchWidgetProvider.EXTRA_WIDGET_SEARCH_CLICK)) {
handleSearchWidgetClick(extras)
return
}
actionKeys.forEach {
if (extras.containsKey(it)) {
handleShowMovieExtra(extras, it, action)
}
}
}
@SuppressLint("RestrictedApi")
private fun handleShowMovieExtra(extras: Bundle, key: String, action: () -> Unit) {
val itemId = extras.getString(key)?.toLong() ?: -1
val bundle = Bundle().apply {
putLong(ARG_SHOW_ID, itemId)
putLong(ARG_MOVIE_ID, itemId)
}
findNavHostFragment()?.findNavController()?.run {
try {
val isShow = key in arrayOf(EXTRA_SHOW_ID, FcmExtra.SHOW_ID.key)
if (isShow) {
navigate(R.id.actionNavigateShowDetailsFragment, bundle)
} else {
navigate(R.id.actionNavigateMovieDetailsFragment, bundle)
}
extras.clear()
action()
} catch (error: Throwable) {
Logger.record(error, "BaseActivity::handleShowMovieExtra()")
}
}
}
protected fun handleTraktAuthorization(authData: Uri?) {
findNavHostFragment()?.findNavController()?.currentDestination?.id?.let {
val navHost = supportFragmentManager.findFragmentById(R.id.navigationHost)
navHost?.childFragmentManager?.primaryNavigationFragment?.let {
if (authData.toString().startsWith("showlyoss://trakt")) {
(it as? OnTraktAuthorizeListener)?.onAuthorizationResult(authData)
}
}
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/MainActivity.kt
================================================
package com.michaldrabik.showly_oss.ui.main
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import androidx.activity.addCallback
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import androidx.navigation.fragment.findNavController
import androidx.work.WorkManager
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.BaseTransientBottomBar.LENGTH_INDEFINITE
import com.michaldrabik.common.Config
import com.michaldrabik.common.Mode
import com.michaldrabik.common.Mode.MOVIES
import com.michaldrabik.common.Mode.SHOWS
import com.michaldrabik.repository.settings.SettingsRepository
import com.michaldrabik.showly_oss.R
import com.michaldrabik.showly_oss.databinding.ActivityMainBinding
import com.michaldrabik.showly_oss.ui.BaseActivity
import com.michaldrabik.showly_oss.ui.main.delegates.MainTipsDelegate
import com.michaldrabik.showly_oss.ui.main.delegates.TipsDelegate
import com.michaldrabik.showly_oss.ui.views.WhatsNewView
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkResolver
import com.michaldrabik.ui_base.Logger
import com.michaldrabik.ui_base.common.OnShowsMoviesSyncedListener
import com.michaldrabik.ui_base.common.OnTabReselectedListener
import com.michaldrabik.ui_base.events.Event
import com.michaldrabik.ui_base.events.EventsManager
import com.michaldrabik.ui_base.events.ShowsMoviesSyncComplete
import com.michaldrabik.ui_base.events.TraktQuickSyncSuccess
import com.michaldrabik.ui_base.events.TraktSyncAuthError
import com.michaldrabik.ui_base.network.NetworkStatusProvider
import com.michaldrabik.ui_base.sync.ShowsMoviesSyncWorker
import com.michaldrabik.ui_base.utilities.ModeHost
import com.michaldrabik.ui_base.utilities.MoviesStatusHost
import com.michaldrabik.ui_base.utilities.NavigationHost
import com.michaldrabik.ui_base.utilities.SnackbarHost
import com.michaldrabik.ui_base.utilities.extensions.dimenToPx
import com.michaldrabik.ui_base.utilities.extensions.fadeIn
import com.michaldrabik.ui_base.utilities.extensions.fadeOut
import com.michaldrabik.ui_base.utilities.extensions.onClick
import com.michaldrabik.ui_base.utilities.extensions.openWebUrl
import com.michaldrabik.ui_base.utilities.extensions.showErrorSnackbar
import com.michaldrabik.ui_base.utilities.extensions.showInfoSnackbar
import com.michaldrabik.ui_base.utilities.extensions.visibleIf
import com.michaldrabik.ui_settings.helpers.AppLanguage
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject
@AndroidEntryPoint
class MainActivity :
BaseActivity(),
SnackbarHost,
NavigationHost,
ModeHost,
MoviesStatusHost,
TipsDelegate by MainTipsDelegate() {
companion object {
private const val NAVIGATION_TRANSITION_DURATION_MS = 350L
private const val ARG_NAVIGATION_VISIBLE = "ARG_NAVIGATION_VISIBLE"
}
private val viewModel by viewModels()
private lateinit var binding: ActivityMainBinding
private val navigationHeightPad by lazy { dimenToPx(R.dimen.bottomNavigationHeightPadded) }
private val navigationHeight by lazy { dimenToPx(R.dimen.bottomNavigationHeight) }
private val decelerateInterpolator by lazy { DecelerateInterpolator(2F) }
@Inject lateinit var workManager: WorkManager
@Inject lateinit var eventsManager: EventsManager
@Inject lateinit var deepLinkResolver: DeepLinkResolver
@Inject lateinit var settingsRepository: SettingsRepository
@Inject lateinit var networkStatusProvider: NetworkStatusProvider
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
//onUpdateDownloaded() TODO: Implement own updater from GitHub
registerTipsDelegate(viewModel, binding)
setupViewModel()
setupNavigation()
setupView()
setupNetworkObserver()
restoreState(savedInstanceState)
onNewIntent(intent)
}
override fun onStart() {
super.onStart()
ShowsMoviesSyncWorker.schedule(workManager)
}
override fun onResume() {
super.onResume()
setupBackPressed()
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleAppShortcut(intent)
handleNotification(intent?.extras) { hideNavigation(false) }
handleTraktAuthorization(intent?.data)
handleDeepLink(intent)
}
override fun onDestroy() {
lifecycle.removeObserver(networkStatusProvider)
super.onDestroy()
}
private fun setupViewModel() {
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
launch { viewModel.uiState.collect { render(it) } }
launch { eventsManager.events.collect { handleEvent(it) } }
}
}
viewModel.initialize()
viewModel.refreshTraktSyncSchedule()
}
private fun setupView() {
with(binding.bottomMenuView) {
isModeMenuEnabled = hasMoviesEnabled()
onModeSelected = { setMode(it) }
}
binding.viewMask.onClick { /* NOOP */ }
}
private fun setupNetworkObserver() {
lifecycle.addObserver(networkStatusProvider)
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
launch {
networkStatusProvider.status.collect {
binding.statusView.visibleIf(!it)
binding.statusView.text = getString(R.string.errorNoInternetConnection)
}
}
}
}
}
private fun setupNavigation() {
findNavControl()?.run {
val graph = navInflater.inflate(R.navigation.navigation_graph).apply {
val destination = when (viewModel.getMode()) {
SHOWS -> R.id.progressMainFragment
MOVIES -> R.id.progressMoviesMainFragment
else -> throw IllegalStateException()
}
setStartDestination(destination)
}
setGraph(graph, Bundle.EMPTY)
}
with(binding.bottomMenuView.binding.bottomNavigationView) {
setOnItemSelectedListener { item ->
if (selectedItemId == item.itemId) {
doForFragments { (it as? OnTabReselectedListener)?.onTabReselected() }
return@setOnItemSelectedListener true
}
val target = when (item.itemId) {
R.id.menuProgress -> getMenuProgressAction()
R.id.menuDiscover -> getMenuDiscoverAction()
R.id.menuCollection -> getMenuCollectionAction()
R.id.menuNews -> R.id.actionNavigateNewsFragment
else -> throw IllegalStateException("Invalid menu item.")
}
findNavControl()?.navigate(target)
showNavigation(true)
if (item.itemId == R.id.menuDiscover) {
// Try showing rate app dialog when user navigates to Discover section.
viewModel.checkRateApp()
}
return@setOnItemSelectedListener true
}
menu.findItem(R.id.menuNews).isVisible = viewModel.hasNewsEnabled()
}
}
private fun setupBackPressed() {
with(binding) {
onBackPressedDispatcher.addCallback(this@MainActivity) {
if (tutorialView.isVisible) {
tutorialView.fadeOut()
return@addCallback
}
findNavControl()?.run {
when (currentDestination?.id) {
R.id.discoverFragment,
R.id.discoverMoviesFragment,
R.id.followedShowsFragment,
R.id.followedMoviesFragment,
R.id.listsFragment,
R.id.newsFragment,
-> {
bottomMenuView.binding.bottomNavigationView.selectedItemId = R.id.menuProgress
}
else -> {
remove()
super.onBackPressed()
}
}
}
}
}
}
override fun hideNavigation(animate: Boolean) {
with(binding) {
hideAllTips()
bottomMenuView.binding.bottomNavigationView.run {
isEnabled = false
isClickable = false
}
snackbarHost.translationY = navigationHeight.toFloat()
bottomNavigationWrapper.animate().translationYBy(navigationHeightPad.toFloat())
.setDuration(if (animate) NAVIGATION_TRANSITION_DURATION_MS else 0)
.setInterpolator(decelerateInterpolator).start()
}
}
override fun showNavigation(animate: Boolean) {
showAllTips()
binding.bottomMenuView.binding.bottomNavigationView.run {
isEnabled = true
isClickable = true
}
binding.snackbarHost.translationY = 0F
binding.bottomNavigationWrapper
.animate()
.translationY(0F)
.setDuration(if (animate) NAVIGATION_TRANSITION_DURATION_MS else 0)
.setInterpolator(decelerateInterpolator).start()
}
override fun navigateToDiscover() {
binding.bottomMenuView.binding.bottomNavigationView.selectedItemId = R.id.menuDiscover
}
override fun setMode(mode: Mode, force: Boolean) {
if (force || viewModel.getMode() != mode) {
viewModel.setMode(mode)
val target = when (binding.bottomMenuView.binding.bottomNavigationView.selectedItemId) {
R.id.menuDiscover -> getMenuDiscoverAction()
R.id.menuCollection -> getMenuCollectionAction()
R.id.menuProgress -> getMenuProgressAction()
R.id.menuNews -> R.id.actionNavigateNewsFragment
else -> 0
}
if (target != 0) {
findNavControl()?.navigate(target)
}
}
}
override fun getMode() = viewModel.getMode()
override fun hasMoviesEnabled() = viewModel.hasMoviesEnabled()
private fun render(uiState: MainUiState) {
with(binding) {
uiState.run {
isLoading.let {
mainProgress.visibleIf(it)
}
showMask.let {
viewMask.visibleIf(it)
}
isInitialRun?.let {
if (it.consume() == true) {
viewModel.checkInitialLanguage()
}
}
showWhatsNew?.let {
if (it.consume() == true) showWhatsNewDialog()
}
initialLanguage?.let { event ->
event.consume()?.let {
showWelcomeDialog(it)
}
}
openLink?.let { event ->
event.consume()?.let { bundle ->
findNavHostFragment()?.findNavController()?.let { nav ->
bundle.show?.let {
deepLinkResolver.resolveDestination(nav, bottomMenuView.binding.bottomNavigationView, it)
}
bundle.movie?.let {
deepLinkResolver.resolveDestination(nav, bottomMenuView.binding.bottomNavigationView, it)
}
}
}
}
}
}
}
private fun showWelcomeDialog(language: AppLanguage) {
navigateToDiscover()
with(binding.welcomeView) {
setLanguage(language)
fadeIn()
onOkClickListener = {
fadeOut()
showMask(false)
if (language != AppLanguage.ENGLISH) {
showWelcomeLanguageDialog(language)
}
}
}
showMask(true)
}
private fun showWelcomeLanguageDialog(language: AppLanguage) {
with(binding.welcomeLanguageView) {
setLanguage(language)
fadeIn()
onYesClick = {
viewModel.setLanguage(language)
fadeOut()
showMask(false)
}
onNoClick = {
viewModel.setLanguage(AppLanguage.ENGLISH)
fadeOut()
showMask(false)
}
}
showMask(true)
}
private fun showMask(show: Boolean) {
binding.viewMask.visibleIf(show)
if (!show) viewModel.clearMask()
}
@SuppressLint("MissingSuperCall")
override fun onSaveInstanceState(outState: Bundle) {
outState.putBoolean(ARG_NAVIGATION_VISIBLE, binding.bottomNavigationWrapper.translationY == 0F)
super.onSaveInstanceState(outState)
}
private fun restoreState(savedInstanceState: Bundle?) {
val isNavigationVisible = savedInstanceState?.getBoolean(ARG_NAVIGATION_VISIBLE, true) ?: true
if (!isNavigationVisible) hideNavigation(true)
}
private fun doForFragments(action: (Fragment) -> Unit) {
findNavControl()?.currentDestination?.id?.let {
val navHost = supportFragmentManager.findFragmentById(R.id.navigationHost)
navHost?.childFragmentManager?.primaryNavigationFragment?.let { action(it) }
}
}
private fun handleEvent(event: Event) {
when (event) {
is ShowsMoviesSyncComplete -> {
if (event.count > 0) {
doForFragments { (it as? OnShowsMoviesSyncedListener)?.onShowsMoviesSyncFinished() }
}
viewModel.refreshAnnouncements()
}
is TraktQuickSyncSuccess -> {
val message = resources.getQuantityString(R.plurals.textTraktQuickSyncComplete, event.count, event.count)
provideSnackbarLayout().showInfoSnackbar(message)
}
is TraktSyncAuthError -> {
provideSnackbarLayout().showErrorSnackbar(getString(R.string.errorTraktAuthorization))
}
else -> Timber.d("Event ignored. Noop.")
}
}
private fun handleAppShortcut(intent: Intent?) {
when {
intent == null -> return
intent.extras?.containsKey("extraShortcutProgress") == true ->
binding.bottomMenuView.binding.bottomNavigationView.selectedItemId = R.id.menuProgress
intent.extras?.containsKey("extraShortcutDiscover") == true ->
binding.bottomMenuView.binding.bottomNavigationView.selectedItemId = R.id.menuDiscover
intent.extras?.containsKey("extraShortcutCollection") == true ->
binding.bottomMenuView.binding.bottomNavigationView.selectedItemId = R.id.menuCollection
intent.extras?.containsKey("extraShortcutSearch") == true -> {
binding.bottomMenuView.binding.bottomNavigationView.selectedItemId = R.id.menuDiscover
val action = when (viewModel.getMode()) {
SHOWS -> R.id.actionDiscoverFragmentToSearchFragment
MOVIES -> R.id.actionDiscoverMoviesFragmentToSearchFragment
else -> throw IllegalStateException()
}
findNavControl()?.navigate(action)
}
}
}
override fun handleSearchWidgetClick(bundle: Bundle?) {
findNavHostFragment()?.findNavController()?.run {
try {
when (currentDestination?.id) {
R.id.searchFragment -> return@run
R.id.showDetailsFragment, R.id.movieDetailsFragment -> navigateUp()
}
if (currentDestination?.id != R.id.discoverFragment) {
binding.bottomMenuView.binding.bottomNavigationView.selectedItemId = R.id.menuDiscover
}
when (currentDestination?.id) {
R.id.discoverFragment -> navigate(R.id.actionDiscoverFragmentToSearchFragment)
R.id.discoverMoviesFragment -> navigate(R.id.actionDiscoverMoviesFragmentToSearchFragment)
}
bundle?.clear()
} catch (error: Throwable) {
Logger.record(error, "BaseActivity::handleSearchWidgetClick()")
}
}
}
private fun showWhatsNewDialog() {
MaterialAlertDialogBuilder(this, R.style.AlertDialog).setBackground(ContextCompat.getDrawable(this, R.drawable.bg_dialog))
.setView(WhatsNewView(this)).setCancelable(false).setPositiveButton(R.string.textClose) { _, _ -> }
.setNeutralButton("GitHub") { _, _ -> openWebUrl(Config.GITHUB_URL) }.show()
}
private fun getMenuDiscoverAction() = when (viewModel.getMode()) {
SHOWS -> R.id.actionNavigateDiscoverFragment
MOVIES -> R.id.actionNavigateDiscoverMoviesFragment
else -> throw IllegalStateException()
}
private fun getMenuCollectionAction() = when (viewModel.getMode()) {
SHOWS -> R.id.actionNavigateFollowedShowsFragment
MOVIES -> R.id.actionNavigateFollowedMoviesFragment
else -> throw IllegalStateException()
}
private fun getMenuProgressAction() = when (viewModel.getMode()) {
SHOWS -> R.id.actionNavigateProgressFragment
MOVIES -> R.id.actionNavigateProgressMoviesFragment
else -> throw IllegalStateException()
}
private fun onUpdateDownloaded() {
provideSnackbarLayout().showInfoSnackbar(
message = getString(R.string.textUpdateDownloaded), actionText = R.string.textUpdateInstall, length = LENGTH_INDEFINITE
) {
// TODO: Implement own updater from GitHub
}
}
private fun handleDeepLink(intent: Intent?) {
deepLinkResolver.findSource(intent)?.let {
viewModel.openDeepLink(it)
}
}
override fun findNavControl() = findNavHostFragment()?.findNavController()
override fun provideSnackbarLayout(): ViewGroup = binding.snackbarHost
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/MainUiState.kt
================================================
package com.michaldrabik.showly_oss.ui.main
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkBundle
import com.michaldrabik.ui_base.utilities.events.Event
import com.michaldrabik.ui_settings.helpers.AppLanguage
// TODO Split events into their Channel
data class MainUiState(
val isLoading: Boolean = false,
val isInitialRun: Event? = null,
val showWhatsNew: Event? = null,
val initialLanguage: Event? = null,
val showRateApp: Event? = null,
val showMask: Boolean = false,
val openLink: Event? = null,
)
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/MainViewModel.kt
================================================
package com.michaldrabik.showly_oss.ui.main
import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.os.LocaleListCompat
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.michaldrabik.common.Mode
import com.michaldrabik.repository.settings.SettingsRepository
import com.michaldrabik.showly_oss.ui.main.cases.MainAnnouncementsCase
import com.michaldrabik.showly_oss.ui.main.cases.MainClearingCase
import com.michaldrabik.showly_oss.ui.main.cases.MainInitialsCase
import com.michaldrabik.showly_oss.ui.main.cases.MainModesCase
import com.michaldrabik.showly_oss.ui.main.cases.MainRateAppCase
import com.michaldrabik.showly_oss.ui.main.cases.MainSettingsCase
import com.michaldrabik.showly_oss.ui.main.cases.MainTipsCase
import com.michaldrabik.showly_oss.ui.main.cases.MainTraktCase
import com.michaldrabik.showly_oss.ui.main.cases.deeplink.MainDeepLinksCase
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkBundle
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkSource
import com.michaldrabik.ui_base.Logger
import com.michaldrabik.ui_base.utilities.events.Event
import com.michaldrabik.ui_base.utilities.extensions.SUBSCRIBE_STOP_TIMEOUT
import com.michaldrabik.ui_base.utilities.extensions.combine
import com.michaldrabik.ui_base.utilities.extensions.launchDelayed
import com.michaldrabik.ui_base.utilities.extensions.rethrowCancellation
import com.michaldrabik.ui_model.Tip
import com.michaldrabik.ui_settings.helpers.AppLanguage
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import javax.inject.Inject
@SuppressLint("StaticFieldLeak")
@HiltViewModel
class MainViewModel @Inject constructor(
private val initCase: MainInitialsCase,
private val tipsCase: MainTipsCase,
private val traktCase: MainTraktCase,
private val clearingCase: MainClearingCase,
private val settingsCase: MainSettingsCase,
private val announcementsCase: MainAnnouncementsCase,
private val modesCase: MainModesCase,
private val rateAppCase: MainRateAppCase,
private val linksCase: MainDeepLinksCase,
private val settingsRepository: SettingsRepository,
) : ViewModel() {
private val loadingState = MutableStateFlow(false)
private val maskState = MutableStateFlow(false)
private val initialRunEvent = MutableStateFlow?>(null)
private val initialLanguageEvent = MutableStateFlow?>(null)
private val whatsNewEvent = MutableStateFlow?>(null)
private val rateAppEvent = MutableStateFlow?>(null)
private val openLinkEvent = MutableStateFlow?>(null)
fun initialize() {
viewModelScope.launch {
val isInitialRun = checkInitialRun()
with(initCase) {
preloadRatings()
saveInstallTimestamp()
}
checkApi13Locale(isInitialRun)
}
}
private suspend fun checkInitialRun(): Boolean {
val isInitialRun = initCase.isInitialRun()
if (isInitialRun) {
initCase.setInitialRun(false)
initCase.setInitialNotifications()
initCase.setInitialCountry()
}
val showWhatsNew = initCase.showWhatsNew(isInitialRun)
initialRunEvent.value = Event(isInitialRun)
whatsNewEvent.value = Event(showWhatsNew)
return isInitialRun
}
fun checkRateApp() {
val showRateApp = rateAppCase.shouldShowRateApp()
rateAppEvent.value = Event(showRateApp)
}
fun setLanguage(appLanguage: AppLanguage) = initCase.setLanguage(appLanguage)
fun checkInitialLanguage() {
viewModelScope.launch {
val initialLanguage = initCase.checkInitialLanguage()
initialLanguageEvent.value = Event(initialLanguage)
maskState.value = true
}
}
private fun checkApi13Locale(isInitialRun: Boolean) {
if (!isInitialRun && !settingsRepository.isLocaleInitialised) {
settingsRepository.isLocaleInitialised = true
val locale = LocaleListCompat.forLanguageTags(settingsRepository.language)
AppCompatDelegate.setApplicationLocales(locale)
}
}
fun refreshAnnouncements() {
viewModelScope.launch {
announcementsCase.refreshAnnouncements()
}
}
fun refreshTraktSyncSchedule() {
viewModelScope.launch {
traktCase.run {
refreshTraktSyncSchedule()
refreshTraktQuickSync()
}
}
}
fun setMode(mode: Mode) = modesCase.setMode(mode)
fun getMode(): Mode = modesCase.getMode()
fun isTipShown(tip: Tip) = tipsCase.isTipShown(tip)
fun setTipShown(tip: Tip) = tipsCase.setTipShown(tip)
fun hasMoviesEnabled(): Boolean = settingsCase.hasMoviesEnabled()
fun hasNewsEnabled(): Boolean = settingsCase.hasNewsEnabled()
fun completeAppRate() = rateAppCase.complete()
fun clearMask() {
maskState.value = false
}
fun openDeepLink(source: DeepLinkSource) {
viewModelScope.launch {
val progressJob = launchDelayed(750) {
loadingState.value = true
maskState.value = true
}
try {
val result = when (source) {
is DeepLinkSource.ImdbSource -> linksCase.findById(source.id)
is DeepLinkSource.TmdbSource -> linksCase.findById(source.id, source.type)
is DeepLinkSource.TraktSource -> linksCase.findById(source.id, source.type)
}
loadingState.value = false
maskState.value = false
openLinkEvent.value = Event(result)
} catch (error: Throwable) {
Logger.record(error, "MainViewModel::openDeepLink:$source")
rethrowCancellation(error)
} finally {
progressJob.cancelAndJoin()
}
}
}
override fun onCleared() {
clearingCase.clear()
super.onCleared()
}
val uiState = combine(
initialRunEvent,
initialLanguageEvent,
whatsNewEvent,
rateAppEvent,
openLinkEvent,
loadingState,
maskState
) { s1, s2, s3, s4, s5, s6, s7 ->
MainUiState(
isInitialRun = s1,
initialLanguage = s2,
showWhatsNew = s3,
showRateApp = s4,
openLink = s5,
isLoading = s6,
showMask = s7
)
}.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(SUBSCRIBE_STOP_TIMEOUT),
initialValue = MainUiState()
)
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/MainAnnouncementsCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import com.michaldrabik.common.dispatchers.CoroutineDispatchers
import com.michaldrabik.ui_base.notifications.AnnouncementManager
import dagger.hilt.android.scopes.ViewModelScoped
import kotlinx.coroutines.withContext
import javax.inject.Inject
@ViewModelScoped
class MainAnnouncementsCase @Inject constructor(
private val dispatchers: CoroutineDispatchers,
private val announcementManager: AnnouncementManager,
) {
suspend fun refreshAnnouncements() {
withContext(dispatchers.IO) {
announcementManager.refreshShowsAnnouncements()
announcementManager.refreshMoviesAnnouncements()
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/MainClearingCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import com.michaldrabik.repository.images.MovieImagesProvider
import com.michaldrabik.repository.images.ShowImagesProvider
import dagger.hilt.android.scopes.ViewModelScoped
import timber.log.Timber
import javax.inject.Inject
@ViewModelScoped
class MainClearingCase @Inject constructor(
private val showImagesProvider: ShowImagesProvider,
private val movieImagesProvider: MovieImagesProvider,
) {
fun clear() {
showImagesProvider.clear()
movieImagesProvider.clear()
Timber.d("Clearing...")
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/MainInitialsCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import android.content.Context
import android.content.SharedPreferences
import android.telephony.TelephonyManager
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.edit
import androidx.core.os.LocaleListCompat
import com.michaldrabik.common.Config
import com.michaldrabik.common.extensions.nowUtc
import com.michaldrabik.common.extensions.nowUtcMillis
import com.michaldrabik.repository.RatingsRepository
import com.michaldrabik.repository.UserTraktManager
import com.michaldrabik.repository.settings.SettingsRepository
import com.michaldrabik.showly_oss.BuildConfig
import com.michaldrabik.ui_base.common.AppCountry
import com.michaldrabik.ui_base.utilities.extensions.withApiAtLeast
import com.michaldrabik.ui_settings.helpers.AppLanguage
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.android.scopes.ViewModelScoped
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.launch
import kotlinx.coroutines.supervisorScope
import timber.log.Timber
import java.util.Locale
import javax.inject.Inject
import javax.inject.Named
@ViewModelScoped
class MainInitialsCase @Inject constructor(
@ApplicationContext private val context: Context,
private val userTraktManager: UserTraktManager,
private val ratingsRepository: RatingsRepository,
private val settingsRepository: SettingsRepository,
@Named("miscPreferences") private var miscPreferences: SharedPreferences,
) {
suspend fun setInitialRun(value: Boolean) {
val settings = settingsRepository.load()
settings.let {
settingsRepository.update(it.copy(isInitialRun = value))
}
}
suspend fun isInitialRun(): Boolean {
val settings = settingsRepository.load()
return settings.isInitialRun
}
fun setInitialCountry() {
var country = (context.getSystemService(Context.TELEPHONY_SERVICE) as? TelephonyManager)?.simCountryIso
if (country == null) {
val locale = LocaleListCompat.getAdjustedDefault()
country = if (locale.size() > 1) {
locale.get(1)?.country
} else {
locale.get(0)?.country
}
}
if (!country.isNullOrBlank()) {
AppCountry.values().forEach { appCountry ->
if (appCountry.code.equals(country, ignoreCase = true)) {
settingsRepository.country = appCountry.code
return
}
}
}
}
suspend fun setInitialNotifications() {
withApiAtLeast(33) {
val settings = settingsRepository.load()
settings.let {
settingsRepository.update(it.copy(episodesNotificationsEnabled = false))
}
}
}
fun setLanguage(appLanguage: AppLanguage) {
settingsRepository.language = appLanguage.code
val locales = LocaleListCompat.forLanguageTags(appLanguage.code)
AppCompatDelegate.setApplicationLocales(locales)
}
fun checkInitialLanguage(): AppLanguage {
val locales = LocaleListCompat.getAdjustedDefault()
val appLanguages = AppLanguage.values()
if (locales.size() == 1 && !locales[0]?.language.equals(Locale("en").language)) {
appLanguages.forEach { appLanguage ->
if (appLanguage.code.equals(locales[0]?.language, ignoreCase = true)) {
return appLanguage
}
}
}
if (locales.size() > 1) {
val languagesCodes = arrayOf(locales[0], locales[1])
.filterNotNull()
.map { it.language.lowercase() }
if (languagesCodes.any { it != Locale(Config.DEFAULT_LANGUAGE).language }) {
val languageCodes = appLanguages.map { it.code }
languagesCodes.forEach { language ->
if (language in languageCodes) {
return appLanguages.first { it.code == language }
}
}
appLanguages
.filter { it.code != Config.DEFAULT_LANGUAGE }
.forEach { appLanguage ->
if (appLanguage.code in languagesCodes) {
return appLanguage
}
}
}
}
return AppLanguage.ENGLISH
}
suspend fun preloadRatings() = supervisorScope {
val errorHandler = CoroutineExceptionHandler { _, _ -> Timber.e("Failed to preload.") }
if (!userTraktManager.isAuthorized()) {
return@supervisorScope
}
userTraktManager.checkAuthorization()
launch(errorHandler) { ratingsRepository.shows.preloadRatings() }
if (settingsRepository.isMoviesEnabled) {
launch(errorHandler) { ratingsRepository.movies.preloadRatings() }
}
}
fun showWhatsNew(isInitialRun: Boolean): Boolean {
val keyAppVersion = "APP_VERSION"
val keyAppVersionName = "APP_VERSION_NAME"
val version = miscPreferences.getInt(keyAppVersion, 0)
val name = miscPreferences.getString(keyAppVersionName, "")
fun isPatchUpdate(): Boolean {
if (name.isNullOrBlank()) return false
val major = name.split(".").getOrNull(0)?.toIntOrNull()
val minor = name.split(".").getOrNull(1)?.toIntOrNull()
val currentMajor = BuildConfig.VERSION_NAME.split(".").getOrNull(0)?.toIntOrNull()
val currentMinor = BuildConfig.VERSION_NAME.split(".").getOrNull(1)?.toIntOrNull()
if (major == currentMajor && minor == currentMinor) return true
return false
}
miscPreferences.edit {
putInt(keyAppVersion, BuildConfig.VERSION_CODE).apply()
putString(keyAppVersionName, BuildConfig.VERSION_NAME).apply()
}
if (Config.SHOW_WHATS_NEW &&
BuildConfig.VERSION_CODE > version &&
BuildConfig.VERSION_NAME != name &&
!isInitialRun &&
!isPatchUpdate()
) {
return true
}
return false
}
fun saveInstallTimestamp() {
if (settingsRepository.installTimestamp == 0L) {
settingsRepository.installTimestamp = nowUtcMillis()
Timber.d("Installation timestamp saved: ${nowUtc()}")
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/MainModesCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import com.michaldrabik.common.Mode
import com.michaldrabik.common.Mode.MOVIES
import com.michaldrabik.common.Mode.SHOWS
import com.michaldrabik.repository.settings.SettingsRepository
import dagger.hilt.android.scopes.ViewModelScoped
import javax.inject.Inject
@ViewModelScoped
class MainModesCase @Inject constructor(
private val settingsRepository: SettingsRepository,
) {
fun setMode(mode: Mode) {
settingsRepository.mode = mode
}
fun getMode(): Mode {
val isMoviesEnabled = settingsRepository.isMoviesEnabled
val isMovies = settingsRepository.mode == MOVIES
return if (isMoviesEnabled && isMovies) MOVIES else SHOWS
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/MainRateAppCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import android.content.SharedPreferences
import com.michaldrabik.common.extensions.nowUtcMillis
import dagger.hilt.android.scopes.ViewModelScoped
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Named
@ViewModelScoped
class MainRateAppCase @Inject constructor(
@Named("miscPreferences") private var miscPreferences: SharedPreferences
) {
companion object {
const val KEY_RATE_APP_COUNT = "KEY_RATE_APP_COUNT"
const val KEY_RATE_APP_TIMESTAMP = "KEY_RATE_APP_TIMESTAMP"
const val MAX_COUNT = 3
}
fun shouldShowRateApp(): Boolean {
val count = miscPreferences.getInt(KEY_RATE_APP_COUNT, 0)
val timestamp = miscPreferences.getLong(KEY_RATE_APP_TIMESTAMP, -1)
val isPastTwoWeeks = nowUtcMillis() - timestamp > TimeUnit.DAYS.toMillis(14)
if (timestamp == -1L) {
updateTimestamp(count)
return false
}
if (count < MAX_COUNT && isPastTwoWeeks) {
updateTimestamp(count)
return true
}
return false
}
private fun updateTimestamp(count: Int) {
miscPreferences.edit().apply {
putInt(KEY_RATE_APP_COUNT, count)
putLong(KEY_RATE_APP_TIMESTAMP, nowUtcMillis())
apply()
}
}
fun complete() {
val count = miscPreferences.getInt(KEY_RATE_APP_COUNT, 0)
updateTimestamp(count + 1)
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/MainSettingsCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import com.michaldrabik.repository.settings.SettingsRepository
import com.michaldrabik.showly_oss.BuildConfig
import dagger.hilt.android.scopes.ViewModelScoped
import javax.inject.Inject
@ViewModelScoped
class MainSettingsCase @Inject constructor(
private val settingsRepository: SettingsRepository,
) {
fun hasMoviesEnabled() = settingsRepository.isMoviesEnabled
fun hasNewsEnabled(): Boolean {
if (BuildConfig.DEBUG) return true
return settingsRepository.isNewsEnabled && settingsRepository.isPremium
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/MainTipsCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import android.content.SharedPreferences
import com.michaldrabik.common.Config
import com.michaldrabik.showly_oss.BuildConfig
import com.michaldrabik.ui_model.Tip
import dagger.hilt.android.scopes.ViewModelScoped
import javax.inject.Inject
import javax.inject.Named
@ViewModelScoped
class MainTipsCase @Inject constructor(
@Named("tipsPreferences") private val sharedPreferences: SharedPreferences
) {
fun isTipShown(tip: Tip) = when {
BuildConfig.DEBUG -> !Config.SHOW_TIPS_DEBUG
else -> sharedPreferences.getBoolean(tip.name, false)
}
fun setTipShown(tip: Tip) {
sharedPreferences.edit().putBoolean(tip.name, true).apply()
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/MainTraktCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import androidx.work.WorkManager
import com.michaldrabik.repository.settings.SettingsRepository
import com.michaldrabik.ui_base.trakt.TraktSyncWorker
import com.michaldrabik.ui_base.trakt.quicksync.QuickSyncManager
import com.michaldrabik.ui_base.trakt.quicksync.QuickSyncWorker
import dagger.hilt.android.scopes.ViewModelScoped
import javax.inject.Inject
@ViewModelScoped
class MainTraktCase @Inject constructor(
private val settingsRepository: SettingsRepository,
private val quickSyncManager: QuickSyncManager,
private val workManager: WorkManager,
) {
suspend fun refreshTraktSyncSchedule() {
if (!settingsRepository.isInitialized()) return
val schedule = settingsRepository.load().traktSyncSchedule
TraktSyncWorker.schedulePeriodic(workManager, schedule, cancelExisting = false)
}
suspend fun refreshTraktQuickSync() {
if (quickSyncManager.isAnyScheduled()) {
QuickSyncWorker.schedule(workManager)
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/deeplink/ImdbDeepLinkCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases.deeplink
import com.michaldrabik.data_local.sources.MoviesLocalDataSource
import com.michaldrabik.data_local.sources.ShowsLocalDataSource
import com.michaldrabik.data_remote.trakt.TraktRemoteDataSource
import com.michaldrabik.repository.mappers.Mappers
import com.michaldrabik.repository.movies.MovieDetailsRepository
import com.michaldrabik.repository.shows.ShowDetailsRepository
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkBundle
import com.michaldrabik.ui_model.IdImdb
import javax.inject.Inject
class ImdbDeepLinkCase @Inject constructor(
private val traktRemoteSource: TraktRemoteDataSource,
private val showsLocalSource: ShowsLocalDataSource,
private val moviesLocalSource: MoviesLocalDataSource,
private val showDetailsRepository: ShowDetailsRepository,
private val movieDetailsRepository: MovieDetailsRepository,
private val mappers: Mappers
) {
companion object {
private const val SEARCH_ID_TYPE = "imdb"
}
suspend fun findById(imdbId: IdImdb): DeepLinkBundle {
val show = showDetailsRepository.find(imdbId)
if (show != null) {
return DeepLinkBundle(show = show)
}
val movie = movieDetailsRepository.find(imdbId)
if (movie != null) {
return DeepLinkBundle(movie = movie)
}
val searchResult = traktRemoteSource.fetchSearchId(SEARCH_ID_TYPE, imdbId.id)
if (searchResult.size == 1) {
val showSearch = searchResult[0].show
val movieSearch = searchResult[0].movie
when {
showSearch != null -> {
val uiShow = mappers.show.fromNetwork(showSearch)
showsLocalSource.upsert(listOf(mappers.show.toDatabase(uiShow)))
return DeepLinkBundle(show = uiShow)
}
movieSearch != null -> {
val uiMovie = mappers.movie.fromNetwork(movieSearch)
moviesLocalSource.upsert(listOf(mappers.movie.toDatabase(uiMovie)))
return DeepLinkBundle(movie = uiMovie)
}
}
}
return DeepLinkBundle.EMPTY
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/deeplink/MainDeepLinksCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases.deeplink
import com.michaldrabik.ui_model.IdImdb
import com.michaldrabik.ui_model.IdSlug
import com.michaldrabik.ui_model.IdTmdb
import dagger.hilt.android.scopes.ViewModelScoped
import javax.inject.Inject
@ViewModelScoped
class MainDeepLinksCase @Inject constructor(
private val imdbDeepLinkCase: ImdbDeepLinkCase,
private val tmdbDeepLinkCase: TmdbDeepLinkCase,
private val traktDeepLinkCase: TraktDeepLinkCase,
) {
suspend fun findById(imdbId: IdImdb) =
imdbDeepLinkCase.findById(imdbId)
suspend fun findById(tmdbId: IdTmdb, type: String) =
tmdbDeepLinkCase.findById(tmdbId, type)
suspend fun findById(traktSlug: IdSlug, type: String) =
traktDeepLinkCase.findById(traktSlug, type)
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/deeplink/TmdbDeepLinkCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases.deeplink
import com.michaldrabik.data_local.sources.MoviesLocalDataSource
import com.michaldrabik.data_local.sources.ShowsLocalDataSource
import com.michaldrabik.data_remote.trakt.TraktRemoteDataSource
import com.michaldrabik.repository.mappers.Mappers
import com.michaldrabik.repository.movies.MovieDetailsRepository
import com.michaldrabik.repository.shows.ShowDetailsRepository
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkBundle
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkResolver.Companion.TMDB_TYPE_MOVIE
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkResolver.Companion.TMDB_TYPE_TV
import com.michaldrabik.ui_model.IdTmdb
import javax.inject.Inject
class TmdbDeepLinkCase @Inject constructor(
private val traktRemoteSource: TraktRemoteDataSource,
private val showsLocalSource: ShowsLocalDataSource,
private val moviesLocalSource: MoviesLocalDataSource,
private val showDetailsRepository: ShowDetailsRepository,
private val movieDetailsRepository: MovieDetailsRepository,
private val mappers: Mappers
) {
companion object {
private const val SEARCH_ID_TYPE = "tmdb"
}
suspend fun findById(tmdbId: IdTmdb, type: String): DeepLinkBundle {
val localShow = showDetailsRepository.find(tmdbId)
if (localShow != null && type == TMDB_TYPE_TV) {
return DeepLinkBundle(show = localShow)
}
val localMovie = movieDetailsRepository.find(tmdbId)
if (localMovie != null && type == TMDB_TYPE_MOVIE) {
return DeepLinkBundle(movie = localMovie)
}
val searchResult = traktRemoteSource.fetchSearchId(SEARCH_ID_TYPE, tmdbId.id.toString())
if (searchResult.isNotEmpty()) {
searchResult
.filter { it.show != null || it.movie != null }
.forEach { result ->
val show = result.show
val movie = result.movie
if (show != null && type == TMDB_TYPE_TV) {
val uiShow = mappers.show.fromNetwork(show)
showsLocalSource.upsert(listOf(mappers.show.toDatabase(uiShow)))
return DeepLinkBundle(show = uiShow)
}
if (movie != null && type == TMDB_TYPE_MOVIE) {
val uiMovie = mappers.movie.fromNetwork(movie)
moviesLocalSource.upsert(listOf(mappers.movie.toDatabase(uiMovie)))
return DeepLinkBundle(movie = uiMovie)
}
}
}
return DeepLinkBundle.EMPTY
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/cases/deeplink/TraktDeepLinkCase.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases.deeplink
import com.michaldrabik.data_local.sources.MoviesLocalDataSource
import com.michaldrabik.data_local.sources.ShowsLocalDataSource
import com.michaldrabik.data_remote.trakt.TraktRemoteDataSource
import com.michaldrabik.repository.mappers.Mappers
import com.michaldrabik.repository.movies.MovieDetailsRepository
import com.michaldrabik.repository.shows.ShowDetailsRepository
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkBundle
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkResolver.Companion.TRAKT_TYPE_MOVIE
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkResolver.Companion.TRAKT_TYPE_TV
import com.michaldrabik.ui_model.IdSlug
import javax.inject.Inject
class TraktDeepLinkCase @Inject constructor(
private val traktRemoteSource: TraktRemoteDataSource,
private val showsLocalSource: ShowsLocalDataSource,
private val moviesLocalSource: MoviesLocalDataSource,
private val showDetailsRepository: ShowDetailsRepository,
private val movieDetailsRepository: MovieDetailsRepository,
private val mappers: Mappers
) {
suspend fun findById(traktSlug: IdSlug, type: String) = when (type) {
TRAKT_TYPE_TV -> {
val localShow = showDetailsRepository.find(traktSlug)
if (localShow != null) {
DeepLinkBundle(show = localShow)
}
try {
val show = traktRemoteSource.fetchShow(traktSlug.id)
val uiShow = mappers.show.fromNetwork(show)
showsLocalSource.upsert(listOf(mappers.show.toDatabase(uiShow)))
DeepLinkBundle(show = uiShow)
} catch (error: Throwable) {
DeepLinkBundle.EMPTY
}
}
TRAKT_TYPE_MOVIE -> {
val localMovie = movieDetailsRepository.find(traktSlug)
if (localMovie != null) {
DeepLinkBundle(movie = localMovie)
}
try {
val movie = traktRemoteSource.fetchMovie(traktSlug.id)
val uiMovie = mappers.movie.fromNetwork(movie)
moviesLocalSource.upsert(listOf(mappers.movie.toDatabase(uiMovie)))
DeepLinkBundle(movie = uiMovie)
} catch (error: Throwable) {
DeepLinkBundle.EMPTY
}
}
else -> DeepLinkBundle.EMPTY
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/main/delegates/TipsDelegate.kt
================================================
package com.michaldrabik.showly_oss.ui.main.delegates
import androidx.lifecycle.DefaultLifecycleObserver
import com.michaldrabik.showly_oss.databinding.ActivityMainBinding
import com.michaldrabik.showly_oss.ui.main.MainViewModel
import com.michaldrabik.ui_base.utilities.TipsHost
import com.michaldrabik.ui_base.utilities.extensions.gone
import com.michaldrabik.ui_base.utilities.extensions.onClick
import com.michaldrabik.ui_base.utilities.extensions.visibleIf
import com.michaldrabik.ui_model.Tip
interface TipsDelegate : TipsHost {
fun registerTipsDelegate(
viewModel: MainViewModel,
binding: ActivityMainBinding,
)
fun showAllTips()
fun hideAllTips()
}
class MainTipsDelegate : TipsDelegate, DefaultLifecycleObserver {
private lateinit var viewModel: MainViewModel
private lateinit var binding: ActivityMainBinding
private val tips by lazy {
mapOf(
Tip.MENU_DISCOVER to binding.tutorialTipDiscover,
Tip.MENU_MY_SHOWS to binding.tutorialTipMyShows,
Tip.MENU_MODES to binding.tutorialTipModeMenu
)
}
override fun registerTipsDelegate(
viewModel: MainViewModel,
binding: ActivityMainBinding,
) {
this.viewModel = viewModel
this.binding = binding
setupTips()
}
private fun setupTips() {
tips.entries.forEach { (tip, view) ->
view.visibleIf(!isTipShown(tip))
view.onClick {
it.gone()
showTip(tip)
}
}
}
override fun setTipShow(tip: Tip) = viewModel.setTipShown(tip)
override fun isTipShown(tip: Tip) = viewModel.isTipShown(tip)
override fun showTip(tip: Tip) {
binding.tutorialView.showTip(tip)
setTipShow(tip)
}
override fun showAllTips() {
tips.entries.forEach { (tip, view) -> view.visibleIf(!isTipShown(tip)) }
}
override fun hideAllTips() {
tips.values.forEach { it.gone() }
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/views/BottomMenuView.kt
================================================
package com.michaldrabik.showly_oss.ui.views
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.MotionEvent.ACTION_CANCEL
import android.view.MotionEvent.ACTION_DOWN
import android.view.MotionEvent.ACTION_MOVE
import android.view.MotionEvent.ACTION_UP
import android.view.ViewGroup
import android.view.ViewPropertyAnimator
import android.widget.FrameLayout
import androidx.core.view.children
import com.google.android.material.bottomnavigation.BottomNavigationItemView
import com.michaldrabik.common.Mode
import com.michaldrabik.showly_oss.R
import com.michaldrabik.showly_oss.databinding.ViewBottomMenuBinding
import com.michaldrabik.ui_base.utilities.extensions.add
import com.michaldrabik.ui_base.utilities.extensions.colorFromAttr
import com.michaldrabik.ui_base.utilities.extensions.fadeIn
import com.michaldrabik.ui_base.utilities.extensions.fadeOut
import com.michaldrabik.ui_base.utilities.extensions.screenWidth
import com.michaldrabik.ui_base.utilities.extensions.visible
import kotlin.math.abs
class BottomMenuView : FrameLayout {
companion object {
private const val SWIPE_MIN_THRESHOLD = 150F
private const val FADE_DELAY = 150L
}
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
val binding = ViewBottomMenuBinding.inflate(LayoutInflater.from(context), this)
var isModeMenuEnabled = true
var onModeSelected: ((Mode) -> Unit)? = null
private val screenWidth by lazy { screenWidth() }
private val itemIdleColor by lazy { context.colorFromAttr(R.attr.colorBottomMenuItem) }
private val itemSelectedColor by lazy { context.colorFromAttr(R.attr.colorBottomMenuItemChecked) }
private val animations = mutableListOf()
private var touchX = 0F
private var isModeMenu = false
override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
if (!isModeMenuEnabled) return super.onInterceptTouchEvent(ev)
when (ev?.actionMasked) {
ACTION_DOWN -> {
touchX = ev.x
isModeMenu = false
disableTooltips()
}
ACTION_MOVE -> {
val delta = ev.x - touchX
if (!isModeMenu && abs(delta) > SWIPE_MIN_THRESHOLD) {
isModeMenu = true
showModeMenu()
}
with(binding) {
if (isModeMenu) {
if (ev.x > screenWidth / 2) {
bottomMenuModeShows.setTextColor(itemIdleColor)
bottomMenuModeMovies.setTextColor(itemSelectedColor)
} else {
bottomMenuModeShows.setTextColor(itemSelectedColor)
bottomMenuModeMovies.setTextColor(itemIdleColor)
}
}
}
}
ACTION_UP, ACTION_CANCEL -> {
if (isModeMenu) {
hideModeMenu()
isModeMenu = false
when {
ev.x > screenWidth / 2 -> onModeSelected?.invoke(Mode.MOVIES)
else -> onModeSelected?.invoke(Mode.SHOWS)
}
}
}
}
return super.onInterceptTouchEvent(ev)
}
private fun showModeMenu() {
with(binding) {
bottomMenuModeShows.setTextColor(itemIdleColor)
bottomMenuModeMovies.setTextColor(itemIdleColor)
bottomNavigationView.fadeOut(FADE_DELAY).add(animations)
bottomMenuModeLayout.fadeIn(FADE_DELAY).add(animations)
}
}
private fun hideModeMenu() {
with(binding) {
with(animations) {
forEach {
it?.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationCancel(animation: Animator) {
bottomNavigationView.visible()
bottomNavigationView.alpha = 1F
}
})
it?.cancel()
}
clear()
}
bottomNavigationView.fadeIn(FADE_DELAY).add(animations)
bottomMenuModeLayout.fadeOut(FADE_DELAY).add(animations)
}
}
private fun disableTooltips() {
val content = binding.bottomNavigationView.getChildAt(0)
if (content is ViewGroup) {
content.children.forEach {
if (it is BottomNavigationItemView) {
it.setOnLongClickListener(null)
}
}
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/views/WelcomeLanguageView.kt
================================================
package com.michaldrabik.showly_oss.ui.views
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.FrameLayout
import com.michaldrabik.showly_oss.R
import com.michaldrabik.showly_oss.databinding.ViewWelcomeLanguageBinding
import com.michaldrabik.ui_base.utilities.extensions.onClick
import com.michaldrabik.ui_settings.helpers.AppLanguage
class WelcomeLanguageView : FrameLayout {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
private val binding = ViewWelcomeLanguageBinding.inflate(LayoutInflater.from(context), this)
var onYesClick: (() -> Unit)? = null
var onNoClick: (() -> Unit)? = null
init {
layoutParams = LayoutParams(MATCH_PARENT, WRAP_CONTENT)
with(binding) {
viewWelcomeLanguageYesButton.onClick { onYesClick?.invoke() }
viewWelcomeLanguageLeaveButton.onClick { onNoClick?.invoke() }
}
}
@SuppressLint("SetTextI18n")
fun setLanguage(appLanguage: AppLanguage) {
// This text will always be English.
binding.viewWelcomeLanguageMessage.text = "It seems like your device\'s language is ${appLanguage.displayNameRaw}.\n" +
"Would you like to use it in Showly app?"
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/views/WelcomeNoteView.kt
================================================
package com.michaldrabik.showly_oss.ui.views
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.FrameLayout
import com.michaldrabik.showly_oss.R
import com.michaldrabik.showly_oss.databinding.ViewWelcomeNoteBinding
import com.michaldrabik.ui_base.utilities.extensions.getLocaleStringResource
import com.michaldrabik.ui_base.utilities.extensions.onClick
import com.michaldrabik.ui_settings.helpers.AppLanguage
import java.util.Locale
class WelcomeNoteView : FrameLayout {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
private val binding = ViewWelcomeNoteBinding.inflate(LayoutInflater.from(context), this)
var onOkClickListener: (() -> Unit)? = null
init {
layoutParams = LayoutParams(MATCH_PARENT, WRAP_CONTENT)
binding.viewWelcomeNoteYesButton.onClick { onOkClickListener?.invoke() }
}
fun setLanguage(language: AppLanguage) {
if (language == AppLanguage.ENGLISH) return
val locale = Locale(language.code)
with(binding) {
viewWelcomeNoteTitle.text = context.getLocaleStringResource(locale, R.string.textDisclaimerTitle)
viewWelcomeNoteMessage.text = context.getLocaleStringResource(locale, R.string.textDisclaimerText)
viewWelcomeNoteYesButton.text = context.getLocaleStringResource(locale, R.string.textDisclaimerConfirmText)
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/ui/views/WhatsNewView.kt
================================================
package com.michaldrabik.showly_oss.ui.views
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.widget.ScrollView
import com.michaldrabik.showly_oss.BuildConfig
import com.michaldrabik.showly_oss.R
import com.michaldrabik.showly_oss.databinding.ViewWhatsNewBinding
@SuppressLint("SetTextI18n")
class WhatsNewView : ScrollView {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
private val binding = ViewWhatsNewBinding.inflate(LayoutInflater.from(context), this)
init {
layoutParams = LayoutParams(MATCH_PARENT, MATCH_PARENT)
val whatsNew = context.assets.open("release_notes.txt")
.bufferedReader()
.use { it.readText() }
with(binding) {
viewWhatsNewMessage.text = whatsNew
viewWhatsNewSubtitle.text = context.getString(R.string.textWhatsNewSubtitle, BuildConfig.VERSION_NAME)
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/utilities/deeplink/DeepLinkBundle.kt
================================================
package com.michaldrabik.showly_oss.utilities.deeplink
import com.michaldrabik.ui_model.Movie
import com.michaldrabik.ui_model.Show
data class DeepLinkBundle(
val show: Show? = null,
val movie: Movie? = null
) {
companion object {
val EMPTY = DeepLinkBundle()
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/utilities/deeplink/DeepLinkResolver.kt
================================================
package com.michaldrabik.showly_oss.utilities.deeplink
import android.content.Intent
import androidx.core.os.bundleOf
import androidx.navigation.NavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.michaldrabik.showly_oss.R
import com.michaldrabik.showly_oss.utilities.deeplink.resolvers.ImdbSourceResolver
import com.michaldrabik.showly_oss.utilities.deeplink.resolvers.TmdbSourceResolver
import com.michaldrabik.showly_oss.utilities.deeplink.resolvers.TraktSourceResolver
import com.michaldrabik.ui_base.Logger
import com.michaldrabik.ui_model.Movie
import com.michaldrabik.ui_model.Show
import com.michaldrabik.ui_navigation.java.NavigationArgs
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class DeepLinkResolver @Inject constructor() {
companion object {
const val TMDB_TYPE_TV = "tv"
const val TMDB_TYPE_MOVIE = "movie"
const val TRAKT_TYPE_TV = "shows"
const val TRAKT_TYPE_MOVIE = "movies"
}
private val sourceResolvers = setOf(
TraktSourceResolver(),
ImdbSourceResolver(),
TmdbSourceResolver()
)
private val progressDestinations = arrayOf(
R.id.progressMainFragment,
R.id.progressMoviesMainFragment,
)
private val mainDestinations = arrayOf(
*progressDestinations,
R.id.discoverFragment,
R.id.discoverMoviesFragment,
R.id.followedShowsFragment,
R.id.followedMoviesFragment,
R.id.listsFragment,
R.id.newsFragment,
)
fun findSource(intent: Intent?): DeepLinkSource? {
val path = intent?.data?.pathSegments ?: emptyList()
return sourceResolvers.firstNotNullOfOrNull { it.resolve(path) }
}
fun resolveDestination(
navController: NavController,
navigationView: BottomNavigationView,
show: Show,
) {
try {
resetNavigation(navController, navigationView)
val navBundle = bundleOf(NavigationArgs.ARG_SHOW_ID to show.traktId)
val actionId = when (navController.currentDestination?.id) {
R.id.progressMainFragment -> R.id.actionProgressFragmentToShowDetailsFragment
R.id.progressMoviesMainFragment -> R.id.actionProgressMoviesFragmentToShowDetailsFragment
else -> error("Unknown actionId. ActionId: ${navController.currentDestination?.id}")
}
navController.navigate(actionId, navBundle)
} catch (error: Throwable) {
Logger.record(error, "DeepLinkResolver::resolveDestination(show:${show.traktId})")
}
}
fun resolveDestination(
navController: NavController,
navigationView: BottomNavigationView,
movie: Movie,
) {
try {
resetNavigation(navController, navigationView)
val navBundle = bundleOf(NavigationArgs.ARG_MOVIE_ID to movie.traktId)
val actionId = when (navController.currentDestination?.id) {
R.id.progressMainFragment -> R.id.actionProgressFragmentToMovieDetailsFragment
R.id.progressMoviesMainFragment -> R.id.actionProgressMoviesFragmentToMovieDetailsFragment
else -> error("Unknown actionId. ActionId: $navController.currentDestination?.id")
}
navController.navigate(actionId, navBundle)
} catch (error: Throwable) {
Logger.record(error, "DeepLinkResolver::resolveDestination(movie:${movie.traktId})")
}
}
private fun resetNavigation(navController: NavController, navigationView: BottomNavigationView) {
while (navController.currentDestination?.id !in mainDestinations) {
navController.popBackStack()
}
if (navController.currentDestination?.id !in progressDestinations) {
navigationView.selectedItemId = R.id.menuProgress
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/utilities/deeplink/DeepLinkSource.kt
================================================
package com.michaldrabik.showly_oss.utilities.deeplink
import com.michaldrabik.ui_model.IdImdb
import com.michaldrabik.ui_model.IdSlug
import com.michaldrabik.ui_model.IdTmdb
sealed class DeepLinkSource {
data class ImdbSource(val id: IdImdb) : DeepLinkSource()
data class TmdbSource(val id: IdTmdb, val type: String) : DeepLinkSource()
data class TraktSource(val id: IdSlug, val type: String) : DeepLinkSource()
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/utilities/deeplink/resolvers/ImdbSourceResolver.kt
================================================
package com.michaldrabik.showly_oss.utilities.deeplink.resolvers
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkSource
import com.michaldrabik.ui_model.IdImdb
class ImdbSourceResolver : SourceResolver {
override fun resolve(linkPath: List): DeepLinkSource? {
if (linkPath.size < 2 || !linkPath[1].startsWith("tt") || linkPath[1].length <= 2) {
return null
}
return DeepLinkSource.ImdbSource(IdImdb(linkPath[1]))
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/utilities/deeplink/resolvers/SourceResolver.kt
================================================
package com.michaldrabik.showly_oss.utilities.deeplink.resolvers
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkSource
interface SourceResolver {
fun resolve(linkPath: List): DeepLinkSource?
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/utilities/deeplink/resolvers/TmdbSourceResolver.kt
================================================
package com.michaldrabik.showly_oss.utilities.deeplink.resolvers
import androidx.core.text.isDigitsOnly
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkResolver
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkSource
import com.michaldrabik.ui_model.IdTmdb
class TmdbSourceResolver : SourceResolver {
override fun resolve(linkPath: List): DeepLinkSource? {
if (linkPath.size < 2 ||
!(linkPath[0] == DeepLinkResolver.TMDB_TYPE_TV || linkPath[0] == DeepLinkResolver.TMDB_TYPE_MOVIE) ||
linkPath[1].length <= 1
) {
return null
}
val id = linkPath[1].substringBefore("-").trim()
val type = linkPath[0]
return if (id.isDigitsOnly()) {
DeepLinkSource.TmdbSource(IdTmdb(id.toLong()), type)
} else {
null
}
}
}
================================================
FILE: app/src/main/java/com/michaldrabik/showly_oss/utilities/deeplink/resolvers/TraktSourceResolver.kt
================================================
package com.michaldrabik.showly_oss.utilities.deeplink.resolvers
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkResolver
import com.michaldrabik.showly_oss.utilities.deeplink.DeepLinkSource
import com.michaldrabik.ui_model.IdSlug
class TraktSourceResolver : SourceResolver {
override fun resolve(linkPath: List): DeepLinkSource? {
if (linkPath.size < 2 || !(linkPath[0] == DeepLinkResolver.TRAKT_TYPE_TV || linkPath[0] == DeepLinkResolver.TRAKT_TYPE_MOVIE)) {
return null
}
return DeepLinkSource.TraktSource(IdSlug(linkPath[1]), linkPath[0])
}
}
================================================
FILE: app/src/main/play/release-notes/en-GB/default.txt
================================================
* Fix issue where actors list of shows and movies would not return to its scrolled position
* Other bugfixes
================================================
FILE: app/src/main/res/drawable/bg_dialog.xml
================================================
================================================
FILE: app/src/main/res/drawable/ic_eye_off.xml
================================================
================================================
FILE: app/src/main/res/drawable/ic_languages.xml
================================================
================================================
FILE: app/src/main/res/drawable/ic_launcher_foreground.xml
================================================
================================================
FILE: app/src/main/res/drawable/ic_launcher_mono.xml
================================================
================================================
FILE: app/src/main/res/drawable/selector_bottom_menu.xml
================================================
================================================
FILE: app/src/main/res/layout/activity_main.xml
================================================
================================================
FILE: app/src/main/res/layout/view_bottom_menu.xml
================================================
================================================
FILE: app/src/main/res/layout/view_welcome_language.xml
================================================
================================================
FILE: app/src/main/res/layout/view_welcome_note.xml
================================================
================================================
FILE: app/src/main/res/layout/view_whats_new.xml
================================================
================================================
FILE: app/src/main/res/menu/bottom_navigation_menu.xml
================================================
================================================
FILE: app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
================================================
================================================
FILE: app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
================================================
================================================
FILE: app/src/main/res/values/dimens.xml
================================================
@dimen/spaceBig
- 0.2
- 0.55
- 0.925
================================================
FILE: app/src/main/res/values/ic_launcher_background.xml
================================================
#27282C
================================================
FILE: app/src/main/res/values/strings.xml
================================================
Showly OSS
Progress
Discover
Collection
News
Enjoying Showly 2.0?
Would you like to rate the app?\nIt only takes a few seconds. Thanks!\n\nThe app will not be closed.
Sure, why not?
Not now
Welcome!
Please note that you CAN\'T watch, stream or download shows and movies with this app.\n\nUse apps like Netflix to stream and watch content.
OK, I understand
Language can always be changed later via Settings.
No, I prefer English
Yes
What\'s New
Version %s
Discover
Collection
Search
Progress
Update is now available.
Install
================================================
FILE: app/src/main/res/values-ar/strings.xml
================================================
مستوى التقدم
اكتشف
المجموعة
الأخبار
هل تستمتع باستخدام Showly 2.0 ؟
أترغب بِتقييم التطبيق؟\nلن يستغرق التقييم سِوى ثوانٍ قليلة مِن وقتك. شكرًا!\n\nلن يُغلق التطبيق.
بالطبع، لما لا؟
ليس الآن
أهلًا بك!
يرجى مُلاحظة أن هذا التطبيق غير مُخصص لِمُشاهدة أو تحميل الأفلام والمُسلسلات.\n\nيُمكنك اِستخدام تطبيقات مثل Netflix لهذه الأمور.
حسنًا، فهمت
ما الجديد
الإصدار %s
إكتشف
المجموعة
البحث
مستوى التقدم
================================================
FILE: app/src/main/res/values-de/strings.xml
================================================
Fortschritt
Entdecken
Sammlung
News
Gefallt dir Showly 2.0?
Möchtest du die App bewerten?\nEs dauert nur wenige Sekunden. Danke!\n\nDie App wird dabei nicht geschlossen.
Sicher, wieso nicht?
Nicht jetzt
Willkommen!
Bitte beachte, dass du mit dieser App keine Serien und Filme ansehen, streamen oder herunterladen kannst.\n\nVerwende Apps wie Netflix, um Inhalte zu streamen und anzusehen.
OK, ich verstehe
Was gibts Neues?
Version %s
Entdecken
Sammlung
Suche
Fortschritt
================================================
FILE: app/src/main/res/values-es/strings.xml
================================================
Progreso
Descubrir
Colección
Noticias
¿Disfrutando Showly 2.0?
¿Le gustaría calificar la aplicación?\nSolo toma unos segundos. ¡Gracias!\n\nLa aplicación no se cerrará.
Sí, ¿por qué no?
Ahora no
Bienvenido!
Ten en cuenta que NO PUEDES ver, transmitir o descargar series y películas con esta aplicación.\n\nUsa aplicaciones como Netflix para transmitir y ver el contenido.
Vale, lo entiendo
Novedades
Versión %s
Descubrir
Colección
Buscar
Progreso
================================================
FILE: app/src/main/res/values-fi/strings.xml
================================================
Katselutila
Etsi
Kokoelma
Uutiset
Nautitko Showly 2.0:sta?
Haluaisitko arvioida sovelluksen?\nTämä kestää vain muutaman sekunnin. Kiitos!\n\nSovellusta ei suljeta.
Toki, miksipä en?
En nyt
Tervetuloa!
Huomioi, että tällä sovelluksella ET VOI katsella, suoratoistaa tai ladata sarjoja ja elokuvia.\n\nKäytä suoratoistoon ja katseluun Netflixin kaltaisia sovelluksia.
OK, ymmärrän
Mitä uutta
Versio %s
Etsi
Kokoelma
Haku
Katselutila
================================================
FILE: app/src/main/res/values-fr/strings.xml
================================================
Progression
Découvrir
Collection
Actualités
Aimez-vous Showly 2.0 ?
Souhaitez-vous noter l\'application ?\nCela ne prendrait que quelques secondes. Merci !\n\nL\'application ne se fermera pas.
Bien sûr, pourquoi pas ?
Pas maintenant
Bienvenue !
Veuillez prendre note que vous NE POUVEZ PAS regarder ou télécharger des séries ou des films avec cette application.\n\nUtilisez des applications telles que Netflix pour regarder du contenu.
Compris
Quoi de neuf
Version %s
Découvrir
Collection
Recherche
Progression
================================================
FILE: app/src/main/res/values-it/strings.xml
================================================
Progressi
Scopri
Raccolta
Notizie
Ti piace Showly 2.0?
Ti piacerebbe valutare questa app?\nCi vorranno solo pochi secondi. Grazie!\n\nL\'app non verrà chiusa.
Certo, perché no?
Non ora
Benvenuto/a!
Si prega di notare che NON È POSSIBILE guardare, riprodurre o scaricare show e film con questa app.\n\nUsa app come Netflix per riprodurre e guardare i contenuti.
OK, ho capito
Novità
Versione %s
Scopri
Raccolta
Cerca
Progressi
================================================
FILE: app/src/main/res/values-pl/strings.xml
================================================
Postęp
Odkrywaj
Kolekcja
Newsy
Podoba Ci się Showly 2.0?
Czy chciałbyś ocenić aplikację?\nZajmie to tylko kilka sekund. Dziękuję!\n\nAplikacja pozostanie otwarta.
Jasne, czemu nie?
Nie teraz
Witaj!
Pamiętaj, że NIE MOŻESZ oglądać, streamować lub pobierać seriali i filmów z pomocą tej aplikacji.\n\nMożesz użyć aplikacji takich jak Netflix aby streamować i oglądać treści.
OK, rozumiem
Co Nowego?
Wersja %s
Odkrywaj
Kolekcja
Szukaj
Postęp
================================================
FILE: app/src/main/res/values-pt/strings.xml
================================================
Progresso
Explorar
Coleção
Notícias
Curtindo o Showly 2.0?
Gostaria de avaliar o aplicativo?\nLeva apenas alguns segundos. Obrigado!\n\nO aplicativo não será fechado.
Claro, por que não?
Agora não
Bem-vindo!
Observe que você não pode assistir, transmitir ou baixar programas e filmes com este aplicativo.\n\nUse aplicativos como o Netflix para transmitir e assistir conteúdo.
OK, eu entendo
O que há de novo
Versão %s
Explorar
Coleção
Pesquisar
Progresso
================================================
FILE: app/src/main/res/values-ru/strings.xml
================================================
Прогресс
Открытия
Коллекция
Новости
Вам нравится Showly 2.0?
Вы хотите оценить приложение?\nЭто займёт всего несколько секунд. Спасибо!\n\nПриложение не будет закрыто.
Конечно, почему нет?
Позже
Добро пожаловать!
Обратите внимание, что приложение НЕ ПРЕДНАЗНАЧЕНО для просмотра или скачивания сериалов и фильмов.\n\nИспользуйте приложения по типу Netflix, чтобы скачивать и просматривать контент.
Ок, я понял
Что нового
Версия %s
Открытия
Коллекция
Поиск
Прогресс
================================================
FILE: app/src/main/res/values-sw600dp/dimens.xml
================================================
112dp
- 0.32
- 0.55
- 0.77
================================================
FILE: app/src/main/res/values-tr/strings.xml
================================================
İlerleme
Keşfet
Koleksiyon
Haberler
Showly 2.0 uygulamasından memnun musunuz?
Uygulamayı derecelendirmek ister misiniz?\nSadece birkaç saniye sürer. Teşekkürler!\n\n Uygulama kapatılmayacaktır.
Tabii ki, neden olmasın?
Şimdi değil
Hoş geldiniz!
Lütfen bu uygulama ile dizileri ve filmleri izleyemeyeceğinizi veya indiremeyeceğinizi unutmayın!\n\n İçerikleri izlemek için Netflix gibi uygulamaları kullanın.
Tamam, anladım
Neler Yeni
%s Sürümü
Keşfet
Koleksiyon
Ara
İlerleme
================================================
FILE: app/src/main/res/values-uk/strings.xml
================================================
Прогрес
Огляд
Колекція
Новини
Подобається Showly 2.0?
Ви хотіли б оцінити додаток?\nЦе займає лише декілька секунд. Дякуємо!\n\nДодаток не буде закрито.
Авжеж, чому ні?
Не зараз
Вітаємо!
Будь ласка, зверніть увагу, що ви НЕ МОЖЕТЕ дивитися або завантажувати серіали та фільми з цим додатком.\n\nВикористовуйте додатки, такі як Netflix для завантаження та перегляду вмісту.
ОК, зрозуміло
Що нового
Версія: %s
Огляд
Колекція
Пошук
Прогрес
================================================
FILE: app/src/main/res/values-vi/strings.xml
================================================
Showly OSS
Tiến độ
Khám phá
Bộ sưu tập
Tin tức
Bạn có thích Showly 2.0 không?
Bạn có muốn xếp hạng ứng dụng không?\nViệc này chỉ mất vài giây. Cảm ơn!\n\nỨng dụng sẽ không bị đóng.
Chắc chắn rồi, tại sao không?
Không phải bây giờ
Chào mừng!
Xin lưu ý rằng bạn KHÔNG THỂ xem, phát trực tuyến hoặc tải xuống các chương trình và phim bằng ứng dụng này.\n\nSử dụng các ứng dụng như Netflix để phát trực tuyến và xem nội dung.
Được rồi, tôi hiểu
Có gì mới
Phiên bản %s
Khám phá
Bộ sưu tập
Tìm kiếm
Tiến độ
Hiện đã có bản cập nhật.
Cài đặt
================================================
FILE: app/src/main/res/values-zh/strings.xml
================================================
进度
发现
合集
新闻
喜欢 Showly 2.0 吗?
您愿意给应用评分吗?\n仅需几秒,感谢!\n\n应用不会被关闭。
好,没问题。
稍后
欢迎!
请注意您 不能 使用此应用观看或下载剧集和电影。\n\n使用 Netflix 等应用来观看。
好的,我已了解
更新内容
版本:%s
发现
合集
搜索
进度
================================================
FILE: app/src/main/res/xml/locales_config.xml
================================================
================================================
FILE: app/src/main/res/xml/shortcuts.xml
================================================
================================================
FILE: app/src/test/java/BaseMockTest.kt
================================================
import io.mockk.MockKAnnotations
import io.mockk.mockkStatic
import org.junit.Before
@Suppress("EXPERIMENTAL_API_USAGE")
abstract class BaseMockTest {
@Before
open fun setUp() {
MockKAnnotations.init(this)
mockkStatic("androidx.room.RoomDatabaseKt")
}
}
================================================
FILE: app/src/test/java/com/michaldrabik/showly_oss/ui/main/cases/MainRateAppCaseTest.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import BaseMockTest
import android.content.SharedPreferences
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.common.extensions.nowUtcMillis
import com.michaldrabik.showly_oss.ui.main.cases.MainRateAppCase.Companion.KEY_RATE_APP_COUNT
import com.michaldrabik.showly_oss.ui.main.cases.MainRateAppCase.Companion.KEY_RATE_APP_TIMESTAMP
import io.mockk.Runs
import io.mockk.confirmVerified
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.just
import io.mockk.verify
import org.junit.Before
import org.junit.Test
import java.util.concurrent.TimeUnit
class MainRateAppCaseTest : BaseMockTest() {
@MockK
lateinit var sharedPreferences: SharedPreferences
@MockK
lateinit var sharedPreferencesEditor: SharedPreferences.Editor
private lateinit var SUT: MainRateAppCase
@Before
override fun setUp() {
super.setUp()
every { sharedPreferencesEditor.apply() } just Runs
every { sharedPreferencesEditor.putInt(any(), any()) } returns sharedPreferencesEditor
every { sharedPreferencesEditor.putLong(any(), any()) } returns sharedPreferencesEditor
every { sharedPreferences.edit() } returns sharedPreferencesEditor
SUT = MainRateAppCase(sharedPreferences)
}
@Test
fun `Should return false if check is initial`() {
every { sharedPreferences.getInt(KEY_RATE_APP_COUNT, any()) } returns 0
every { sharedPreferences.getLong(KEY_RATE_APP_TIMESTAMP, any()) } returns -1L
val result = SUT.shouldShowRateApp()
assertThat(result).isFalse()
verify { sharedPreferencesEditor.putInt(KEY_RATE_APP_COUNT, 0) }
verify { sharedPreferencesEditor.putLong(KEY_RATE_APP_TIMESTAMP, any()) }
verify { sharedPreferencesEditor.apply() }
confirmVerified(sharedPreferencesEditor)
}
@Test
fun `Should return false if not enough days have passed`() {
every { sharedPreferences.getInt(KEY_RATE_APP_COUNT, any()) } returns 1
every { sharedPreferences.getLong(KEY_RATE_APP_TIMESTAMP, any()) } returns (nowUtcMillis() - TimeUnit.DAYS.toMillis(5))
val result = SUT.shouldShowRateApp()
assertThat(result).isFalse()
verify(exactly = 0) { sharedPreferencesEditor.putInt(KEY_RATE_APP_COUNT, 2) }
verify(exactly = 0) { sharedPreferencesEditor.putLong(KEY_RATE_APP_TIMESTAMP, any()) }
verify(exactly = 0) { sharedPreferencesEditor.apply() }
confirmVerified(sharedPreferencesEditor)
}
@Test
fun `Should return false if not enough days have passed before last reminder`() {
every { sharedPreferences.getInt(KEY_RATE_APP_COUNT, any()) } returns 2
every { sharedPreferences.getLong(KEY_RATE_APP_TIMESTAMP, any()) } returns (nowUtcMillis() - TimeUnit.DAYS.toMillis(12))
val result = SUT.shouldShowRateApp()
assertThat(result).isFalse()
verify(exactly = 0) { sharedPreferencesEditor.putInt(KEY_RATE_APP_COUNT, 3) }
verify(exactly = 0) { sharedPreferencesEditor.putLong(KEY_RATE_APP_TIMESTAMP, any()) }
verify(exactly = 0) { sharedPreferencesEditor.apply() }
confirmVerified(sharedPreferencesEditor)
}
@Test
fun `Should return true if enough days have passed before another reminder`() {
every { sharedPreferences.getInt(KEY_RATE_APP_COUNT, any()) } returns 2
every { sharedPreferences.getLong(KEY_RATE_APP_TIMESTAMP, any()) } returns (nowUtcMillis() - TimeUnit.DAYS.toMillis(15))
val result = SUT.shouldShowRateApp()
assertThat(result).isTrue()
verify(exactly = 1) { sharedPreferencesEditor.putInt(KEY_RATE_APP_COUNT, 2) }
verify(exactly = 1) { sharedPreferencesEditor.putLong(KEY_RATE_APP_TIMESTAMP, any()) }
verify(exactly = 1) { sharedPreferencesEditor.apply() }
confirmVerified(sharedPreferencesEditor)
}
// @Test
// fun `Should return true if count is one before last one and 10 days passed`() {
// every { sharedPreferences.getInt(KEY_RATE_APP_COUNT, any()) } returns 1
// every { sharedPreferences.getLong(KEY_RATE_APP_TIMESTAMP, any()) } returns (nowUtcMillis() - TimeUnit.DAYS.toMillis(11))
//
// val result = SUT.shouldShowRateApp()
//
// assertThat(result).isTrue()
// verify { sharedPreferencesEditor.putInt(KEY_RATE_APP_COUNT, 2) }
// verify { sharedPreferencesEditor.putLong(KEY_RATE_APP_TIMESTAMP, any()) }
// verify { sharedPreferencesEditor.apply() }
//
// confirmVerified(sharedPreferencesEditor)
// }
//
// @Test
// fun `Should return true if count is last one and 14 days passed`() {
// every { sharedPreferences.getInt(KEY_RATE_APP_COUNT, any()) } returns 2
// every { sharedPreferences.getLong(KEY_RATE_APP_TIMESTAMP, any()) } returns (nowUtcMillis() - TimeUnit.DAYS.toMillis(15))
//
// val result = SUT.shouldShowRateApp()
//
// assertThat(result).isTrue()
// verify { sharedPreferencesEditor.putInt(KEY_RATE_APP_COUNT, 3) }
// verify { sharedPreferencesEditor.putLong(KEY_RATE_APP_TIMESTAMP, any()) }
// verify { sharedPreferencesEditor.apply() }
// confirmVerified(sharedPreferencesEditor)
// }
}
================================================
FILE: app/src/test/java/com/michaldrabik/showly_oss/ui/main/cases/MainTipsCaseTest.kt
================================================
package com.michaldrabik.showly_oss.ui.main.cases
import BaseMockTest
import android.content.SharedPreferences
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.showly_oss.BuildConfig
import com.michaldrabik.ui_model.Tip
import io.mockk.Runs
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.just
import io.mockk.verifyAll
import org.junit.Before
import org.junit.Test
class MainTipsCaseTest : BaseMockTest() {
@MockK
lateinit var sharedPreferences: SharedPreferences
@MockK
lateinit var sharedPreferencesEditor: SharedPreferences.Editor
private lateinit var SUT: MainTipsCase
@Before
override fun setUp() {
super.setUp()
every { sharedPreferencesEditor.apply() } just Runs
every { sharedPreferencesEditor.putBoolean(any(), any()) } returns sharedPreferencesEditor
every { sharedPreferences.edit() } returns sharedPreferencesEditor
SUT = MainTipsCase(sharedPreferences)
}
@Test
fun `Should return true if tip has been show`() {
val tip = Tip.MENU_DISCOVER
every { sharedPreferences.getBoolean(tip.name, false) } returns true
assertThat(SUT.isTipShown(tip)).isTrue()
}
@Test
fun `Should return false if tips has not been shown`() {
val tip = Tip.MENU_DISCOVER
every { sharedPreferences.getBoolean(tip.name, false) } returns false
if (BuildConfig.DEBUG) {
assertThat(SUT.isTipShown(tip)).isTrue()
} else {
assertThat(SUT.isTipShown(tip)).isFalse()
}
}
@Test
fun `Should store tips shown info properly`() {
val tip = Tip.MENU_DISCOVER
SUT.setTipShown(tip)
verifyAll {
sharedPreferencesEditor.putBoolean(tip.name, true)
sharedPreferencesEditor.apply()
}
}
}
================================================
FILE: assets/codestyle.xml
================================================
.*:id
http://schemas.android.com/apk/res/android
.*:name
http://schemas.android.com/apk/res/android
.*
http://schemas.android.com/apk/res/android
ANDROID_ATTRIBUTE_ORDER
================================================
FILE: assets/screenshots/screenshots.xcf
================================================
[File too large to display: 28.7 MB]
================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: "./versions.gradle"
repositories {
google()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath libs.gradle
classpath libs.gradle.kotlin.plugin
classpath libs.gradle.ktlint
classpath libs.hilt.plugin
}
}
plugins {
id "com.github.triplet.play" version "3.8.1" apply false
id 'com.google.devtools.ksp' version '1.9.0-1.0.13' apply false
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
apply plugin: "org.jlleitschuh.gradle.ktlint"
apply plugin: "com.google.devtools.ksp"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: common/.gitignore
================================================
/build
================================================
FILE: common/build.gradle
================================================
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: '../versions.gradle'
android {
kotlinOptions { jvmTarget = "17" }
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
compileSdkVersion versions.compileSdk
defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
compileSdkVersion versions.compileSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}
namespace 'com.michaldrabik.common'
}
dependencies {
api libs.coroutines
implementation libs.retrofit
implementation libs.hilt.android
ksp libs.hilt.compiler
implementation libs.coroutinesTest
coreLibraryDesugaring libs.android.desugar
}
================================================
FILE: common/src/debug/java/com/michaldrabik/common/ConfigVariant.kt
================================================
package com.michaldrabik.common
import java.util.concurrent.TimeUnit.MINUTES
object ConfigVariant {
val SHOW_SYNC_COOLDOWN by lazy { MINUTES.toMillis(5) }
val MOVIE_SYNC_COOLDOWN by lazy { MINUTES.toMillis(5) }
val TRANSLATION_SYNC_SHOW_MOVIE_COOLDOWN by lazy { MINUTES.toMillis(5) }
val TRANSLATION_SYNC_EPISODE_COOLDOWN by lazy { MINUTES.toMillis(5) }
val RATINGS_CACHE_DURATION by lazy { MINUTES.toMillis(3) }
val STREAMINGS_CACHE_DURATION by lazy { MINUTES.toMillis(3) }
val COLLECTIONS_CACHE_DURATION by lazy { MINUTES.toMillis(3) }
val TWITTER_AD_DELAY by lazy { MINUTES.toMillis(1) }
val PREMIUM_AD_DELAY by lazy { MINUTES.toMillis(1) }
}
================================================
FILE: common/src/main/AndroidManifest.xml
================================================
================================================
FILE: common/src/main/java/com/michaldrabik/common/Config.kt
================================================
package com.michaldrabik.common
import java.util.concurrent.TimeUnit.DAYS
import java.util.concurrent.TimeUnit.HOURS
object Config {
const val TVDB_IMAGE_BASE_BANNERS_URL = "https://artworks.thetvdb.com/banners/"
const val TVDB_IMAGE_BASE_POSTER_URL = "${TVDB_IMAGE_BASE_BANNERS_URL}posters/"
const val TVDB_IMAGE_BASE_FANART_URL = "${TVDB_IMAGE_BASE_BANNERS_URL}fanart/original/"
private const val TMDB_IMAGE_BASE_URL = "https://image.tmdb.org/t/p/"
const val TMDB_IMAGE_BASE_POSTER_URL = "${TMDB_IMAGE_BASE_URL}w342"
const val TMDB_IMAGE_BASE_FANART_URL = "${TMDB_IMAGE_BASE_URL}w1280"
const val TMDB_IMAGE_BASE_PROFILE_URL = "${TMDB_IMAGE_BASE_URL}w1280"
const val TMDB_IMAGE_BASE_PROFILE_THUMB_URL = "${TMDB_IMAGE_BASE_URL}w342"
const val TMDB_IMAGE_BASE_STILL_URL = "${TMDB_IMAGE_BASE_URL}original"
const val TMDB_IMAGE_BASE_ACTOR_URL = "${TMDB_IMAGE_BASE_URL}h632"
const val TMDB_IMAGE_BASE_LOGO_URL = "${TMDB_IMAGE_BASE_URL}original"
const val AWS_IMAGE_BASE_URL = "https://showly2.s3.eu-west-2.amazonaws.com/images/"
const val TRAKT_URL = "https://www.trakt.tv/"
const val JUST_WATCH_URL = "https://www.justwatch.com/"
const val TMDB_URL = "https://www.themoviedb.org/"
const val GITHUB_RELEASE_URL = "https://github.com/1RandomDev/showly-oss/releases/latest"
const val GITHUB_ISSUE_URL = "https://github.com/1RandomDev/showly-oss/issues"
const val GITHUB_URL = "https://github.com/1RandomDev/showly-oss"
const val MAIN_GRID_SPAN = 3
const val MAIN_GRID_SPAN_TABLET = 6
const val LISTS_GRID_SPAN = 4
const val LISTS_GRID_SPAN_TABLET = 6
const val IMAGE_FADE_DURATION_MS = 150
const val SEARCH_RECENTS_AMOUNT = 5
const val FANART_GALLERY_IMAGES_LIMIT = 20
const val PULL_TO_REFRESH_COOLDOWN_MS = 10_000
const val DEFAULT_LANGUAGE = "en"
const val DEFAULT_COUNTRY = "us"
const val DEFAULT_DATE_FORMAT = "DEFAULT_24"
const val DEFAULT_NEWS_VIEW_TYPE = "ROW"
const val DEFAULT_LIST_VIEW_MODE = "LIST_NORMAL"
const val DEFAULT_LISTS_GRID_SPAN = 2
const val HOST_ACTIVITY_NAME = "com.michaldrabik.showly_oss.ui.main.MainActivity"
const val SHOW_WHATS_NEW = true
const val SHOW_TIPS_DEBUG = false
const val SHOW_PREMIUM = true
val PROGRESS_UPCOMING_OPTIONS = arrayOf(0, 7, 14, 30, 45, 60, 90)
val MY_SHOWS_RECENTS_OPTIONS = arrayOf(0, 2, 4, 6, 8)
val DISCOVER_SHOWS_CACHE_DURATION by lazy { HOURS.toMillis(12) }
val DISCOVER_MOVIES_CACHE_DURATION by lazy { HOURS.toMillis(12) }
val RELATED_CACHE_DURATION by lazy { DAYS.toMillis(7) }
val SHOW_DETAILS_CACHE_DURATION by lazy { DAYS.toMillis(3) }
val MOVIE_DETAILS_CACHE_DURATION by lazy { DAYS.toMillis(3) }
val ACTORS_CACHE_DURATION by lazy { DAYS.toMillis(5) }
val NEW_BADGE_DURATION by lazy { DAYS.toMillis(3) }
val PEOPLE_CREDITS_CACHE_DURATION by lazy { DAYS.toMillis(7) }
val PEOPLE_IMAGES_CACHE_DURATION by lazy { DAYS.toMillis(7) }
const val SPOILERS_HIDE_SYMBOL = "•"
const val SPOILERS_RATINGS_HIDE_SYMBOL = "•.•"
const val SPOILERS_RATINGS_VOTES_HIDE_SYMBOL = "•.• (•••••)"
val SPOILERS_REGEX = "\\S".toRegex()
}
================================================
FILE: common/src/main/java/com/michaldrabik/common/Mode.kt
================================================
package com.michaldrabik.common
enum class Mode(val type: String) {
SHOWS("show"),
MOVIES("movie");
companion object {
fun fromType(type: String) = values().first { it.type == type }
fun getAll() = listOf(SHOWS, MOVIES)
}
}
================================================
FILE: common/src/main/java/com/michaldrabik/common/di/CommonBindingModule.kt
================================================
package com.michaldrabik.common.di
import com.michaldrabik.common.dispatchers.CoroutineDispatchers
import com.michaldrabik.common.dispatchers.DefaultCoroutineDispatchers
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
@Module
@InstallIn(SingletonComponent::class)
internal abstract class CommonBindingModule {
@Binds
abstract fun bindCoroutineDispatchers(
dispatchers: DefaultCoroutineDispatchers
): CoroutineDispatchers
}
================================================
FILE: common/src/main/java/com/michaldrabik/common/dispatchers/CoroutineDispatchers.kt
================================================
package com.michaldrabik.common.dispatchers
import kotlinx.coroutines.CoroutineDispatcher
interface CoroutineDispatchers {
val Main: CoroutineDispatcher
val IO: CoroutineDispatcher
val Default: CoroutineDispatcher
val Unconfined: CoroutineDispatcher
}
================================================
FILE: common/src/main/java/com/michaldrabik/common/dispatchers/DefaultCoroutineDispatchers.kt
================================================
package com.michaldrabik.common.dispatchers
import kotlinx.coroutines.Dispatchers
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
internal class DefaultCoroutineDispatchers @Inject constructor() : CoroutineDispatchers {
override val Main = Dispatchers.Main
override val IO = Dispatchers.IO
override val Default = Dispatchers.Default
override val Unconfined = Dispatchers.Unconfined
}
================================================
FILE: common/src/main/java/com/michaldrabik/common/errors/ErrorHelper.kt
================================================
package com.michaldrabik.common.errors
import com.michaldrabik.common.errors.ShowlyError.AccountLimitsError
import com.michaldrabik.common.errors.ShowlyError.AccountLockedError
import com.michaldrabik.common.errors.ShowlyError.CoroutineCancellation
import com.michaldrabik.common.errors.ShowlyError.ResourceConflictError
import com.michaldrabik.common.errors.ShowlyError.ResourceNotFoundError
import com.michaldrabik.common.errors.ShowlyError.UnauthorizedError
import com.michaldrabik.common.errors.ShowlyError.UnknownError
import com.michaldrabik.common.errors.ShowlyError.UnknownHttpError
import com.michaldrabik.common.errors.ShowlyError.ValidationError
import retrofit2.HttpException
import kotlin.coroutines.cancellation.CancellationException
object ErrorHelper {
fun parse(error: Throwable): ShowlyError =
when (error) {
is ShowlyError -> error
is HttpException -> {
when (error.code()) {
in arrayOf(401, 403) -> UnauthorizedError(error.message)
404 -> ResourceNotFoundError
409 -> ResourceConflictError
420 -> AccountLimitsError
422 -> ValidationError
423 -> AccountLockedError
else -> UnknownHttpError(error.message)
}
}
is CancellationException -> CoroutineCancellation
else -> UnknownError(error.message)
}
}
================================================
FILE: common/src/main/java/com/michaldrabik/common/errors/ShowlyError.kt
================================================
package com.michaldrabik.common.errors
sealed class ShowlyError(errorMessage: String?) : Throwable(errorMessage) {
object ValidationError : ShowlyError("ValidationError")
object ResourceConflictError : ShowlyError("ResourceConflictError")
object ResourceNotFoundError : ShowlyError("ResourceNotFoundError")
object AccountLockedError : ShowlyError("AccountLockedError")
object AccountLimitsError : ShowlyError("AccountLimitsError")
data class UnauthorizedError(val errorMessage: String?) : ShowlyError(errorMessage)
data class UnknownHttpError(
val errorMessage: String?
) : ShowlyError(errorMessage)
data class UnknownError(
val errorMessage: String?
) : ShowlyError(errorMessage)
object CoroutineCancellation : ShowlyError("")
}
================================================
FILE: common/src/main/java/com/michaldrabik/common/extensions/DateExtensions.kt
================================================
package com.michaldrabik.common.extensions
import java.time.Instant
import java.time.LocalDate
import java.time.ZoneId
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit.DAYS
fun nowUtc(): ZonedDateTime = ZonedDateTime.now(ZoneOffset.UTC)
fun nowUtcDay(): LocalDate = LocalDate.now()
fun nowUtcMillis(): Long = nowUtc().toMillis()
fun dateFromMillis(millis: Long): ZonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.of("UTC"))
fun dateIsoStringFromMillis(millis: Long): String = dateFromMillis(millis).format(DateTimeFormatter.ISO_INSTANT)
fun ZonedDateTime.toMillis() = this.toInstant().toEpochMilli()
fun ZonedDateTime.toLocalZone(): ZonedDateTime = this.withZoneSameInstant(ZoneId.systemDefault())
fun ZonedDateTime.isSameDayOrAfter(date: ZonedDateTime): Boolean =
this.isEqual(date.truncatedTo(DAYS)) || this.isAfter(date.truncatedTo(DAYS))
fun String?.toZonedDateTime(): ZonedDateTime? = if (this.isNullOrBlank()) null else ZonedDateTime.parse(this)
================================================
FILE: common/src/release/java/com/michaldrabik/common/ConfigVariant.kt
================================================
package com.michaldrabik.common
import java.util.concurrent.TimeUnit.DAYS
import java.util.concurrent.TimeUnit.HOURS
import java.util.concurrent.TimeUnit.MINUTES
object ConfigVariant {
val SHOW_SYNC_COOLDOWN by lazy { HOURS.toMillis(12) }
val MOVIE_SYNC_COOLDOWN by lazy { DAYS.toMillis(3) }
val TRANSLATION_SYNC_SHOW_MOVIE_COOLDOWN by lazy { DAYS.toMillis(5) }
val TRANSLATION_SYNC_EPISODE_COOLDOWN by lazy { DAYS.toMillis(3) }
val RATINGS_CACHE_DURATION by lazy { DAYS.toMillis(3) }
val STREAMINGS_CACHE_DURATION by lazy { DAYS.toMillis(3) }
val COLLECTIONS_CACHE_DURATION by lazy { DAYS.toMillis(7) }
val REMOTE_CONFIG_FETCH_INTERVAL by lazy { MINUTES.toSeconds(60) }
val TWITTER_AD_DELAY by lazy { DAYS.toMillis(5) }
val PREMIUM_AD_DELAY by lazy { DAYS.toMillis(10) }
}
================================================
FILE: common-test/.gitignore
================================================
/build
================================================
FILE: common-test/build.gradle
================================================
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: '../versions.gradle'
android {
kotlinOptions { jvmTarget = "17" }
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
compileSdkVersion versions.compileSdk
defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
compileSdkVersion versions.compileSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}
namespace 'com.michaldrabik.test_base'
}
dependencies {
implementation project(':common')
implementation libs.coroutinesTest
implementation libs.junit
coreLibraryDesugaring libs.android.desugar
}
================================================
FILE: common-test/src/main/java/com/michaldrabik/common_test/MainDispatcherRule.kt
================================================
package com.michaldrabik.common_test
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestDispatcher
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.setMain
import org.junit.rules.TestWatcher
import org.junit.runner.Description
@OptIn(ExperimentalCoroutinesApi::class)
class MainDispatcherRule(
private val testDispatcher: TestDispatcher = UnconfinedTestDispatcher(),
) : TestWatcher() {
override fun starting(description: Description) {
super.starting(description)
Dispatchers.setMain(testDispatcher)
}
override fun finished(description: Description) {
super.finished(description)
Dispatchers.resetMain()
}
}
================================================
FILE: common-test/src/main/java/com/michaldrabik/common_test/UnconfinedCoroutineDispatchers.kt
================================================
package com.michaldrabik.common_test
import com.michaldrabik.common.dispatchers.CoroutineDispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.UnconfinedTestDispatcher
@OptIn(ExperimentalCoroutinesApi::class)
class UnconfinedCoroutineDispatchers : CoroutineDispatchers {
override val Main = UnconfinedTestDispatcher()
override val IO = UnconfinedTestDispatcher()
override val Default = UnconfinedTestDispatcher()
override val Unconfined = UnconfinedTestDispatcher()
}
================================================
FILE: crowdin.yml
================================================
files:
- source: /**/values/strings.xml
translation: /**/values-%two_letters_code%/%original_file_name%
translate_attributes: 0
content_segmentation: 0
================================================
FILE: data-local/.gitignore
================================================
/build
================================================
FILE: data-local/build.gradle
================================================
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'dagger.hilt.android.plugin'
apply from: '../versions.gradle'
android {
kotlinOptions { jvmTarget = "17" }
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
compileSdkVersion versions.compileSdk
defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
compileSdkVersion versions.compileSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}
namespace 'com.michaldrabik.data_local'
}
dependencies {
api libs.android.room.ktx
api libs.android.room.runtime
ksp libs.android.room.compiler
implementation libs.timber
implementation libs.hilt.android
ksp libs.hilt.compiler
testImplementation libs.junit
androidTestImplementation libs.truth
androidTestImplementation libs.android.test.runner
androidTestImplementation libs.android.test.truth
coreLibraryDesugaring libs.android.desugar
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/BaseDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.room.Room
import androidx.test.platform.app.InstrumentationRegistry
import com.michaldrabik.data_local.database.AppDatabase
import org.junit.After
import org.junit.Before
abstract class BaseDaoTest {
protected lateinit var database: AppDatabase
@Before
fun initDb() {
database = Room.inMemoryDatabaseBuilder(
InstrumentationRegistry.getInstrumentation().targetContext.applicationContext,
AppDatabase::class.java
).build()
}
@After
fun closeDb() = database.close()
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/DiscoverShowsDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.dao.helpers.TestData
import com.michaldrabik.data_local.database.model.DiscoverShow
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class DiscoverShowsDaoTest : BaseDaoTest() {
private val show by lazy { TestData.createShow().copy(idTrakt = 11) }
private val discoverShow by lazy { DiscoverShow(1, show.idTrakt, 999, 999) }
@Before
fun setUp() {
runBlocking {
database.showsDao().upsert(listOf(show))
}
}
@Test
fun shouldInsertSingleEntity() {
runBlocking {
database.discoverShowsDao().upsert(listOf(discoverShow))
val result = database.discoverShowsDao().getAll()
assertThat(result).hasSize(1)
assertThat(result.first()).isEqualTo(discoverShow)
}
}
@Test
fun shouldInsertMultipleEntities() {
runBlocking {
val show1 = discoverShow.copy(id = 11)
val show2 = discoverShow.copy(id = 12)
database.discoverShowsDao().upsert(listOf(show1, show2))
val result = database.discoverShowsDao().getAll()
assertThat(result).containsExactlyElementsIn(listOf(show1, show2))
}
}
@Test
fun shouldUpdateEntitiesIfExist() {
runBlocking {
val show1 = discoverShow.copy(id = 99)
val show2 = discoverShow.copy(id = 23)
val show1Updated = show1.copy(updatedAt = 1000)
val show2Updated = show2.copy(updatedAt = 1000)
database.discoverShowsDao().upsert(listOf(show1, show2))
database.discoverShowsDao().upsert(listOf(show1Updated, show2Updated))
val result = database.discoverShowsDao().getAll()
assertThat(result).containsExactlyElementsIn(listOf(show1Updated, show2Updated))
}
}
@Test
fun shouldReplaceEntities() {
runBlocking {
val show1 = discoverShow.copy(id = 11)
val show2 = discoverShow.copy(id = 22)
val show3 = discoverShow.copy(id = 33)
database.discoverShowsDao().upsert(listOf(show1, show2, show3))
assertThat(database.discoverShowsDao().getAll()).containsExactly(show1, show2, show3)
val show4 = discoverShow.copy(id = 44)
database.discoverShowsDao().replace(listOf(show4))
assertThat(database.discoverShowsDao().getAll()).containsExactly(show4)
}
}
@Test
fun shouldReturnMostRecentEntity() {
runBlocking {
val show1 = discoverShow.copy(id = 11, createdAt = 2)
val show2 = discoverShow.copy(id = 22, createdAt = 3)
val show3 = discoverShow.copy(id = 33, createdAt = 1)
database.discoverShowsDao().upsert(listOf(show1, show2, show3))
val mostRecent = database.discoverShowsDao().getMostRecent()
assertThat(mostRecent).isEqualTo(show2)
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/EpisodesDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.dao.helpers.TestData
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class EpisodesDaoTest : BaseDaoTest() {
@Test
fun shouldStoreEpisodesForSeason() {
runBlocking {
val season = TestData.createSeason()
val episode1 = TestData.createEpisode().copy(idTrakt = 1)
val episode2 = TestData.createEpisode().copy(idTrakt = 2)
database.seasonsDao().upsert(listOf(season))
database.episodesDao().upsert(listOf(episode1, episode2))
val result = database.episodesDao().getAllForSeason(1)
assertThat(result).containsExactlyElementsIn(listOf(episode1, episode2))
}
}
@Test
fun shouldUpdateEpisodeIfAlreadyExists() {
runBlocking {
val season = TestData.createSeason()
val episode1 = TestData.createEpisode().copy(idTrakt = 1)
val episode2 = TestData.createEpisode().copy(idTrakt = 2)
database.seasonsDao().upsert(listOf(season))
database.episodesDao().upsert(listOf(episode1, episode2))
val result = database.episodesDao().getAllForSeason(1)
assertThat(result).containsExactlyElementsIn(listOf(episode1, episode2))
val updated = episode2.copy(title = "Updated")
database.episodesDao().upsert(listOf(episode1, updated))
val result2 = database.episodesDao().getAllForSeason(1)
assertThat(result2).containsExactlyElementsIn(listOf(episode1, updated))
}
}
@Test
fun shouldStoreEpisodesForShows() {
runBlocking {
val show1 = TestData.createShow().copy(idTrakt = 1)
val show2 = TestData.createShow().copy(idTrakt = 2)
val season1 = TestData.createSeason().copy(idShowTrakt = show1.idTrakt)
val season2 = TestData.createSeason().copy(idShowTrakt = show2.idTrakt)
val episode1 = TestData.createEpisode().copy(
idTrakt = 1,
idShowTrakt = show1.idTrakt,
idSeason = season1.idTrakt
)
val episode2 = TestData.createEpisode().copy(
idTrakt = 2,
idShowTrakt = show2.idTrakt,
idSeason = season2.idTrakt
)
database.showsDao().upsert(listOf(show1, show2))
database.seasonsDao().upsert(listOf(season1, season2))
database.episodesDao().upsert(listOf(episode1, episode2))
val result2 = database.episodesDao().getAllByShowId(2)
assertThat(result2).containsExactlyElementsIn(listOf(episode2))
}
}
@Test
fun shouldReturnWatchedIdsForShow() {
runBlocking {
val show = TestData.createShow().copy(idTrakt = 1)
val season1 = TestData.createSeason().copy(idShowTrakt = show.idTrakt)
val season2 = TestData.createSeason().copy(idShowTrakt = show.idTrakt)
val episode1 = TestData.createEpisode().copy(
idTrakt = 1,
idShowTrakt = show.idTrakt,
idSeason = season1.idTrakt,
isWatched = true
)
val episode2 = TestData.createEpisode().copy(
idTrakt = 2,
idShowTrakt = show.idTrakt,
idSeason = season2.idTrakt,
isWatched = false
)
database.showsDao().upsert(listOf(show))
database.seasonsDao().upsert(listOf(season1, season2))
database.episodesDao().upsert(listOf(episode1, episode2))
val result = database.episodesDao().getAllWatchedIdsForShows(listOf(show.idTrakt))
assertThat(result).containsExactlyElementsIn(listOf(episode1.idTrakt))
}
}
@Test
fun shouldDeleteAllUnwatchedForShow() {
runBlocking {
val show = TestData.createShow().copy(idTrakt = 1)
val season1 = TestData.createSeason().copy(idShowTrakt = show.idTrakt)
val season2 = TestData.createSeason().copy(idShowTrakt = show.idTrakt)
val episode1 = TestData.createEpisode().copy(
idTrakt = 1,
idShowTrakt = show.idTrakt,
idSeason = season1.idTrakt,
isWatched = true
)
val episode2 = TestData.createEpisode().copy(
idTrakt = 2,
idShowTrakt = show.idTrakt,
idSeason = season2.idTrakt,
isWatched = false
)
database.showsDao().upsert(listOf(show))
database.seasonsDao().upsert(listOf(season1, season2))
database.episodesDao().upsert(listOf(episode1, episode2))
val result = database.episodesDao().getAllByShowId(show.idTrakt)
assertThat(result).containsExactlyElementsIn(listOf(episode1, episode2))
database.episodesDao().deleteAllUnwatchedForShow(show.idTrakt)
val result2 = database.episodesDao().getAllByShowId(show.idTrakt)
assertThat(result2).containsExactlyElementsIn(listOf(episode1))
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/EpisodesSyncLogDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.model.EpisodesSyncLog
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class EpisodesSyncLogDaoTest : BaseDaoTest() {
@Test
fun shouldInsertAndSaveData() {
runBlocking {
val testLog = EpisodesSyncLog(1, 999)
database.episodesSyncLogDao().upsert(testLog)
val result = database.episodesSyncLogDao().getAll().first()
assertThat(result).isEqualTo(testLog)
}
}
@Test
fun shouldUpdateRowIfAlreadyExists() {
runBlocking {
val testLog = EpisodesSyncLog(1, 999)
database.episodesSyncLogDao().upsert(testLog)
val result = database.episodesSyncLogDao().getAll().first()
assertThat(result).isEqualTo(testLog)
val testLog2 = testLog.copy(syncedAt = 888)
database.episodesSyncLogDao().upsert(testLog2)
val result2 = database.episodesSyncLogDao().getAll().first()
assertThat(result2).isEqualTo(testLog2)
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/MyShowsDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.dao.helpers.TestData
import com.michaldrabik.data_local.database.model.MyShow
import com.michaldrabik.data_local.database.model.Show
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class MyShowsDaoTest : BaseDaoTest() {
private val shows = mutableListOf()
@Before
fun setUp() = runBlocking {
shows.add(TestData.createShow().copy(idTrakt = 1))
shows.add(TestData.createShow().copy(idTrakt = 2))
shows.add(TestData.createShow().copy(idTrakt = 3))
database.showsDao().upsert(shows)
}
@Test
fun shouldInsertAndStoreEntities() {
runBlocking {
val myShow = MyShow.fromTraktId(shows[0].idTrakt, 0, 0)
database.myShowsDao().insert(listOf(myShow))
val result = database.myShowsDao().getAll()
assertThat(result).containsExactlyElementsIn(listOf(shows[0]))
}
}
@Test
fun shouldReturnIdsOnly() {
runBlocking {
val myShow1 = MyShow.fromTraktId(shows[0].idTrakt, 0, 0)
val myShow2 = MyShow.fromTraktId(shows[1].idTrakt, 0, 0)
database.myShowsDao().insert(listOf(myShow1))
database.myShowsDao().insert(listOf(myShow2))
val result = database.myShowsDao().getAllTraktIds()
assertThat(result).containsExactlyElementsIn(listOf(shows[0].idTrakt, shows[1].idTrakt))
}
}
@Test
fun shouldReturnMostRecentAddedShows() {
runBlocking {
val myShow1 = MyShow.fromTraktId(shows[0].idTrakt, 0, 0)
val myShow2 = MyShow.fromTraktId(shows[1].idTrakt, 999, 999)
database.myShowsDao().insert(listOf(myShow1))
database.myShowsDao().insert(listOf(myShow2))
val result = database.myShowsDao().getAllRecent(10)
assertThat(result[0]).isEqualTo(shows[1])
assertThat(result[1]).isEqualTo(shows[0])
}
}
@Test
fun shouldReturnById() {
runBlocking {
val myShow1 = MyShow.fromTraktId(shows[0].idTrakt, 0, 0)
val myShow2 = MyShow.fromTraktId(shows[1].idTrakt, 0, 0)
database.myShowsDao().insert(listOf(myShow1))
database.myShowsDao().insert(listOf(myShow2))
val result = database.myShowsDao().getById(shows[1].idTrakt)
assertThat(result).isEqualTo(shows[1])
}
}
@Test
fun shouldDeleteByIdWithoutDeletingParent() {
runBlocking {
val myShow1 = MyShow.fromTraktId(shows[1].idTrakt, 0, 0)
val showsSize = shows.size
database.myShowsDao().insert(listOf(myShow1))
database.myShowsDao().deleteById(shows[1].idTrakt)
val result = database.myShowsDao().getById(shows[1].idTrakt)
assertThat(result).isNull()
assertThat(shows).hasSize(showsSize)
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/RecentSearchDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.model.RecentSearch
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class RecentSearchDaoTest : BaseDaoTest() {
private val items = mutableListOf()
@Before
fun setUp() {
val item = RecentSearch(1, "Text1", 1, 1)
val item2 = RecentSearch(2, "Text2", 2, 2)
val item3 = RecentSearch(3, "Text3", 3, 3)
items.addAll(listOf(item, item2, item3))
}
@Test
fun shouldInsertAndStoreEntities() {
runBlocking {
database.recentSearchDao().upsert(items)
val result = database.recentSearchDao().getAll(10)
assertThat(result).containsExactlyElementsIn(items)
}
}
@Test
fun shouldReturnMostRecentSearchesFirst() {
runBlocking {
database.recentSearchDao().upsert(items)
val result = database.recentSearchDao().getAll(10)
assertThat(result).containsExactlyElementsIn(items)
assertThat(result).isInOrder(compareByDescending { it.createdAt })
}
}
@Test
fun shouldReturnLimitedResults() {
runBlocking {
database.recentSearchDao().upsert(items)
val result = database.recentSearchDao().getAll(2)
assertThat(result).hasSize(2)
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/RelatedShowsDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.dao.helpers.TestData
import com.michaldrabik.data_local.database.model.RelatedShow
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class RelatedShowsDaoTest : BaseDaoTest() {
@Test
fun shouldInsertAndDeleteSingleEntity() {
runBlocking {
val show = TestData.createShow().copy(idTrakt = 99)
val relatedShow = RelatedShow(1, 1, 99, 999)
database.showsDao().upsert(listOf(show))
database.relatedShowsDao().insert(listOf(relatedShow))
val result = database.relatedShowsDao().getAll()
assertThat(result).hasSize(1)
assertThat(result.first()).isEqualTo(relatedShow)
database.relatedShowsDao().deleteById(99)
val result2 = database.relatedShowsDao().getAll()
assertThat(result2).isEmpty()
assertThat(database.showsDao().getById(99)).isEqualTo(show)
}
}
@Test
fun shouldReturnRelatedShowsForId() {
runBlocking {
val show1 = TestData.createShow().copy(idTrakt = 1, updatedAt = 100)
val show2 = TestData.createShow().copy(idTrakt = 2, updatedAt = 100)
val show3 = TestData.createShow().copy(idTrakt = 3, updatedAt = 100)
val relatedShow1 = RelatedShow(1, 2, 1, 200)
val relatedShow2 = RelatedShow(2, 3, 1, 200)
val relatedShow3 = RelatedShow(3, 1, 2, 200)
database.showsDao().upsert(listOf(show1, show2, show3))
database.relatedShowsDao().insert(listOf(relatedShow1, relatedShow2, relatedShow3))
val result = database.relatedShowsDao().getAllById(1)
assertThat(result).containsExactlyElementsIn(listOf(relatedShow1, relatedShow2))
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/SeasonsDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.dao.helpers.TestData
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class SeasonsDaoTest : BaseDaoTest() {
@Test
fun shouldInsertAndStoreSingleEntity() {
runBlocking {
val season = TestData.createSeason()
database.seasonsDao().upsert(listOf(season))
val result = database.seasonsDao().getAllByShowId(1)
assertThat(result).containsExactlyElementsIn(listOf(season))
}
}
@Test
fun shouldInsertAndStoreMultipleEntities() {
runBlocking {
val season1 = TestData.createSeason().copy(idTrakt = 1)
val season2 = TestData.createSeason().copy(idTrakt = 2)
database.seasonsDao().upsert(listOf(season1, season2))
val result = database.seasonsDao().getAllByShowId(1)
assertThat(result).containsExactlyElementsIn(listOf(season1, season2))
}
}
@Test
fun shouldReturnEntityById() {
runBlocking {
val season1 = TestData.createSeason().copy(idTrakt = 1)
val season2 = TestData.createSeason().copy(idTrakt = 2)
database.seasonsDao().upsert(listOf(season1, season2))
val result = database.seasonsDao().getById(2)
assertThat(result).isEqualTo(season2)
}
}
@Test
fun shouldReturnEntitiesByIds() {
runBlocking {
val season1 = TestData.createSeason().copy(idTrakt = 1)
val season2 = TestData.createSeason().copy(idTrakt = 2, idShowTrakt = 2)
val season3 = TestData.createSeason().copy(idTrakt = 3)
database.seasonsDao().upsert(listOf(season1, season2, season3))
val result = database.seasonsDao().getAllByShowId(1)
assertThat(result).containsExactlyElementsIn(listOf(season1, season3))
}
}
@Test
fun shouldOnlyReturnWatchedSeasons() {
runBlocking {
val season1 = TestData.createSeason().copy(idTrakt = 1)
val season2 = TestData.createSeason().copy(idTrakt = 2)
val season3 = TestData.createSeason().copy(idTrakt = 3, isWatched = true)
database.seasonsDao().upsert(listOf(season1, season2, season3))
val result = database.seasonsDao().getAllWatchedIdsForShows(listOf(1))
assertThat(result).hasSize(1)
assertThat(result[0]).isEqualTo(3)
}
}
@Test
fun shouldReturnNullIfNoEntity() {
runBlocking {
val season1 = TestData.createSeason()
database.seasonsDao().upsert(listOf(season1))
val result = database.seasonsDao().getById(2)
assertThat(result).isNull()
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/SettingsDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.dao.helpers.TestData
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class SettingsDaoTest : BaseDaoTest() {
@Test
fun shouldInsertAndSaveData() {
runBlocking {
val settings = TestData.createSettings()
database.settingsDao().upsert(settings)
val result = database.settingsDao().getAll()
assertThat(result).isEqualTo(settings)
}
}
@Test
fun shouldReturnNullIfNoEntity() {
runBlocking {
val settings = database.settingsDao().getAll()
assertThat(settings).isNull()
}
}
@Test
fun shouldUpdateRowIfAlreadyExists() {
runBlocking {
val settings = TestData.createSettings()
database.settingsDao().upsert(settings)
assertThat(database.settingsDao().getAll()).isEqualTo(settings)
val settings2 = settings.copy(myShowsEndedSortBy = "sort")
database.settingsDao().upsert(settings2)
assertThat(database.settingsDao().getAll()).isEqualTo(settings2)
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/ShowImagesDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.model.ShowImage
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class ShowImagesDaoTest : BaseDaoTest() {
private val image1 = ShowImage(1, 1, 1, "poster", "show", "url", "thumbUrl", "tmdb")
private val image2 = ShowImage(2, 2, 2, "poster", "episode", "url", "thumbUrl", "tmdb")
private val image3 = ShowImage(3, 1, 1, "fanart", "show", "url", "thumbUrl", "tmdb")
private val image4 = ShowImage(4, 2, 2, "fanart", "episode", "url", "thumbUrl", "tmdb")
@Before
fun setUp() = runBlocking {
database.showImagesDao().upsert(image1)
database.showImagesDao().upsert(image2)
database.showImagesDao().upsert(image3)
database.showImagesDao().upsert(image4)
}
@Test
fun shouldReturnImageByTypeForShow() = runBlocking {
val result = database.showImagesDao().getByShowId(1, "poster")
val result2 = database.showImagesDao().getByShowId(1, "fanart")
assertThat(result).isEqualTo(image1)
assertThat(result2).isEqualTo(image3)
}
@Test
fun shouldReturnImageByTypeForEpisode() = runBlocking {
val result = database.showImagesDao().getByEpisodeId(2, "poster")
val result2 = database.showImagesDao().getByEpisodeId(2, "fanart")
assertThat(result).isEqualTo(image2)
assertThat(result2).isEqualTo(image4)
}
@Test
fun shouldUpsertShowImage() = runBlocking {
val result = database.showImagesDao().getByShowId(10, "fanart")
assertThat(result).isNull()
val image = ShowImage(10, 10, 10, "fanart", "show", "url", "thumbUrl", "tmdb")
database.showImagesDao().insertShowImage(image)
val result2 = database.showImagesDao().getByShowId(10, "fanart")
assertThat(result2).isEqualTo(image)
val image2 = ShowImage(10, 10, 10, "fanart", "show", "url2", "thumbUrl2", "tmdb")
database.showImagesDao().insertShowImage(image2)
val result3 = database.showImagesDao().getByShowId(10, "fanart")
assertThat(result3).isEqualTo(image2)
}
@Test
fun shouldUpsertEpisodeImage() = runBlocking {
val result = database.showImagesDao().getByEpisodeId(10, "fanart")
assertThat(result).isNull()
val image = ShowImage(10, 10, 10, "fanart", "episode", "url", "thumbUrl", "tmdb")
database.showImagesDao().insertEpisodeImage(image)
val result2 = database.showImagesDao().getByEpisodeId(10, "fanart")
assertThat(result2).isEqualTo(image)
val image2 = ShowImage(10, 10, 10, "fanart", "episode", "url2", "thumbUrl2", "tmdb")
database.showImagesDao().insertEpisodeImage(image2)
val result3 = database.showImagesDao().getByEpisodeId(10, "fanart")
assertThat(result3).isEqualTo(image2)
}
@Test
fun shouldDeleteByShowId() = runBlocking {
assertThat(database.showImagesDao().getByShowId(1, "poster")).isEqualTo(image1)
assertThat(database.showImagesDao().getByShowId(1, "fanart")).isEqualTo(image3)
database.showImagesDao().deleteByShowId(1, "poster")
database.showImagesDao().deleteByShowId(1, "fanart")
assertThat(database.showImagesDao().getByShowId(1, "poster")).isNull()
assertThat(database.showImagesDao().getByShowId(1, "fanart")).isNull()
// Ensure nothing else is deleted
assertThat(database.showImagesDao().getByEpisodeId(2, "poster")).isEqualTo(image2)
assertThat(database.showImagesDao().getByEpisodeId(2, "fanart")).isEqualTo(image4)
}
@Test
fun shouldDeleteByEpisodeId() = runBlocking {
assertThat(database.showImagesDao().getByEpisodeId(2, "poster")).isEqualTo(image2)
assertThat(database.showImagesDao().getByEpisodeId(2, "fanart")).isEqualTo(image4)
database.showImagesDao().deleteByEpisodeId(2, "poster")
database.showImagesDao().deleteByEpisodeId(2, "fanart")
assertThat(database.showImagesDao().getByEpisodeId(2, "poster")).isNull()
assertThat(database.showImagesDao().getByEpisodeId(2, "fanart")).isNull()
// Ensure nothing else is deleted
assertThat(database.showImagesDao().getByShowId(1, "poster")).isEqualTo(image1)
assertThat(database.showImagesDao().getByShowId(1, "fanart")).isEqualTo(image3)
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/ShowsDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.dao.helpers.TestData
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class ShowsDaoTest : BaseDaoTest() {
@Test
fun shouldInsertAndStoreSingleEntity() {
runBlocking {
val show = TestData.createShow()
database.showsDao().upsert(listOf(show))
val result = database.showsDao().getAll()
assertThat(result).hasSize(1)
assertThat(result.first()).isEqualTo(show)
}
}
@Test
fun shouldInsertAndStoreMultipleEntities() {
runBlocking {
val show1 = TestData.createShow().copy(idTrakt = 1)
val show2 = TestData.createShow().copy(idTrakt = 2)
database.showsDao().upsert(listOf(show1, show2))
val result = database.showsDao().getAll()
assertThat(result).hasSize(2)
assertThat(result[0]).isEqualTo(show1)
assertThat(result[1]).isEqualTo(show2)
}
}
@Test
fun shouldReturnEntityById() {
runBlocking {
val show1 = TestData.createShow().copy(idTrakt = 1)
val show2 = TestData.createShow().copy(idTrakt = 2)
database.showsDao().upsert(listOf(show1, show2))
val result = database.showsDao().getById(2)
assertThat(result).isEqualTo(show2)
}
}
@Test
fun shouldReturnEntitiesByIds() {
runBlocking {
val show1 = TestData.createShow().copy(idTrakt = 1)
val show2 = TestData.createShow().copy(idTrakt = 2)
val show3 = TestData.createShow().copy(idTrakt = 3)
database.showsDao().upsert(listOf(show1, show2, show3))
val result = database.showsDao().getAll(listOf(1, 3))
assertThat(result).containsExactlyElementsIn(listOf(show1, show3))
}
}
@Test
fun shouldReturnNullIfNoEntity() {
runBlocking {
val show1 = TestData.createShow()
database.showsDao().upsert(listOf(show1))
val result = database.showsDao().getById(2)
assertThat(result).isNull()
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/UserDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.model.User
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class UserDaoTest : BaseDaoTest() {
@Test
fun shouldInsertAndSaveData() {
runBlocking {
val testUser = User(1, "tvdbToken", 999, "test", "test", 999, "", "", 999)
database.userDao().upsert(testUser)
val result = database.userDao().get()
assertThat(result).isEqualTo(testUser)
}
}
@Test
fun shouldUpdateRowIfAlreadyExists() {
runBlocking {
val testUser = User(1, "tvdbToken", 999, "test", "test", 999, "", "", 999)
database.userDao().upsert(testUser)
assertThat(database.userDao().get()).isEqualTo(testUser)
val testUser2 = testUser.copy(tvdbToken = "otherToken", tvdbTokenTimestamp = 888)
database.userDao().upsert(testUser2)
assertThat(database.userDao().get()).isEqualTo(testUser2)
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/WatchlistShowsDaoTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao
import androidx.test.runner.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import com.michaldrabik.data_local.database.dao.helpers.TestData
import com.michaldrabik.data_local.database.model.WatchlistShow
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class WatchlistShowsDaoTest : BaseDaoTest() {
@Test
fun shouldInsertAndStoreSingleEntity() {
runBlocking {
val show = TestData.createShow()
val seeLaterShow = WatchlistShow.fromTraktId(show.idTrakt, 999)
database.showsDao().upsert(listOf(show))
database.watchlistShowsDao().insert(seeLaterShow)
val result = database.watchlistShowsDao().getAll()
assertThat(result).containsExactlyElementsIn(listOf(show.copy(updatedAt = 999, createdAt = 999)))
}
}
@Test
fun shouldInsertAndStoreSingleEntityById() {
runBlocking {
val show = TestData.createShow()
val show2 = TestData.createShow().copy(idTrakt = 2)
val seeLaterShow = WatchlistShow.fromTraktId(show.idTrakt, 999)
val seeLaterShow2 = WatchlistShow.fromTraktId(show2.idTrakt, 999)
database.showsDao().upsert(listOf(show, show2))
database.watchlistShowsDao().insert(seeLaterShow)
database.watchlistShowsDao().insert(seeLaterShow2)
val result = database.watchlistShowsDao().getById(2)
assertThat(result).isEqualTo(show2)
}
}
@Test
fun shouldDeleteSingleEntityById() {
runBlocking {
val show = TestData.createShow()
val show2 = TestData.createShow().copy(idTrakt = 2)
val seeLaterShow = WatchlistShow.fromTraktId(show.idTrakt, 999)
val seeLaterShow2 = WatchlistShow.fromTraktId(show2.idTrakt, 999)
database.showsDao().upsert(listOf(show, show2))
database.watchlistShowsDao().insert(seeLaterShow)
database.watchlistShowsDao().insert(seeLaterShow2)
database.watchlistShowsDao().deleteById(2)
val result = database.watchlistShowsDao().getAll()
assertThat(result).containsExactlyElementsIn(listOf(show.copy(updatedAt = 999, createdAt = 999)))
}
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/converters/DateConverterTest.kt
================================================
@file:Suppress("DEPRECATION")
package com.michaldrabik.data_local.database.dao.converters
import com.google.common.truth.Truth.assertThat
import androidx.test.runner.AndroidJUnit4
import com.michaldrabik.data_local.database.converters.DateConverter
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.time.ZoneId
import java.time.ZonedDateTime
@RunWith(AndroidJUnit4::class)
class DateConverterTest {
private val SUT by lazy { DateConverter() }
@Before
fun setUp() {
}
@Test
fun shouldConvertTimestampToDate() {
val date = SUT.stringToDate(1573120000000) // Thu Nov 07 2019 09:46:40
assertThat(date).isEqualTo(ZonedDateTime.of(2019, 11, 7, 9, 46, 40, 0, ZoneId.of("UTC")))
}
@Test
fun shouldConvertDateToTimestamp() {
val timestamp = SUT.dateToString(ZonedDateTime.of(2019, 11, 7, 9, 46, 40, 0, ZoneId.of("UTC")))
assertThat(timestamp).isEqualTo(1573120000000)
}
}
================================================
FILE: data-local/src/androidTest/java/com/michaldrabik/data_local/database/dao/helpers/TestData.kt
================================================
package com.michaldrabik.data_local.database.dao.helpers
import com.michaldrabik.data_local.database.model.Episode
import com.michaldrabik.data_local.database.model.Season
import com.michaldrabik.data_local.database.model.Settings
import com.michaldrabik.data_local.database.model.Show
object TestData {
fun createShow() = Show(
1,
1,
1,
"idImdb",
"idSlug",
1,
"Title",
2000,
"Overview",
"FirstAired",
60,
"AirtimeDay",
"AirtimeTime",
"AirtimeTimezone",
"Certification",
"Network",
"Country",
"Trailer",
"Homepage",
"Status",
0F,
0L,
0L,
"Genres",
0,
0,
0
)
fun createSettings() = Settings(
1,
false,
true,
true,
0,
2,
"",
"",
"",
"",
false,
false,
false,
false,
false,
false,
false,
"",
true,
"OFF",
"",
"",
false,
false,
"",
"",
false,
false,
false,
"",
"",
"",
"",
"",
true,
true,
true,
true,
true,
"",
true
)
fun createEpisode() = Episode(1, 1, 1, 1, "", 1, 1, 1, 1, "", "", null, 0, 0F, 60, 0, false)
fun createSeason() = Season(1, 1, 1, "", "", null, 0, 0, 0f, false)
}
================================================
FILE: data-local/src/main/AndroidManifest.xml
================================================
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/LocalDataSource.kt
================================================
package com.michaldrabik.data_local
import com.michaldrabik.data_local.sources.ArchiveMoviesLocalDataSource
import com.michaldrabik.data_local.sources.ArchiveShowsLocalDataSource
import com.michaldrabik.data_local.sources.CustomImagesLocalDataSource
import com.michaldrabik.data_local.sources.CustomListsItemsLocalDataSource
import com.michaldrabik.data_local.sources.CustomListsLocalDataSource
import com.michaldrabik.data_local.sources.DiscoverMoviesLocalDataSource
import com.michaldrabik.data_local.sources.DiscoverShowsLocalDataSource
import com.michaldrabik.data_local.sources.EpisodeTranslationsLocalDataSource
import com.michaldrabik.data_local.sources.EpisodesLocalDataSource
import com.michaldrabik.data_local.sources.EpisodesSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.MovieImagesLocalDataSource
import com.michaldrabik.data_local.sources.MovieRatingsLocalDataSource
import com.michaldrabik.data_local.sources.MovieStreamingsLocalDataSource
import com.michaldrabik.data_local.sources.MovieTranslationsLocalDataSource
import com.michaldrabik.data_local.sources.MoviesLocalDataSource
import com.michaldrabik.data_local.sources.MoviesSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.MyMoviesLocalDataSource
import com.michaldrabik.data_local.sources.MyShowsLocalDataSource
import com.michaldrabik.data_local.sources.NewsLocalDataSource
import com.michaldrabik.data_local.sources.PeopleCreditsLocalDataSource
import com.michaldrabik.data_local.sources.PeopleImagesLocalDataSource
import com.michaldrabik.data_local.sources.PeopleLocalDataSource
import com.michaldrabik.data_local.sources.PeopleShowsMoviesLocalDataSource
import com.michaldrabik.data_local.sources.RatingsLocalDataSource
import com.michaldrabik.data_local.sources.RecentSearchLocalDataSource
import com.michaldrabik.data_local.sources.RelatedMoviesLocalDataSource
import com.michaldrabik.data_local.sources.RelatedShowsLocalDataSource
import com.michaldrabik.data_local.sources.SeasonsLocalDataSource
import com.michaldrabik.data_local.sources.SettingsLocalDataSource
import com.michaldrabik.data_local.sources.ShowImagesLocalDataSource
import com.michaldrabik.data_local.sources.ShowRatingsLocalDataSource
import com.michaldrabik.data_local.sources.ShowStreamingsLocalDataSource
import com.michaldrabik.data_local.sources.ShowTranslationsLocalDataSource
import com.michaldrabik.data_local.sources.ShowsLocalDataSource
import com.michaldrabik.data_local.sources.TraktSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.TraktSyncQueueLocalDataSource
import com.michaldrabik.data_local.sources.TranslationsMoviesSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.TranslationsShowsSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.UserLocalDataSource
import com.michaldrabik.data_local.sources.WatchlistMoviesLocalDataSource
import com.michaldrabik.data_local.sources.WatchlistShowsLocalDataSource
import javax.inject.Inject
import javax.inject.Singleton
/**
* Provides local data sources access points.
*/
// TODO Refactor. Split or remove this wrapper at all. Clients do not need to be exposed to everything.
interface LocalDataSource {
val archiveMovies: ArchiveMoviesLocalDataSource
val archiveShows: ArchiveShowsLocalDataSource
val customImages: CustomImagesLocalDataSource
val customLists: CustomListsLocalDataSource
val customListsItems: CustomListsItemsLocalDataSource
val discoverMovies: DiscoverMoviesLocalDataSource
val discoverShows: DiscoverShowsLocalDataSource
val episodes: EpisodesLocalDataSource
val episodesSyncLog: EpisodesSyncLogLocalDataSource
val episodesTranslations: EpisodeTranslationsLocalDataSource
val movieImages: MovieImagesLocalDataSource
val movieRatings: MovieRatingsLocalDataSource
val movieStreamings: MovieStreamingsLocalDataSource
val movieTranslations: MovieTranslationsLocalDataSource
val movies: MoviesLocalDataSource
val moviesSyncLog: MoviesSyncLogLocalDataSource
val myMovies: MyMoviesLocalDataSource
val myShows: MyShowsLocalDataSource
val news: NewsLocalDataSource
val people: PeopleLocalDataSource
val peopleCredits: PeopleCreditsLocalDataSource
val peopleImages: PeopleImagesLocalDataSource
val peopleShowsMovies: PeopleShowsMoviesLocalDataSource
val ratings: RatingsLocalDataSource
val recentSearch: RecentSearchLocalDataSource
val relatedMovies: RelatedMoviesLocalDataSource
val relatedShows: RelatedShowsLocalDataSource
val seasons: SeasonsLocalDataSource
val settings: SettingsLocalDataSource
val showImages: ShowImagesLocalDataSource
val showRatings: ShowRatingsLocalDataSource
val showStreamings: ShowStreamingsLocalDataSource
val showTranslations: ShowTranslationsLocalDataSource
val shows: ShowsLocalDataSource
val traktSyncLog: TraktSyncLogLocalDataSource
val traktSyncQueue: TraktSyncQueueLocalDataSource
val translationsMoviesSyncLog: TranslationsMoviesSyncLogLocalDataSource
val translationsShowsSyncLog: TranslationsShowsSyncLogLocalDataSource
val user: UserLocalDataSource
val watchlistMovies: WatchlistMoviesLocalDataSource
val watchlistShows: WatchlistShowsLocalDataSource
}
@Singleton
internal class MainLocalDataSource @Inject constructor(
override val archiveMovies: ArchiveMoviesLocalDataSource,
override val archiveShows: ArchiveShowsLocalDataSource,
override val customImages: CustomImagesLocalDataSource,
override val customLists: CustomListsLocalDataSource,
override val customListsItems: CustomListsItemsLocalDataSource,
override val discoverMovies: DiscoverMoviesLocalDataSource,
override val discoverShows: DiscoverShowsLocalDataSource,
override val episodes: EpisodesLocalDataSource,
override val episodesSyncLog: EpisodesSyncLogLocalDataSource,
override val episodesTranslations: EpisodeTranslationsLocalDataSource,
override val movieImages: MovieImagesLocalDataSource,
override val movieRatings: MovieRatingsLocalDataSource,
override val movieStreamings: MovieStreamingsLocalDataSource,
override val movieTranslations: MovieTranslationsLocalDataSource,
override val movies: MoviesLocalDataSource,
override val moviesSyncLog: MoviesSyncLogLocalDataSource,
override val myMovies: MyMoviesLocalDataSource,
override val myShows: MyShowsLocalDataSource,
override val news: NewsLocalDataSource,
override val people: PeopleLocalDataSource,
override val peopleCredits: PeopleCreditsLocalDataSource,
override val peopleImages: PeopleImagesLocalDataSource,
override val peopleShowsMovies: PeopleShowsMoviesLocalDataSource,
override val ratings: RatingsLocalDataSource,
override val recentSearch: RecentSearchLocalDataSource,
override val relatedMovies: RelatedMoviesLocalDataSource,
override val relatedShows: RelatedShowsLocalDataSource,
override val seasons: SeasonsLocalDataSource,
override val settings: SettingsLocalDataSource,
override val showImages: ShowImagesLocalDataSource,
override val showRatings: ShowRatingsLocalDataSource,
override val showStreamings: ShowStreamingsLocalDataSource,
override val showTranslations: ShowTranslationsLocalDataSource,
override val shows: ShowsLocalDataSource,
override val traktSyncLog: TraktSyncLogLocalDataSource,
override val traktSyncQueue: TraktSyncQueueLocalDataSource,
override val translationsMoviesSyncLog: TranslationsMoviesSyncLogLocalDataSource,
override val translationsShowsSyncLog: TranslationsShowsSyncLogLocalDataSource,
override val user: UserLocalDataSource,
override val watchlistMovies: WatchlistMoviesLocalDataSource,
override val watchlistShows: WatchlistShowsLocalDataSource
) : LocalDataSource
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/AppDatabase.kt
================================================
package com.michaldrabik.data_local.database
import androidx.room.Database
import androidx.room.RoomDatabase
import com.michaldrabik.data_local.database.dao.ArchiveMoviesDao
import com.michaldrabik.data_local.database.dao.ArchiveShowsDao
import com.michaldrabik.data_local.database.dao.CustomImagesDao
import com.michaldrabik.data_local.database.dao.CustomListsDao
import com.michaldrabik.data_local.database.dao.CustomListsItemsDao
import com.michaldrabik.data_local.database.dao.DiscoverMoviesDao
import com.michaldrabik.data_local.database.dao.DiscoverShowsDao
import com.michaldrabik.data_local.database.dao.EpisodeTranslationsDao
import com.michaldrabik.data_local.database.dao.EpisodesDao
import com.michaldrabik.data_local.database.dao.EpisodesSyncLogDao
import com.michaldrabik.data_local.database.dao.MovieCollectionsDao
import com.michaldrabik.data_local.database.dao.MovieCollectionsItemsDao
import com.michaldrabik.data_local.database.dao.MovieImagesDao
import com.michaldrabik.data_local.database.dao.MovieRatingsDao
import com.michaldrabik.data_local.database.dao.MovieStreamingsDao
import com.michaldrabik.data_local.database.dao.MovieTranslationsDao
import com.michaldrabik.data_local.database.dao.MoviesDao
import com.michaldrabik.data_local.database.dao.MoviesSyncLogDao
import com.michaldrabik.data_local.database.dao.MyMoviesDao
import com.michaldrabik.data_local.database.dao.MyShowsDao
import com.michaldrabik.data_local.database.dao.NewsDao
import com.michaldrabik.data_local.database.dao.PeopleCreditsDao
import com.michaldrabik.data_local.database.dao.PeopleDao
import com.michaldrabik.data_local.database.dao.PeopleImagesDao
import com.michaldrabik.data_local.database.dao.PeopleShowsMoviesDao
import com.michaldrabik.data_local.database.dao.RatingsDao
import com.michaldrabik.data_local.database.dao.RecentSearchDao
import com.michaldrabik.data_local.database.dao.RelatedMoviesDao
import com.michaldrabik.data_local.database.dao.RelatedShowsDao
import com.michaldrabik.data_local.database.dao.SeasonsDao
import com.michaldrabik.data_local.database.dao.SettingsDao
import com.michaldrabik.data_local.database.dao.ShowImagesDao
import com.michaldrabik.data_local.database.dao.ShowRatingsDao
import com.michaldrabik.data_local.database.dao.ShowStreamingsDao
import com.michaldrabik.data_local.database.dao.ShowTranslationsDao
import com.michaldrabik.data_local.database.dao.ShowsDao
import com.michaldrabik.data_local.database.dao.TraktSyncLogDao
import com.michaldrabik.data_local.database.dao.TraktSyncQueueDao
import com.michaldrabik.data_local.database.dao.TranslationsMoviesSyncLogDao
import com.michaldrabik.data_local.database.dao.TranslationsSyncLogDao
import com.michaldrabik.data_local.database.dao.UserDao
import com.michaldrabik.data_local.database.dao.WatchlistMoviesDao
import com.michaldrabik.data_local.database.dao.WatchlistShowsDao
import com.michaldrabik.data_local.database.migrations.DATABASE_VERSION
import com.michaldrabik.data_local.database.model.ArchiveMovie
import com.michaldrabik.data_local.database.model.ArchiveShow
import com.michaldrabik.data_local.database.model.CustomImage
import com.michaldrabik.data_local.database.model.CustomList
import com.michaldrabik.data_local.database.model.CustomListItem
import com.michaldrabik.data_local.database.model.DiscoverMovie
import com.michaldrabik.data_local.database.model.DiscoverShow
import com.michaldrabik.data_local.database.model.Episode
import com.michaldrabik.data_local.database.model.EpisodeTranslation
import com.michaldrabik.data_local.database.model.EpisodesSyncLog
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.database.model.MovieCollection
import com.michaldrabik.data_local.database.model.MovieCollectionItem
import com.michaldrabik.data_local.database.model.MovieImage
import com.michaldrabik.data_local.database.model.MovieRatings
import com.michaldrabik.data_local.database.model.MovieStreaming
import com.michaldrabik.data_local.database.model.MovieTranslation
import com.michaldrabik.data_local.database.model.MoviesSyncLog
import com.michaldrabik.data_local.database.model.MyMovie
import com.michaldrabik.data_local.database.model.MyShow
import com.michaldrabik.data_local.database.model.News
import com.michaldrabik.data_local.database.model.Person
import com.michaldrabik.data_local.database.model.PersonCredits
import com.michaldrabik.data_local.database.model.PersonImage
import com.michaldrabik.data_local.database.model.PersonShowMovie
import com.michaldrabik.data_local.database.model.Rating
import com.michaldrabik.data_local.database.model.RecentSearch
import com.michaldrabik.data_local.database.model.RelatedMovie
import com.michaldrabik.data_local.database.model.RelatedShow
import com.michaldrabik.data_local.database.model.Season
import com.michaldrabik.data_local.database.model.Settings
import com.michaldrabik.data_local.database.model.Show
import com.michaldrabik.data_local.database.model.ShowImage
import com.michaldrabik.data_local.database.model.ShowRatings
import com.michaldrabik.data_local.database.model.ShowStreaming
import com.michaldrabik.data_local.database.model.ShowTranslation
import com.michaldrabik.data_local.database.model.TraktSyncLog
import com.michaldrabik.data_local.database.model.TraktSyncQueue
import com.michaldrabik.data_local.database.model.TranslationsMoviesSyncLog
import com.michaldrabik.data_local.database.model.TranslationsSyncLog
import com.michaldrabik.data_local.database.model.User
import com.michaldrabik.data_local.database.model.WatchlistMovie
import com.michaldrabik.data_local.database.model.WatchlistShow
@Database(
version = DATABASE_VERSION,
entities = [
Show::class,
Movie::class,
DiscoverShow::class,
DiscoverMovie::class,
MyShow::class,
MyMovie::class,
WatchlistShow::class,
WatchlistMovie::class,
ArchiveShow::class,
ArchiveMovie::class,
RelatedShow::class,
RelatedMovie::class,
ShowImage::class,
MovieImage::class,
User::class,
Season::class,
Person::class,
PersonShowMovie::class,
PersonCredits::class,
PersonImage::class,
Episode::class,
Settings::class,
RecentSearch::class,
EpisodesSyncLog::class,
MoviesSyncLog::class,
TranslationsSyncLog::class,
TranslationsMoviesSyncLog::class,
TraktSyncQueue::class,
TraktSyncLog::class,
ShowTranslation::class,
MovieTranslation::class,
EpisodeTranslation::class,
CustomImage::class,
CustomList::class,
CustomListItem::class,
News::class,
Rating::class,
ShowRatings::class,
MovieRatings::class,
ShowStreaming::class,
MovieStreaming::class,
MovieCollection::class,
MovieCollectionItem::class,
],
exportSchema = false
)
abstract class AppDatabase : RoomDatabase() {
abstract fun showsDao(): ShowsDao
abstract fun moviesDao(): MoviesDao
abstract fun discoverShowsDao(): DiscoverShowsDao
abstract fun discoverMoviesDao(): DiscoverMoviesDao
abstract fun myShowsDao(): MyShowsDao
abstract fun myMoviesDao(): MyMoviesDao
abstract fun watchlistShowsDao(): WatchlistShowsDao
abstract fun watchlistMoviesDao(): WatchlistMoviesDao
abstract fun archiveShowsDao(): ArchiveShowsDao
abstract fun archiveMoviesDao(): ArchiveMoviesDao
abstract fun relatedShowsDao(): RelatedShowsDao
abstract fun relatedMoviesDao(): RelatedMoviesDao
abstract fun showImagesDao(): ShowImagesDao
abstract fun movieImagesDao(): MovieImagesDao
abstract fun customImagesDao(): CustomImagesDao
abstract fun userDao(): UserDao
abstract fun recentSearchDao(): RecentSearchDao
abstract fun episodesDao(): EpisodesDao
abstract fun seasonsDao(): SeasonsDao
abstract fun peopleDao(): PeopleDao
abstract fun peopleShowsMoviesDao(): PeopleShowsMoviesDao
abstract fun peopleCreditsDao(): PeopleCreditsDao
abstract fun peopleImagesDao(): PeopleImagesDao
abstract fun settingsDao(): SettingsDao
abstract fun traktSyncLogDao(): TraktSyncLogDao
abstract fun moviesSyncLogDao(): MoviesSyncLogDao
abstract fun episodesSyncLogDao(): EpisodesSyncLogDao
abstract fun translationsSyncLogDao(): TranslationsSyncLogDao
abstract fun translationsMoviesSyncLogDao(): TranslationsMoviesSyncLogDao
abstract fun traktSyncQueueDao(): TraktSyncQueueDao
abstract fun showTranslationsDao(): ShowTranslationsDao
abstract fun movieTranslationsDao(): MovieTranslationsDao
abstract fun ratingsDao(): RatingsDao
abstract fun showRatingsDao(): ShowRatingsDao
abstract fun movieRatingsDao(): MovieRatingsDao
abstract fun showStreamingsDao(): ShowStreamingsDao
abstract fun movieStreamingsDao(): MovieStreamingsDao
abstract fun movieCollectionsDao(): MovieCollectionsDao
abstract fun movieCollectionsItemsDao(): MovieCollectionsItemsDao
abstract fun episodeTranslationsDao(): EpisodeTranslationsDao
abstract fun customListsDao(): CustomListsDao
abstract fun customListsItemsDao(): CustomListsItemsDao
abstract fun newsDao(): NewsDao
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/converters/DateConverter.kt
================================================
package com.michaldrabik.data_local.database.converters
import androidx.room.TypeConverter
import java.time.Instant
import java.time.ZoneId
import java.time.ZonedDateTime
class DateConverter {
@TypeConverter
fun stringToDate(value: Long?) =
value?.let { ZonedDateTime.ofInstant(Instant.ofEpochMilli(it), ZoneId.of("UTC")) }
@TypeConverter
fun dateToString(date: ZonedDateTime?) =
date?.toInstant()?.toEpochMilli()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/ArchiveMoviesDao.kt
================================================
// ktlint-disable max-line-length
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.ArchiveMovie
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.sources.ArchiveMoviesLocalDataSource
@Dao
interface ArchiveMoviesDao : ArchiveMoviesLocalDataSource {
@Query("SELECT movies.*, movies_archive.created_at AS created_at, movies_archive.updated_at AS updated_at FROM movies INNER JOIN movies_archive USING(id_trakt)")
override suspend fun getAll(): List
@Query("SELECT movies.*, movies_archive.created_at AS created_at, movies_archive.updated_at AS updated_at FROM movies INNER JOIN movies_archive USING(id_trakt) WHERE id_trakt IN (:ids)")
override suspend fun getAll(ids: List): List
@Query("SELECT movies.id_trakt FROM movies INNER JOIN movies_archive USING(id_trakt)")
override suspend fun getAllTraktIds(): List
@Query("SELECT movies.* FROM movies INNER JOIN movies_archive USING(id_trakt) WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): Movie?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insert(movie: ArchiveMovie)
@Query("DELETE FROM movies_archive WHERE id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/ArchiveShowsDao.kt
================================================
// ktlint-disable max-line-length
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.ArchiveShow
import com.michaldrabik.data_local.database.model.Show
import com.michaldrabik.data_local.sources.ArchiveShowsLocalDataSource
@Dao
interface ArchiveShowsDao : ArchiveShowsLocalDataSource {
@Query("SELECT shows.*, shows_archive.created_at AS created_at, shows_archive.updated_at AS updated_at FROM shows INNER JOIN shows_archive USING(id_trakt)")
override suspend fun getAll(): List
@Query("SELECT shows.*, shows_archive.created_at AS created_at, shows_archive.updated_at AS updated_at FROM shows INNER JOIN shows_archive USING(id_trakt) WHERE id_trakt IN (:ids)")
override suspend fun getAll(ids: List): List
@Query("SELECT shows.id_trakt FROM shows INNER JOIN shows_archive USING(id_trakt)")
override suspend fun getAllTraktIds(): List
@Query("SELECT shows.* FROM shows INNER JOIN shows_archive USING(id_trakt) WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): Show?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insert(show: ArchiveShow)
@Query("DELETE FROM shows_archive WHERE id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/BaseDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Update
interface BaseDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insert(items: List): List
@Update(onConflict = OnConflictStrategy.REPLACE)
suspend fun update(items: List)
@Delete
suspend fun delete(items: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/CustomImagesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.CustomImage
import com.michaldrabik.data_local.sources.CustomImagesLocalDataSource
@Dao
interface CustomImagesDao : CustomImagesLocalDataSource {
@Query("SELECT * FROM custom_images WHERE id_trakt = :traktId AND type = :type AND family = :family")
override suspend fun getById(traktId: Long, family: String, type: String): CustomImage?
@Query("DELETE FROM custom_images WHERE id_trakt = :traktId AND type = :type AND family = :family")
override suspend fun deleteById(traktId: Long, family: String, type: String)
@Transaction
override suspend fun insertImage(image: CustomImage) {
val localImage = getById(image.idTrakt, image.family, image.type)
if (localImage != null) {
val updated = image.copy(id = localImage.id)
upsert(updated)
return
}
upsert(image)
}
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(image: CustomImage)
@Query("DELETE FROM custom_images")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/CustomListsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.michaldrabik.data_local.database.model.CustomList
import com.michaldrabik.data_local.sources.CustomListsLocalDataSource
@Dao
interface CustomListsDao : CustomListsLocalDataSource {
@Insert(onConflict = OnConflictStrategy.IGNORE)
override suspend fun insert(items: List): List
@Update(onConflict = OnConflictStrategy.REPLACE)
override suspend fun update(items: List)
@Query("SELECT * FROM custom_lists ORDER BY created_at DESC")
override suspend fun getAll(): List
@Query("SELECT * FROM custom_lists WHERE id == :id")
override suspend fun getById(id: Long): CustomList?
@Query("UPDATE custom_lists SET id_trakt = :idTrakt, id_slug = :idSlug, updated_at = :timestamp WHERE id == :id")
override suspend fun updateTraktId(id: Long, idTrakt: Long, idSlug: String, timestamp: Long)
@Query("UPDATE custom_lists SET updated_at = :timestamp WHERE id == :id")
override suspend fun updateTimestamp(id: Long, timestamp: Long)
@Query("UPDATE custom_lists SET sort_by_local = :sortBy, sort_how_local = :sortHow, updated_at = :timestamp WHERE id == :id")
override suspend fun updateSortByLocal(id: Long, sortBy: String, sortHow: String, timestamp: Long)
@Query("UPDATE custom_lists SET filter_type_local = :filterType, updated_at = :timestamp WHERE id == :id")
override suspend fun updateFilterTypeLocal(id: Long, filterType: String, timestamp: Long)
@Query("DELETE FROM custom_lists WHERE id == :id")
override suspend fun deleteById(id: Long)
@Query("DELETE FROM custom_lists")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/CustomListsItemsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import androidx.room.Update
import com.michaldrabik.data_local.database.model.CustomListItem
import com.michaldrabik.data_local.sources.CustomListsItemsLocalDataSource
@Dao
interface CustomListsItemsDao : CustomListsItemsLocalDataSource {
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insert(items: List): List
@Update(onConflict = OnConflictStrategy.REPLACE)
override suspend fun update(items: List)
@Query("SELECT id_list FROM custom_list_item WHERE id_trakt = :idTrakt AND type = :type")
override suspend fun getListsForItem(idTrakt: Long, type: String): List
@Query("SELECT * FROM custom_list_item WHERE id_list = :idList AND id_trakt = :idTrakt AND type = :type")
override suspend fun getByIdTrakt(idList: Long, idTrakt: Long, type: String): CustomListItem?
@Query("SELECT * FROM custom_list_item WHERE id_list = :idList ORDER BY rank ASC")
override suspend fun getItemsById(idList: Long): List
@Query("SELECT * FROM custom_list_item WHERE id_list = :idList ORDER BY rank ASC LIMIT :limit")
override suspend fun getItemsForListImages(idList: Long, limit: Int): List
@Query("SELECT rank FROM custom_list_item WHERE id_list = :idList ORDER BY rank DESC LIMIT 1")
override suspend fun getRankForList(idList: Long): Long?
@Transaction
override suspend fun insertItem(item: CustomListItem) {
val localItem = getByIdTrakt(item.idList, item.idTrakt, item.type)
if (localItem != null) return
val rank = getRankForList(item.idList) ?: 0L
val rankedItem = item.copy(rank = rank + 1L)
insert(listOf(rankedItem))
}
@Query("DELETE FROM custom_list_item WHERE id_list = :idList AND id_trakt == :idTrakt AND type = :type")
override suspend fun deleteItem(idList: Long, idTrakt: Long, type: String)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/DiscoverMoviesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.DiscoverMovie
import com.michaldrabik.data_local.sources.DiscoverMoviesLocalDataSource
@Dao
interface DiscoverMoviesDao : DiscoverMoviesLocalDataSource {
@Query("SELECT * FROM movies_discover ORDER BY id")
override suspend fun getAll(): List
@Query("SELECT * from movies_discover ORDER BY created_at DESC LIMIT 1")
override suspend fun getMostRecent(): DiscoverMovie?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(movies: List)
@Query("DELETE FROM movies_discover")
override suspend fun deleteAll()
@Transaction
override suspend fun replace(movies: List) {
deleteAll()
upsert(movies)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/DiscoverShowsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.DiscoverShow
import com.michaldrabik.data_local.sources.DiscoverShowsLocalDataSource
@Dao
interface DiscoverShowsDao : DiscoverShowsLocalDataSource {
@Query("SELECT * FROM shows_discover ORDER BY id")
override suspend fun getAll(): List
@Query("SELECT * from shows_discover ORDER BY created_at DESC LIMIT 1")
override suspend fun getMostRecent(): DiscoverShow?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(shows: List)
@Query("DELETE FROM shows_discover")
override suspend fun deleteAll()
@Transaction
override suspend fun replace(shows: List) {
deleteAll()
upsert(shows)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/EpisodeTranslationsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.EpisodeTranslation
import com.michaldrabik.data_local.sources.EpisodeTranslationsLocalDataSource
@Dao
interface EpisodeTranslationsDao : BaseDao, EpisodeTranslationsLocalDataSource {
@Query("SELECT * FROM episodes_translations WHERE id_trakt == :traktEpisodeId AND id_trakt_show == :traktShowId AND language == :language")
override suspend fun getById(traktEpisodeId: Long, traktShowId: Long, language: String): EpisodeTranslation?
@Query("SELECT * FROM episodes_translations WHERE id_trakt IN (:traktEpisodeIds) AND id_trakt_show == :traktShowId AND language == :language")
override suspend fun getByIds(traktEpisodeIds: List, traktShowId: Long, language: String): List
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insertSingle(translation: EpisodeTranslation)
@Query("DELETE FROM episodes_translations WHERE language IN (:languages)")
override suspend fun deleteByLanguage(languages: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/EpisodesDao.kt
================================================
// ktlint-disable max-line-length
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy.Companion.REPLACE
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.Episode
import com.michaldrabik.data_local.sources.EpisodesLocalDataSource
@Dao
interface EpisodesDao : EpisodesLocalDataSource {
@Insert(onConflict = REPLACE)
override suspend fun upsert(episodes: List)
@Transaction
override suspend fun upsertChunked(items: List) {
val chunks = items.chunked(500)
chunks.forEach { chunk -> upsert(chunk) }
}
@Query("SELECT EXISTS(SELECT 1 FROM episodes WHERE id_show_trakt = :showTraktId AND id_trakt = :episodeTraktId AND is_watched = 1)")
override suspend fun isEpisodeWatched(showTraktId: Long, episodeTraktId: Long): Boolean
@Query("SELECT * FROM episodes WHERE id_season = :seasonTraktId")
override suspend fun getAllForSeason(seasonTraktId: Long): List
@Query("SELECT * FROM episodes WHERE id_show_trakt = :showTraktId")
override suspend fun getAllByShowId(showTraktId: Long): List
@Query("SELECT * FROM episodes WHERE id_show_trakt = :showTraktId AND season_number = :seasonNumber")
override suspend fun getAllByShowId(showTraktId: Long, seasonNumber: Int): List
@Transaction
override suspend fun getAllByShowsIds(showTraktIds: List): List {
val result = mutableListOf()
val chunks = showTraktIds.chunked(50)
chunks.forEach { chunk ->
result += getAllByShowsIdsChunk(chunk)
}
return result
}
@Transaction
@Query("SELECT * FROM episodes WHERE id_show_trakt IN (:showTraktIds)")
override suspend fun getAllByShowsIdsChunk(showTraktIds: List): List
@Query("SELECT * from episodes where id_show_trakt = :showTraktId AND is_watched = 0 AND season_number != 0 AND first_aired <= :toTime ORDER BY season_number ASC, episode_number ASC LIMIT 1")
override suspend fun getFirstUnwatched(showTraktId: Long, toTime: Long): Episode?
@Query("SELECT * from episodes where id_show_trakt = :showTraktId AND is_watched = 0 AND season_number != 0 AND first_aired > :fromTime AND first_aired <= :toTime ORDER BY season_number ASC, episode_number ASC LIMIT 1")
override suspend fun getFirstUnwatched(showTraktId: Long, fromTime: Long, toTime: Long): Episode?
@Query(
"SELECT * from episodes where id_show_trakt = :showTraktId " +
"AND is_watched = 0 " +
"AND season_number != 0 " +
"AND ((season_number * 10000) + episode_number) > ((:seasonNumber * 10000) + :episodeNumber) " +
"AND first_aired <= :toTime " +
"ORDER BY season_number ASC, episode_number ASC LIMIT 1"
)
override suspend fun getFirstUnwatchedAfterEpisode(showTraktId: Long, seasonNumber: Int, episodeNumber: Int, toTime: Long): Episode?
@Query("SELECT * from episodes where id_show_trakt = :showTraktId AND is_watched = 1 AND season_number != 0 ORDER BY last_watched_at DESC LIMIT 1")
override suspend fun getLastWatched(showTraktId: Long): Episode?
@Query("SELECT COUNT(id_trakt) FROM episodes WHERE id_show_trakt = :showTraktId AND first_aired < :toTime AND season_number != 0")
override suspend fun getTotalCount(showTraktId: Long, toTime: Long): Int
@Query("SELECT COUNT(id_trakt) FROM episodes WHERE id_show_trakt = :showTraktId AND season_number != 0")
override suspend fun getTotalCount(showTraktId: Long): Int
@Query("SELECT COUNT(id_trakt) FROM episodes WHERE id_show_trakt = :showTraktId AND is_watched = 1 AND first_aired < :toTime AND season_number != 0")
override suspend fun getWatchedCount(showTraktId: Long, toTime: Long): Int
@Query("SELECT COUNT(id_trakt) FROM episodes WHERE id_show_trakt = :showTraktId AND is_watched = 1 AND season_number != 0")
override suspend fun getWatchedCount(showTraktId: Long): Int
@Query("SELECT * FROM episodes WHERE id_show_trakt IN(:showsIds) AND is_watched = 1")
override suspend fun getAllWatchedForShows(showsIds: List): List
@Query("SELECT id_trakt FROM episodes WHERE id_show_trakt IN(:showsIds) AND is_watched = 1")
override suspend fun getAllWatchedIdsForShows(showsIds: List): List
@Query("DELETE FROM episodes WHERE id_show_trakt = :showTraktId AND is_watched = 0")
override suspend fun deleteAllUnwatchedForShow(showTraktId: Long)
@Query("DELETE FROM episodes WHERE id_show_trakt = :showTraktId")
override suspend fun deleteAllForShow(showTraktId: Long)
@Delete
override suspend fun delete(items: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/EpisodesSyncLogDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.EpisodesSyncLog
import com.michaldrabik.data_local.sources.EpisodesSyncLogLocalDataSource
@Dao
interface EpisodesSyncLogDao : EpisodesSyncLogLocalDataSource {
@Query("SELECT * from sync_episodes_log")
override suspend fun getAll(): List
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(log: EpisodesSyncLog)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MovieCollectionsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.MovieCollection
import com.michaldrabik.data_local.sources.MovieCollectionsLocalDataSource
@Dao
interface MovieCollectionsDao : BaseDao, MovieCollectionsLocalDataSource {
@Query("SELECT * FROM movies_collections WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): MovieCollection?
@Query("SELECT * FROM movies_collections WHERE id_trakt_movie == :movieTraktId")
override suspend fun getByMovieId(movieTraktId: Long): List
@Transaction
override suspend fun replaceByMovieId(
movieTraktId: Long,
entities: List,
) {
val deleteCollections = getByMovieId(movieTraktId).map { it.idTrakt }
deleteCollectionsItems(deleteCollections)
deleteCollections(deleteCollections)
insert(entities)
}
override suspend fun insertAll(items: List) {
insert(items)
}
@Query("DELETE FROM movies_collections WHERE id_trakt IN (:collectionIds)")
suspend fun deleteCollections(collectionIds: List)
@Query("DELETE FROM movies_collections_items WHERE id_trakt_collection IN (:collectionIds)")
suspend fun deleteCollectionsItems(collectionIds: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MovieCollectionsItemsDao.kt
================================================
// ktlint-disable max-line-length
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.database.model.MovieCollectionItem
import com.michaldrabik.data_local.sources.MovieCollectionsItemsLocalDataSource
@Dao
interface MovieCollectionsItemsDao : BaseDao, MovieCollectionsItemsLocalDataSource {
@Query("SELECT movies.*, movies_collections_items.created_at, movies_collections_items.updated_at FROM movies INNER JOIN movies_collections_items USING(id_trakt) WHERE id_trakt_collection == :collectionId ORDER BY rank ASC")
override suspend fun getById(collectionId: Long): List
@Transaction
override suspend fun replace(
collectionId: Long,
items: List,
) {
deleteById(collectionId)
insert(items)
}
@Query("DELETE FROM movies_collections_items WHERE id_trakt_collection == :collectionId")
override suspend fun deleteById(collectionId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MovieImagesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.MovieImage
import com.michaldrabik.data_local.sources.MovieImagesLocalDataSource
@Dao
interface MovieImagesDao : MovieImagesLocalDataSource {
@Query("SELECT * FROM movies_images WHERE id_tmdb = :tmdbId AND type = :type")
override suspend fun getByMovieId(tmdbId: Long, type: String): MovieImage?
@Transaction
override suspend fun insertMovieImage(image: MovieImage) {
val localImage = getByMovieId(image.idTmdb, image.type)
if (localImage != null) {
val updated = image.copy(id = localImage.id)
upsert(updated)
return
}
upsert(image)
}
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(image: MovieImage)
@Query("DELETE FROM movies_images WHERE id_tmdb = :id AND type = :type")
override suspend fun deleteByMovieId(id: Long, type: String)
@Query("DELETE FROM movies_images WHERE type = 'poster'")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MovieRatingsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.MovieRatings
import com.michaldrabik.data_local.sources.MovieRatingsLocalDataSource
@Dao
interface MovieRatingsDao : BaseDao, MovieRatingsLocalDataSource {
@Transaction
override suspend fun upsert(entity: MovieRatings) {
val local = getById(entity.idTrakt)
if (local != null) {
update(
listOf(
local.copy(
trakt = entity.trakt,
imdb = entity.imdb,
metascore = entity.metascore,
rottenTomatoes = entity.rottenTomatoes,
rottenTomatoesUrl = entity.rottenTomatoesUrl,
updatedAt = entity.updatedAt
)
)
)
return
}
insert(listOf(entity))
}
@Query("SELECT * FROM movies_ratings WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): MovieRatings?
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MovieStreamingsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.MovieStreaming
import com.michaldrabik.data_local.sources.MovieStreamingsLocalDataSource
@Dao
interface MovieStreamingsDao : BaseDao, MovieStreamingsLocalDataSource {
@Transaction
override suspend fun replace(traktId: Long, entities: List) {
deleteById(traktId)
insert(entities)
}
@Query("SELECT * FROM movies_streamings WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): List
@Query("DELETE FROM movies_streamings WHERE id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
@Query("DELETE FROM movies_streamings")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MovieTranslationsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.MovieTranslation
import com.michaldrabik.data_local.sources.MovieTranslationsLocalDataSource
@Dao
interface MovieTranslationsDao : BaseDao, MovieTranslationsLocalDataSource {
@Query("SELECT * FROM movies_translations WHERE id_trakt == :traktId AND language == :language")
override suspend fun getById(traktId: Long, language: String): MovieTranslation?
@Query("SELECT * FROM movies_translations WHERE language == :language")
override suspend fun getAll(language: String): List
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insertSingle(translation: MovieTranslation)
@Query("DELETE FROM movies_translations WHERE language IN (:languages)")
override suspend fun deleteByLanguage(languages: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MoviesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.sources.MoviesLocalDataSource
@Dao
interface MoviesDao : BaseDao, MoviesLocalDataSource {
@Query("SELECT * FROM movies")
override suspend fun getAll(): List
@Query("SELECT * FROM movies WHERE id_trakt IN (:ids)")
override suspend fun getAll(ids: List): List
@Transaction
override suspend fun getAllChunked(ids: List): List = ids
.chunked(500)
.fold(
mutableListOf()
) { acc, chunk ->
acc += getAll(chunk)
acc
}
@Query("SELECT * FROM movies WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): Movie?
@Query("SELECT * FROM movies WHERE id_tmdb == :tmdbId")
override suspend fun getByTmdbId(tmdbId: Long): Movie?
@Query("SELECT * FROM movies WHERE id_slug == :slug")
override suspend fun getBySlug(slug: String): Movie?
@Query("SELECT * FROM movies WHERE id_imdb == :imdbId")
override suspend fun getById(imdbId: String): Movie?
@Query("DELETE FROM movies where id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
@Transaction
override suspend fun upsert(movies: List) {
val result = insert(movies)
val updateList = mutableListOf()
result.forEachIndexed { index, id ->
if (id == -1L) {
updateList.add(movies[index])
}
}
if (updateList.isNotEmpty()) {
update(updateList)
}
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MoviesSyncLogDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.MoviesSyncLog
import com.michaldrabik.data_local.sources.MoviesSyncLogLocalDataSource
@Dao
interface MoviesSyncLogDao : MoviesSyncLogLocalDataSource {
@Query("SELECT * from sync_movies_log")
override suspend fun getAll(): List
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(log: MoviesSyncLog)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MyMoviesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.database.model.MyMovie
import com.michaldrabik.data_local.sources.MyMoviesLocalDataSource
@Dao
interface MyMoviesDao : MyMoviesLocalDataSource {
@Query("SELECT movies.*, movies_my_movies.updated_at AS updated_at FROM movies INNER JOIN movies_my_movies USING(id_trakt)")
override suspend fun getAll(): List
@Query(
"SELECT movies.*, movies_my_movies.updated_at AS updated_at FROM movies " +
"INNER JOIN movies_my_movies USING(id_trakt) WHERE id_trakt IN (:ids)"
)
override suspend fun getAll(ids: List): List
@Query("SELECT movies.* FROM movies INNER JOIN movies_my_movies USING(id_trakt) ORDER BY movies_my_movies.updated_at DESC LIMIT :limit")
override suspend fun getAllRecent(limit: Int): List
@Query("SELECT movies.id_trakt FROM movies INNER JOIN movies_my_movies USING(id_trakt)")
override suspend fun getAllTraktIds(): List
@Query("SELECT movies.* FROM movies INNER JOIN movies_my_movies USING(id_trakt) WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): Movie?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insert(movies: List)
@Query("DELETE FROM movies_my_movies WHERE id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
@Query("SELECT EXISTS(SELECT 1 FROM movies_my_movies WHERE id_trakt = :traktId LIMIT 1);")
override suspend fun checkExists(traktId: Long): Boolean
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/MyShowsDao.kt
================================================
// ktlint-disable max-line-length
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.MyShow
import com.michaldrabik.data_local.database.model.Show
import com.michaldrabik.data_local.sources.MyShowsLocalDataSource
@Dao
interface MyShowsDao : MyShowsLocalDataSource {
@Query("SELECT shows.*, shows_my_shows.created_at AS created_at, shows_my_shows.last_watched_at AS updated_at FROM shows INNER JOIN shows_my_shows USING(id_trakt)")
override suspend fun getAll(): List
@Query("SELECT shows.*, shows_my_shows.created_at AS created_at, shows_my_shows.last_watched_at AS updated_at FROM shows INNER JOIN shows_my_shows USING(id_trakt) WHERE id_trakt IN (:ids)")
override suspend fun getAll(ids: List): List
@Query("SELECT shows.* FROM shows INNER JOIN shows_my_shows USING(id_trakt) ORDER BY shows_my_shows.created_at DESC LIMIT :limit")
override suspend fun getAllRecent(limit: Int): List
@Query("SELECT shows.id_trakt FROM shows INNER JOIN shows_my_shows USING(id_trakt)")
override suspend fun getAllTraktIds(): List
@Query("SELECT shows.* FROM shows INNER JOIN shows_my_shows USING(id_trakt) WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): Show?
@Query("UPDATE shows_my_shows SET last_watched_at = :watchedAt WHERE id_trakt == :traktId")
override suspend fun updateWatchedAt(traktId: Long, watchedAt: Long)
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insert(shows: List)
@Query("DELETE FROM shows_my_shows WHERE id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
@Query("SELECT EXISTS(SELECT 1 FROM shows_my_shows WHERE id_trakt = :traktId LIMIT 1);")
override suspend fun checkExists(traktId: Long): Boolean
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/NewsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.News
import com.michaldrabik.data_local.sources.NewsLocalDataSource
@Dao
interface NewsDao : BaseDao, NewsLocalDataSource {
@Query("SELECT * FROM news WHERE type == :type ORDER BY dated_at DESC")
override suspend fun getAllByType(type: String): List
@Transaction
override suspend fun replaceForType(items: List, type: String) {
deleteAllByType(type)
insert(items)
}
@Query("DELETE FROM news WHERE type == :type")
override suspend fun deleteAllByType(type: String): Int
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/PeopleCreditsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
/* ktlint-disable */
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.database.model.PersonCredits
import com.michaldrabik.data_local.database.model.Show
import com.michaldrabik.data_local.sources.PeopleCreditsLocalDataSource
@Dao
interface PeopleCreditsDao : BaseDao, PeopleCreditsLocalDataSource {
@Query(
"SELECT shows.*, people_credits.created_at AS created_at, people_credits.updated_at AS updated_at FROM shows " +
"INNER JOIN people_credits ON people_credits.id_trakt_show = shows.id_trakt WHERE people_credits.id_trakt_person = :personTraktId"
)
override suspend fun getAllShowsForPerson(personTraktId: Long): List
@Query(
"SELECT movies.*, people_credits.created_at AS created_at, people_credits.updated_at AS updated_at FROM movies " +
"INNER JOIN people_credits ON people_credits.id_trakt_movie = movies.id_trakt WHERE people_credits.id_trakt_person = :personTraktId"
)
override suspend fun getAllMoviesForPerson(personTraktId: Long): List
@Query("SELECT updated_at FROM people_credits WHERE id_trakt_person = :personTraktId LIMIT 1")
override suspend fun getTimestampForPerson(personTraktId: Long): Long?
@Query("DELETE FROM people_credits WHERE id_trakt_person == :personTraktId")
override suspend fun deleteAllForPerson(personTraktId: Long)
@Transaction
override suspend fun insertSingle(personTraktId: Long, credits: List) {
deleteAllForPerson(personTraktId)
insert(credits)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/PeopleDao.kt
================================================
package com.michaldrabik.data_local.database.dao
/* ktlint-disable */
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.Person
import com.michaldrabik.data_local.sources.PeopleLocalDataSource
@Dao
interface PeopleDao : BaseDao, PeopleLocalDataSource {
@Transaction
override suspend fun upsert(people: List) {
val result = insert(people)
val updateList = mutableListOf()
result.forEachIndexed { index, id ->
if (id == -1L) {
updateList.add(people[index])
}
}
if (updateList.isNotEmpty()) update(updateList)
}
@Query("SELECT * FROM people WHERE id_tmdb = :tmdbId")
override suspend fun getById(tmdbId: Long): Person?
@Query("SELECT people.*, people_shows_movies.department AS department, people_shows_movies.character AS character, people_shows_movies.job AS job, people_shows_movies.episodes_count AS episodes_count FROM people INNER JOIN people_shows_movies ON people_shows_movies.id_tmdb_person = people.id_tmdb WHERE people_shows_movies.id_trakt_show = :showTraktId")
override suspend fun getAllForShow(showTraktId: Long): List
@Query("SELECT people.*, people_shows_movies.department AS department, people_shows_movies.character AS character, people_shows_movies.job AS job, people_shows_movies.episodes_count AS episodes_count FROM people INNER JOIN people_shows_movies ON people_shows_movies.id_tmdb_person = people.id_tmdb WHERE people_shows_movies.id_trakt_movie = :movieTraktId")
override suspend fun getAllForMovie(movieTraktId: Long): List
@Query("SELECT * FROM people")
override suspend fun getAll(): List
@Query("UPDATE people SET id_trakt = :idTrakt WHERE id_tmdb = :idTmdb")
override suspend fun updateTraktId(idTrakt: Long, idTmdb: Long)
@Query("UPDATE people SET biography_translation = NULL, details_updated_at = NULL")
override suspend fun deleteTranslations()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/PeopleImagesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
/* ktlint-disable */
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.PersonImage
import com.michaldrabik.data_local.sources.PeopleImagesLocalDataSource
@Dao
interface PeopleImagesDao : BaseDao, PeopleImagesLocalDataSource {
@Query("SELECT updated_at FROM people_images WHERE id_tmdb = :personTmdbId LIMIT 1")
override suspend fun getTimestampForPerson(personTmdbId: Long): Long?
@Query("SELECT * FROM people_images WHERE id_tmdb = :personTmdbId")
override suspend fun getAll(personTmdbId: Long): List
@Query("DELETE FROM people_images WHERE id_tmdb == :personTmdbId")
override suspend fun deleteAllForPerson(personTmdbId: Long)
@Transaction
override suspend fun insertSingle(personTmdbId: Long, images: List) {
deleteAllForPerson(personTmdbId)
insert(images)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/PeopleShowsMoviesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.PersonShowMovie
import com.michaldrabik.data_local.sources.PeopleShowsMoviesLocalDataSource
@Dao
interface PeopleShowsMoviesDao : BaseDao, PeopleShowsMoviesLocalDataSource {
@Query("SELECT updated_at FROM people_shows_movies WHERE id_trakt_show == :showTraktId LIMIT 1")
override suspend fun getTimestampForShow(showTraktId: Long): Long?
@Query("SELECT updated_at FROM people_shows_movies WHERE id_trakt_movie == :movieTraktId LIMIT 1")
override suspend fun getTimestampForMovie(movieTraktId: Long): Long?
@Query("DELETE FROM people_shows_movies WHERE id_trakt_show == :showTraktId")
override suspend fun deleteAllForShow(showTraktId: Long)
@Query("DELETE FROM people_shows_movies WHERE id_trakt_movie == :movieTraktId")
override suspend fun deleteAllForMovie(movieTraktId: Long)
@Transaction
override suspend fun insertForShow(people: List, showTraktId: Long) {
deleteAllForShow(showTraktId)
insert(people)
}
@Transaction
override suspend fun insertForMovie(people: List, movieTraktId: Long) {
deleteAllForMovie(movieTraktId)
insert(people)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/RatingsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.Rating
import com.michaldrabik.data_local.sources.RatingsLocalDataSource
@Dao
interface RatingsDao : BaseDao, RatingsLocalDataSource {
@Query("SELECT * FROM ratings")
override suspend fun getAll(): List
@Query("SELECT * FROM ratings WHERE type == :type")
override suspend fun getAllByType(type: String): List
@Query("SELECT * FROM ratings WHERE id_trakt IN (:idsTrakt) AND type == :type")
override suspend fun getAllByType(idsTrakt: List, type: String): List
@Query("DELETE FROM ratings WHERE type == :type")
override suspend fun deleteAllByType(type: String)
@Query("DELETE FROM ratings WHERE id_trakt == :traktId AND type == :type")
override suspend fun deleteByType(traktId: Long, type: String)
@Transaction
override suspend fun replaceAll(ratings: List, type: String) {
deleteAllByType(type)
insert(ratings)
}
@Transaction
override suspend fun replace(rating: Rating) {
deleteByType(rating.idTrakt, rating.type)
insert(listOf(rating))
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/RecentSearchDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.RecentSearch
import com.michaldrabik.data_local.sources.RecentSearchLocalDataSource
@Dao
interface RecentSearchDao : RecentSearchLocalDataSource {
@Query("SELECT * FROM recent_searches ORDER BY created_at DESC LIMIT :limit")
override suspend fun getAll(limit: Int): List
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(searches: List)
@Query("DELETE FROM recent_searches")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/RelatedMoviesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.RelatedMovie
import com.michaldrabik.data_local.sources.RelatedMoviesLocalDataSource
@Dao
interface RelatedMoviesDao : RelatedMoviesLocalDataSource {
@Insert(onConflict = OnConflictStrategy.IGNORE)
override suspend fun insert(items: List): List
@Query("SELECT * FROM movies_related WHERE id_trakt_related_movie == :traktId")
override suspend fun getAllById(traktId: Long): List
@Query("SELECT * FROM movies_related")
override suspend fun getAll(): List
@Query("DELETE FROM movies_related WHERE id_trakt_related_movie == :traktId")
override suspend fun deleteById(traktId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/RelatedShowsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.RelatedShow
import com.michaldrabik.data_local.sources.RelatedShowsLocalDataSource
@Dao
interface RelatedShowsDao : RelatedShowsLocalDataSource {
@Insert(onConflict = OnConflictStrategy.IGNORE)
override suspend fun insert(items: List): List
@Query("SELECT * FROM shows_related WHERE id_trakt_related_show == :traktId")
override suspend fun getAllById(traktId: Long): List
@Query("SELECT * FROM shows_related")
override suspend fun getAll(): List
@Query("DELETE FROM shows_related WHERE id_trakt_related_show == :traktId")
override suspend fun deleteById(traktId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/SeasonsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import androidx.room.Update
import com.michaldrabik.data_local.database.model.Season
import com.michaldrabik.data_local.sources.SeasonsLocalDataSource
@Dao
interface SeasonsDao : SeasonsLocalDataSource {
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insert(items: List): List
@Update(onConflict = OnConflictStrategy.REPLACE)
override suspend fun update(items: List)
@Delete
override suspend fun delete(items: List)
@Transaction
override suspend fun getAllByShowsIds(traktIds: List): List {
val result = mutableListOf()
val chunks = traktIds.chunked(50)
chunks.forEach { chunk ->
result += getAllByShowsIdsChunk(chunk)
}
return result
}
@Query("SELECT * FROM seasons WHERE id_show_trakt IN (:traktIds)")
override suspend fun getAllByShowsIdsChunk(traktIds: List): List
@Query("SELECT * FROM seasons WHERE id_show_trakt IN (:traktIds) AND is_watched = 1")
override suspend fun getAllWatchedForShows(traktIds: List): List
@Query("SELECT id_trakt FROM seasons WHERE id_show_trakt IN (:traktIds) AND is_watched = 1")
override suspend fun getAllWatchedIdsForShows(traktIds: List): List
@Query("SELECT * FROM seasons WHERE id_show_trakt = :traktId")
override suspend fun getAllByShowId(traktId: Long): List
@Query("SELECT * FROM seasons WHERE id_trakt = :traktId")
override suspend fun getById(traktId: Long): Season?
@Transaction
override suspend fun upsert(items: List) {
val result = insert(items)
val updateList = mutableListOf()
result.forEachIndexed { index, id ->
if (id == -1L) updateList.add(items[index])
}
if (updateList.isNotEmpty()) update(updateList)
}
@Query("DELETE FROM seasons WHERE id_show_trakt = :showTraktId")
override suspend fun deleteAllForShow(showTraktId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/SettingsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.Settings
import com.michaldrabik.data_local.sources.SettingsLocalDataSource
@Dao
interface SettingsDao : SettingsLocalDataSource {
@Query("SELECT * FROM settings")
override suspend fun getAll(): Settings
@Query("SELECT COUNT(*) FROM settings")
override suspend fun getCount(): Int
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(settings: Settings)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/ShowImagesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.ShowImage
import com.michaldrabik.data_local.sources.ShowImagesLocalDataSource
@Dao
interface ShowImagesDao : ShowImagesLocalDataSource {
@Query("SELECT * FROM shows_images WHERE id_tmdb = :tmdbId AND type = :type AND family = 'show'")
override suspend fun getByShowId(tmdbId: Long, type: String): ShowImage?
@Query("SELECT * FROM shows_images WHERE id_tmdb = :tmdbId AND type = :type AND family = 'episode'")
override suspend fun getByEpisodeId(tmdbId: Long, type: String): ShowImage?
@Transaction
override suspend fun insertShowImage(image: ShowImage) {
val localImage = getByShowId(image.idTmdb, image.type)
if (localImage != null) {
val updated = image.copy(id = localImage.id)
upsert(updated)
return
}
upsert(image)
}
@Transaction
override suspend fun insertEpisodeImage(image: ShowImage) {
val localImage = getByEpisodeId(image.idTmdb, image.type)
if (localImage != null) {
val updated = image.copy(id = localImage.id)
upsert(updated)
return
}
upsert(image)
}
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(image: ShowImage)
@Query("DELETE FROM shows_images WHERE id_tmdb = :id AND type = :type AND family = 'show'")
override suspend fun deleteByShowId(id: Long, type: String)
@Query("DELETE FROM shows_images WHERE id_tmdb = :id AND type = :type AND family = 'episode'")
override suspend fun deleteByEpisodeId(id: Long, type: String)
@Query("DELETE FROM shows_images WHERE type = 'poster'")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/ShowRatingsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.ShowRatings
import com.michaldrabik.data_local.sources.ShowRatingsLocalDataSource
@Dao
interface ShowRatingsDao : BaseDao, ShowRatingsLocalDataSource {
@Transaction
override suspend fun upsert(entity: ShowRatings) {
val local = getById(entity.idTrakt)
if (local != null) {
update(
listOf(
local.copy(
trakt = entity.trakt,
imdb = entity.imdb,
metascore = entity.metascore,
rottenTomatoes = entity.rottenTomatoes,
rottenTomatoesUrl = entity.rottenTomatoesUrl,
updatedAt = entity.updatedAt
)
)
)
return
}
insert(listOf(entity))
}
@Query("SELECT * FROM shows_ratings WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): ShowRatings?
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/ShowStreamingsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.ShowStreaming
import com.michaldrabik.data_local.sources.ShowStreamingsLocalDataSource
@Dao
interface ShowStreamingsDao : BaseDao, ShowStreamingsLocalDataSource {
@Transaction
override suspend fun replace(traktId: Long, entities: List) {
deleteById(traktId)
insert(entities)
}
@Query("SELECT * FROM shows_streamings WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): List
@Query("DELETE FROM shows_streamings WHERE id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
@Query("DELETE FROM shows_streamings")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/ShowTranslationsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy.Companion.REPLACE
import androidx.room.Query
import com.michaldrabik.data_local.database.model.ShowTranslation
import com.michaldrabik.data_local.sources.ShowTranslationsLocalDataSource
@Dao
interface ShowTranslationsDao : BaseDao, ShowTranslationsLocalDataSource {
@Query("SELECT * FROM shows_translations WHERE id_trakt == :traktId AND language == :language")
override suspend fun getById(traktId: Long, language: String): ShowTranslation?
@Query("SELECT * FROM shows_translations WHERE language == :language")
override suspend fun getAll(language: String): List
@Insert(onConflict = REPLACE)
override suspend fun insertSingle(translation: ShowTranslation)
@Query("DELETE FROM shows_translations WHERE language IN (:languages)")
override suspend fun deleteByLanguage(languages: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/ShowsDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.Show
import com.michaldrabik.data_local.sources.ShowsLocalDataSource
@Dao
interface ShowsDao : BaseDao, ShowsLocalDataSource {
@Query("SELECT * FROM shows")
override suspend fun getAll(): List
@Query("SELECT * FROM shows WHERE id_trakt IN (:ids)")
override suspend fun getAll(ids: List): List
@Transaction
override suspend fun getAllChunked(ids: List): List = ids
.chunked(500)
.fold(mutableListOf()) { acc, chunk ->
acc += getAll(chunk)
acc
}
@Query("SELECT * FROM shows WHERE id_trakt == :traktId")
override suspend fun getById(traktId: Long): Show?
@Query("SELECT * FROM shows WHERE id_tmdb == :tmdbId")
override suspend fun getByTmdbId(tmdbId: Long): Show?
@Query("SELECT * FROM shows WHERE id_slug == :slug")
override suspend fun getBySlug(slug: String): Show?
@Query("SELECT * FROM shows WHERE id_imdb == :imdbId")
override suspend fun getById(imdbId: String): Show?
@Query("DELETE FROM shows where id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
@Transaction
override suspend fun upsert(shows: List) {
val result = insert(shows)
val updateList = mutableListOf()
result.forEachIndexed { index, id ->
if (id == -1L) updateList.add(shows[index])
}
if (updateList.isNotEmpty()) update(updateList)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/TraktSyncLogDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.michaldrabik.data_local.database.model.TraktSyncLog
import com.michaldrabik.data_local.sources.TraktSyncLogLocalDataSource
@Dao
interface TraktSyncLogDao : TraktSyncLogLocalDataSource {
@Query("SELECT * FROM sync_trakt_log WHERE type == 'show'")
override suspend fun getAllShows(): List
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insert(log: TraktSyncLog)
@Query("UPDATE sync_trakt_log SET synced_at = :syncedAt WHERE id_trakt == :idTrakt AND type == :type")
override suspend fun update(idTrakt: Long, type: String, syncedAt: Long): Int
@Query("DELETE FROM sync_trakt_log")
override suspend fun deleteAll()
@Transaction
override suspend fun upsertShow(idTrakt: Long, syncedAt: Long) {
val result = update(idTrakt, "show", syncedAt)
if (result <= 0) {
insert(TraktSyncLog(0, idTrakt, "show", syncedAt))
}
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/TraktSyncQueueDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.TraktSyncQueue
import com.michaldrabik.data_local.sources.TraktSyncQueueLocalDataSource
@Dao
interface TraktSyncQueueDao : TraktSyncQueueLocalDataSource {
@Insert(onConflict = OnConflictStrategy.IGNORE)
override suspend fun insert(items: List): List
@Delete
override suspend fun delete(items: List)
@Query("SELECT * FROM trakt_sync_queue ORDER BY created_at ASC")
override suspend fun getAll(): List
@Query("SELECT * FROM trakt_sync_queue WHERE type IN (:types) ORDER BY created_at ASC")
override suspend fun getAll(types: List): List
@Query("DELETE FROM trakt_sync_queue WHERE id_trakt IN (:idsTrakt) AND type = :type")
override suspend fun deleteAll(idsTrakt: List, type: String): Int
@Query("DELETE FROM trakt_sync_queue WHERE type = :type")
override suspend fun deleteAll(type: String): Int
@Query("DELETE FROM trakt_sync_queue")
override suspend fun deleteAll()
@Query("DELETE FROM trakt_sync_queue WHERE id_list = :idList")
override suspend fun deleteAllForList(idList: Long): Int
@Query("DELETE FROM trakt_sync_queue WHERE id_trakt = :idTrakt AND id_list = :idList AND type = :type AND operation = :operation")
override suspend fun delete(
idTrakt: Long,
idList: Long,
type: String,
operation: String
): Int
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/TranslationsMoviesSyncLogDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.TranslationsMoviesSyncLog
import com.michaldrabik.data_local.sources.TranslationsMoviesSyncLogLocalDataSource
@Dao
interface TranslationsMoviesSyncLogDao : TranslationsMoviesSyncLogLocalDataSource {
@Query("SELECT * from sync_movies_translations_log")
override suspend fun getAll(): List
@Query("SELECT * from sync_movies_translations_log WHERE id_movie_trakt == :idTrakt")
override suspend fun getById(idTrakt: Long): TranslationsMoviesSyncLog?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(log: TranslationsMoviesSyncLog)
@Query("DELETE FROM sync_movies_translations_log")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/TranslationsSyncLogDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.TranslationsSyncLog
import com.michaldrabik.data_local.sources.TranslationsShowsSyncLogLocalDataSource
@Dao
interface TranslationsSyncLogDao : TranslationsShowsSyncLogLocalDataSource {
@Query("SELECT * from sync_translations_log")
override suspend fun getAll(): List
@Query("SELECT * from sync_translations_log WHERE id_show_trakt == :idTrakt")
override suspend fun getById(idTrakt: Long): TranslationsSyncLog?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(log: TranslationsSyncLog)
@Query("DELETE FROM sync_translations_log")
override suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/UserDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.User
import com.michaldrabik.data_local.sources.UserLocalDataSource
@Dao
interface UserDao : UserLocalDataSource {
@Query("SELECT * FROM user WHERE id == 1")
override suspend fun get(): User?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun upsert(user: User)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/WatchlistMoviesDao.kt
================================================
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.database.model.WatchlistMovie
import com.michaldrabik.data_local.sources.WatchlistMoviesLocalDataSource
@Dao
interface WatchlistMoviesDao : WatchlistMoviesLocalDataSource {
@Query("SELECT movies.*, movies_see_later.created_at, movies_see_later.updated_at FROM movies INNER JOIN movies_see_later USING(id_trakt)")
override suspend fun getAll(): List
@Query("SELECT movies.id_trakt FROM movies INNER JOIN movies_see_later USING(id_trakt)")
override suspend fun getAllTraktIds(): List
@Query("SELECT movies.* FROM movies INNER JOIN movies_see_later ON movies_see_later.id_trakt == movies.id_trakt WHERE movies.id_trakt == :traktId")
override suspend fun getById(traktId: Long): Movie?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insert(movie: WatchlistMovie)
@Query("DELETE FROM movies_see_later WHERE id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
@Query("SELECT EXISTS(SELECT 1 FROM movies_see_later WHERE id_trakt = :traktId LIMIT 1);")
override suspend fun checkExists(traktId: Long): Boolean
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/dao/WatchlistShowsDao.kt
================================================
// ktlint-disable max-line-length
package com.michaldrabik.data_local.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.michaldrabik.data_local.database.model.Show
import com.michaldrabik.data_local.database.model.WatchlistShow
import com.michaldrabik.data_local.sources.WatchlistShowsLocalDataSource
@Dao
interface WatchlistShowsDao : WatchlistShowsLocalDataSource {
@Query("SELECT shows.*, shows_see_later.created_at AS created_at, shows_see_later.updated_at AS updated_at FROM shows INNER JOIN shows_see_later USING(id_trakt)")
override suspend fun getAll(): List
@Query("SELECT shows.id_trakt FROM shows INNER JOIN shows_see_later USING(id_trakt)")
override suspend fun getAllTraktIds(): List
@Query("SELECT shows.* FROM shows INNER JOIN shows_see_later ON shows_see_later.id_trakt == shows.id_trakt WHERE shows.id_trakt == :traktId")
override suspend fun getById(traktId: Long): Show?
@Insert(onConflict = OnConflictStrategy.REPLACE)
override suspend fun insert(show: WatchlistShow)
@Query("DELETE FROM shows_see_later WHERE id_trakt == :traktId")
override suspend fun deleteById(traktId: Long)
@Query("SELECT EXISTS(SELECT 1 FROM shows_see_later WHERE id_trakt = :traktId LIMIT 1);")
override suspend fun checkExists(traktId: Long): Boolean
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/migrations/Migrations.kt
================================================
package com.michaldrabik.data_local.database.migrations
import android.content.Context
import android.content.Context.MODE_PRIVATE
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
const val DATABASE_VERSION = 38
const val DATABASE_NAME = "SHOWLY2_DB_2"
class Migrations(context: Context) {
private val migration2 = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN show_anticipated_shows INTEGER NOT NULL DEFAULT 1")
}
}
private val migration3 = object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE actors ADD COLUMN id_imdb TEXT")
}
}
private val migration4 = object : Migration(3, 4) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN trakt_sync_schedule TEXT NOT NULL DEFAULT 'OFF'")
}
}
private val migration5 = object : Migration(4, 5) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN my_shows_running_is_enabled INTEGER NOT NULL DEFAULT 1")
database.execSQL("ALTER TABLE settings ADD COLUMN my_shows_incoming_is_enabled INTEGER NOT NULL DEFAULT 1")
database.execSQL("ALTER TABLE settings ADD COLUMN my_shows_ended_is_enabled INTEGER NOT NULL DEFAULT 1")
database.execSQL("ALTER TABLE settings ADD COLUMN my_shows_recent_is_enabled INTEGER NOT NULL DEFAULT 1")
}
}
private val migration6 = object : Migration(5, 6) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("CREATE INDEX index_episodes_id_show_trakt ON episodes(id_show_trakt)")
database.execSQL("CREATE INDEX index_seasons_id_show_trakt ON seasons(id_show_trakt)")
}
}
private val migration7 = object : Migration(6, 7) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN discover_filter_genres TEXT NOT NULL DEFAULT ''")
database.execSQL("ALTER TABLE settings ADD COLUMN discover_filter_feed TEXT NOT NULL DEFAULT 'HOT'")
database.execSQL("ALTER TABLE settings ADD COLUMN trakt_quick_sync_enabled INTEGER NOT NULL DEFAULT 0")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `trakt_sync_queue` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`type` TEXT NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL)"
)
}
}
private val migration8 = object : Migration(7, 8) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN watchlist_sort_by TEXT NOT NULL DEFAULT 'NAME'")
}
}
private val migration9 = object : Migration(8, 9) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN trakt_quick_remove_enabled INTEGER NOT NULL DEFAULT 0")
}
}
private val migration10 = object : Migration(9, 10) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL(
"CREATE TABLE IF NOT EXISTS `shows_archive` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `shows`(`id_trakt`) ON DELETE CASCADE)"
)
database.execSQL("CREATE UNIQUE INDEX index_shows_archive_id_trakt ON shows_archive(id_trakt)")
database.execSQL("ALTER TABLE settings ADD COLUMN archive_shows_sort_by TEXT NOT NULL DEFAULT 'NAME'")
}
}
private val migration11 = object : Migration(10, 11) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN archive_shows_include_statistics INTEGER NOT NULL DEFAULT 1")
}
}
private val migration12 = object : Migration(11, 12) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN special_seasons_enabled INTEGER NOT NULL DEFAULT 0")
}
}
private val migration13 = object : Migration(12, 13) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL(
"CREATE TABLE IF NOT EXISTS `shows_translations` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, `title` TEXT NOT NULL, `language` TEXT NOT NULL, `overview` TEXT NOT NULL, " +
"`created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `shows`(`id_trakt`) ON DELETE CASCADE)"
)
database.execSQL("CREATE UNIQUE INDEX index_shows_translations_id_trakt ON shows_translations(id_trakt)")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `episodes_translations` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, `id_trakt_show` INTEGER NOT NULL, " +
"`title` TEXT NOT NULL, `language` TEXT NOT NULL, `overview` TEXT NOT NULL, " +
"`created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt_show`) REFERENCES `shows`(`id_trakt`) ON DELETE CASCADE)"
)
database.execSQL("CREATE UNIQUE INDEX index_episodes_translations_id_trakt ON episodes_translations(id_trakt)")
database.execSQL("CREATE INDEX index_episodes_translations_id_trakt_show ON episodes_translations(id_trakt_show)")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `sync_translations_log` (" +
"`id_show_trakt` INTEGER PRIMARY KEY NOT NULL, " +
"`synced_at` INTEGER NOT NULL)"
)
}
}
private val migration14 = object : Migration(13, 14) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE shows_images ADD COLUMN source TEXT NOT NULL DEFAULT 'tvdb'")
}
}
private val migration15 = object : Migration(14, 15) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN show_anticipated_movies INTEGER NOT NULL DEFAULT 0")
database.execSQL("ALTER TABLE settings ADD COLUMN discover_movies_filter_genres TEXT NOT NULL DEFAULT ''")
database.execSQL("ALTER TABLE settings ADD COLUMN discover_movies_filter_feed TEXT NOT NULL DEFAULT 'HOT'")
database.execSQL("ALTER TABLE settings ADD COLUMN my_movies_all_sort_by TEXT NOT NULL DEFAULT 'NAME'")
database.execSQL("ALTER TABLE settings ADD COLUMN see_later_movies_sort_by TEXT NOT NULL DEFAULT 'NAME'")
database.execSQL("ALTER TABLE settings ADD COLUMN progress_movies_sort_by TEXT NOT NULL DEFAULT 'NAME'")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `movies` (" +
"`id_trakt` INTEGER PRIMARY KEY NOT NULL, " +
"`id_tmdb` INTEGER NOT NULL DEFAULT -1, " +
"`id_imdb` TEXT NOT NULL DEFAULT '', " +
"`id_slug` TEXT NOT NULL DEFAULT '', " +
"`title` TEXT NOT NULL DEFAULT '', " +
"`year` INTEGER NOT NULL DEFAULT -1, " +
"`overview` TEXT NOT NULL DEFAULT '', " +
"`released` TEXT NOT NULL DEFAULT '', " +
"`runtime` INTEGER NOT NULL DEFAULT -1, " +
"`country` TEXT NOT NULL DEFAULT '', " +
"`trailer` TEXT NOT NULL DEFAULT '', " +
"`language` TEXT NOT NULL DEFAULT '', " +
"`homepage` TEXT NOT NULL DEFAULT '', " +
"`status` TEXT NOT NULL DEFAULT '', " +
"`rating` REAL NOT NULL DEFAULT -1, " +
"`votes` INTEGER NOT NULL DEFAULT -1, " +
"`comment_count` INTEGER NOT NULL DEFAULT -1, " +
"`genres` TEXT NOT NULL DEFAULT '', " +
"`updated_at` INTEGER NOT NULL DEFAULT -1)"
)
database.execSQL(
"CREATE TABLE IF NOT EXISTS `movies_discover` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL DEFAULT -1, " +
"`created_at` INTEGER NOT NULL DEFAULT -1, " +
"`updated_at` INTEGER NOT NULL DEFAULT -1, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
database.execSQL("CREATE INDEX index_discover_movies_id_trakt ON movies_discover(id_trakt)")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `movies_images` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_tmdb` INTEGER NOT NULL DEFAULT -1, " +
"`type` TEXT NOT NULL DEFAULT '', " +
"`file_url` TEXT NOT NULL DEFAULT '', " +
"`source` TEXT NOT NULL DEFAULT 'tmdb')"
)
database.execSQL(
"CREATE TABLE IF NOT EXISTS `movies_translations` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, `title` TEXT NOT NULL, " +
"`language` TEXT NOT NULL, " +
"`overview` TEXT NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
database.execSQL("CREATE UNIQUE INDEX index_movies_translations_id_trakt ON movies_translations(id_trakt)")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `sync_movies_translations_log` (" +
"`id_movie_trakt` INTEGER PRIMARY KEY NOT NULL, " +
"`synced_at` INTEGER NOT NULL)"
)
database.execSQL(
"CREATE TABLE IF NOT EXISTS `movies_related` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL DEFAULT -1, " +
"`id_trakt_related_movie` INTEGER NOT NULL DEFAULT -1, " +
"`updated_at` INTEGER NOT NULL DEFAULT -1, " +
"FOREIGN KEY(`id_trakt_related_movie`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
database.execSQL("CREATE INDEX index_movies_related_id_trakt ON movies_related(id_trakt_related_movie)")
database.execSQL("ALTER TABLE actors ADD COLUMN id_tmdb_movie INTEGER NOT NULL DEFAULT -1")
database.execSQL("ALTER TABLE actors ADD COLUMN id_tmdb INTEGER NOT NULL DEFAULT -1")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `movies_my_movies` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL DEFAULT -1, " +
"`created_at` INTEGER NOT NULL DEFAULT -1, " +
"`updated_at` INTEGER NOT NULL DEFAULT -1, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
database.execSQL("CREATE INDEX index_movies_my_movies_id_trakt ON movies_my_movies(id_trakt)")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `movies_see_later` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL DEFAULT -1, " +
"`created_at` INTEGER NOT NULL DEFAULT -1, " +
"`updated_at` INTEGER NOT NULL DEFAULT -1, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
database.execSQL("CREATE INDEX index_movies_see_later_id_trakt ON movies_see_later(id_trakt)")
database.execSQL(
"CREATE TABLE IF NOT EXISTS `sync_movies_log` (" +
"`id_movie_trakt` INTEGER PRIMARY KEY NOT NULL DEFAULT -1, " +
"`synced_at` INTEGER NOT NULL DEFAULT 0)"
)
database.execSQL(
"CREATE TABLE IF NOT EXISTS `sync_trakt_log` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`type` TEXT NOT NULL, " +
"`synced_at` INTEGER NOT NULL)"
)
database.execSQL("CREATE INDEX index_sync_trakt_log_id_trakt ON sync_trakt_log(id_trakt)")
database.execSQL("CREATE INDEX index_sync_trakt_log_type ON sync_trakt_log(type)")
database.execSQL("CREATE UNIQUE INDEX index_sync_trakt_log_id_trakt_type ON sync_trakt_log(id_trakt, type)")
}
}
private val migration16 = object : Migration(15, 16) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN show_collection_shows INTEGER NOT NULL DEFAULT 1")
database.execSQL("ALTER TABLE settings ADD COLUMN show_collection_movies INTEGER NOT NULL DEFAULT 1")
}
}
private val migration17 = object : Migration(16, 17) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN widgets_show_label INTEGER NOT NULL DEFAULT 1")
}
}
private val migration18 = object : Migration(17, 18) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL("ALTER TABLE actors ADD COLUMN id_tmdb_show INTEGER NOT NULL DEFAULT -1")
execSQL("DELETE FROM actors")
execSQL("ALTER TABLE shows_images ADD COLUMN id_tmdb INTEGER NOT NULL DEFAULT -1")
execSQL("DELETE FROM shows_images WHERE source = 'tvdb' OR family = 'movie'")
execSQL("CREATE INDEX index_shows_images_tmdb_id_type_family ON shows_images(id_tmdb, type, family)")
execSQL("CREATE INDEX index_movies_images_tmdb_id_type ON movies_images(id_tmdb, type)")
}
}
}
private val migration19 = object : Migration(18, 19) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL("ALTER TABLE settings ADD COLUMN my_movies_recent_is_enabled INTEGER NOT NULL DEFAULT 1")
}
}
}
private val migration20 = object : Migration(19, 20) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL(
"CREATE TABLE IF NOT EXISTS `custom_images` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`family` TEXT NOT NULL, " +
"`type` TEXT NOT NULL, " +
"`file_url` TEXT NOT NULL)"
)
execSQL("CREATE INDEX index_custom_images_trakt_id_family_type ON custom_images(id_trakt, family, type)")
}
}
}
private val migration21 = object : Migration(20, 21) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL("ALTER TABLE settings ADD COLUMN quick_rate_enabled INTEGER NOT NULL DEFAULT 0")
}
}
}
private val migration22 = object : Migration(21, 22) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL("ALTER TABLE shows ADD COLUMN created_at INTEGER NOT NULL DEFAULT -1")
val cursor = database.query("SELECT id_trakt, updated_at FROM shows")
while (cursor.moveToNext()) {
val id = cursor.getLong(cursor.getColumnIndexOrThrow("id_trakt"))
val updatedAt = cursor.getLong(cursor.getColumnIndexOrThrow("updated_at"))
execSQL("UPDATE shows SET created_at = $updatedAt WHERE id_trakt == $id")
}
}
}
}
private val migration23 = object : Migration(22, 23) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL(
"CREATE TABLE IF NOT EXISTS `custom_lists` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER, " +
"`id_slug` TEXT NOT NULL, " +
"`name` TEXT NOT NULL, " +
"`description` TEXT, " +
"`privacy` TEXT NOT NULL, " +
"`display_numbers` INTEGER NOT NULL, " +
"`allow_comments` INTEGER NOT NULL, " +
"`sort_by` TEXT NOT NULL, " +
"`sort_how` TEXT NOT NULL, " +
"`sort_by_local` TEXT NOT NULL, " +
"`sort_how_local` TEXT NOT NULL, " +
"`filter_type_local` TEXT NOT NULL, " +
"`item_count` INTEGER NOT NULL, " +
"`comment_count` INTEGER NOT NULL, " +
"`likes` INTEGER NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL" +
")"
)
execSQL("CREATE UNIQUE INDEX index_custom_lists_id_trakt ON custom_lists(id_trakt)")
execSQL("ALTER TABLE settings ADD COLUMN lists_sort_by TEXT NOT NULL DEFAULT 'DATE_UPDATED'")
}
}
}
private val migration24 = object : Migration(23, 24) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL(
"CREATE TABLE IF NOT EXISTS `custom_list_item` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_list` INTEGER NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`type` TEXT NOT NULL, " +
"`rank` INTEGER NOT NULL, " +
"`listed_at` INTEGER NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_list`) REFERENCES `custom_lists`(`id`) ON DELETE CASCADE" +
")"
)
execSQL("CREATE INDEX index_custom_list_item_id_list ON custom_list_item(id_list)")
execSQL("CREATE INDEX index_custom_list_item_id_trakt_type ON custom_list_item(id_trakt, type)")
execSQL("CREATE UNIQUE INDEX index_custom_list_item_id_list_id_trakt_type ON custom_list_item(id_list, id_trakt, type)")
execSQL("ALTER TABLE trakt_sync_queue ADD COLUMN id_list INTEGER")
execSQL("ALTER TABLE trakt_sync_queue ADD COLUMN operation TEXT NOT NULL DEFAULT ''")
}
}
}
private val migration25 = object : Migration(24, 25) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL(
"CREATE TABLE IF NOT EXISTS `news` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_news` TEXT NOT NULL, " +
"`title` TEXT NOT NULL, " +
"`url` TEXT NOT NULL, " +
"`type` TEXT NOT NULL, " +
"`image` TEXT, " +
"`score` INTEGER NOT NULL, " +
"`dated_at` INTEGER NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL " +
")"
)
execSQL("ALTER TABLE user ADD COLUMN reddit_token TEXT NOT NULL DEFAULT ''")
execSQL("ALTER TABLE user ADD COLUMN reddit_token_timestamp INTEGER NOT NULL DEFAULT 0")
}
}
}
private val migration26 = object : Migration(25, 26) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL("ALTER TABLE settings ADD COLUMN progress_upcoming_enabled INTEGER NOT NULL DEFAULT 1")
}
}
}
private val migration27 = object : Migration(26, 27) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL(
"CREATE TABLE IF NOT EXISTS `movies_ratings` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`trakt` TEXT, " +
"`imdb` TEXT, " +
"`metascore` TEXT, " +
"`rotten_tomatoes` TEXT, " +
"`rotten_tomatoes_url` TEXT, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
execSQL("CREATE UNIQUE INDEX index_movies_ratings_id_trakt ON movies_ratings(id_trakt)")
execSQL(
"CREATE TABLE IF NOT EXISTS `shows_ratings` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`trakt` TEXT, " +
"`imdb` TEXT, " +
"`metascore` TEXT, " +
"`rotten_tomatoes` TEXT, " +
"`rotten_tomatoes_url` TEXT, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `shows`(`id_trakt`) ON DELETE CASCADE)"
)
execSQL("CREATE UNIQUE INDEX index_shows_ratings_id_trakt ON shows_ratings(id_trakt)")
}
}
}
private val migration28 = object : Migration(27, 28) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL(
"CREATE TABLE IF NOT EXISTS `movies_streamings` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`id_tmdb` INTEGER NOT NULL, " +
"`type` TEXT, " +
"`provider_id` INTEGER, " +
"`provider_name` TEXT, " +
"`display_priority` INTEGER, " +
"`logo_path` TEXT, " +
"`link` TEXT, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
execSQL("CREATE INDEX index_movies_streamings_id_trakt ON movies_streamings(id_trakt)")
execSQL("CREATE INDEX index_movies_streamings_id_tmdb ON movies_streamings(id_tmdb)")
execSQL(
"CREATE TABLE IF NOT EXISTS `shows_streamings` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`id_tmdb` INTEGER NOT NULL, " +
"`type` TEXT, " +
"`provider_id` INTEGER, " +
"`provider_name` TEXT, " +
"`display_priority` INTEGER, " +
"`logo_path` TEXT, " +
"`link` TEXT, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `shows`(`id_trakt`) ON DELETE CASCADE)"
)
execSQL("CREATE INDEX index_shows_streamings_id_trakt ON shows_streamings(id_trakt)")
execSQL("CREATE INDEX index_shows_streamings_id_tmdb ON shows_streamings(id_tmdb)")
}
}
}
private val migration29 = object : Migration(28, 29) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL("ALTER TABLE movies ADD COLUMN created_at INTEGER NOT NULL DEFAULT -1")
val cursor = database.query("SELECT id_trakt, updated_at FROM movies")
while (cursor.moveToNext()) {
val id = cursor.getLong(cursor.getColumnIndexOrThrow("id_trakt"))
val updatedAt = cursor.getLong(cursor.getColumnIndexOrThrow("updated_at"))
execSQL("UPDATE movies SET created_at = $updatedAt WHERE id_trakt == $id")
}
execSQL(
"CREATE TABLE IF NOT EXISTS `movies_archive` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
execSQL("CREATE UNIQUE INDEX index_movies_archive_id_trakt ON movies_archive(id_trakt)")
}
}
}
private val migration30 = object : Migration(29, 30) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL("DROP TABLE actors")
execSQL(
"CREATE TABLE IF NOT EXISTS `people` (" +
"`id_tmdb` INTEGER PRIMARY KEY NOT NULL, " +
"`id_trakt` INTEGER, " +
"`id_imdb` TEXT, " +
"`name` TEXT NOT NULL, " +
"`department` TEXT NOT NULL, " +
"`biography` TEXT, " +
"`biography_translation` TEXT, " +
"`birthday` TEXT, " +
"`character` TEXT, " +
"`job` TEXT, " +
"`episodes_count` INTEGER, " +
"`birthplace` TEXT, " +
"`deathday` TEXT, " +
"`image_path` TEXT, " +
"`homepage` TEXT, " +
"`created_at` INTEGER NOT NULL, " +
"`details_updated_at` INTEGER, " +
"`updated_at` INTEGER NOT NULL)"
)
execSQL("CREATE INDEX index_people_id_trakt ON people(id_trakt)")
execSQL("CREATE UNIQUE INDEX index_people_id_tmdb ON people(id_tmdb)")
execSQL(
"CREATE TABLE IF NOT EXISTS `people_shows_movies` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_tmdb_person` INTEGER NOT NULL, " +
"`mode` TEXT NOT NULL, " +
"`department` TEXT NOT NULL, " +
"`character` TEXT, " +
"`job` TEXT, " +
"`episodes_count` INTEGER NOT NULL, " +
"`id_trakt_show` INTEGER, " +
"`id_trakt_movie` INTEGER, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_tmdb_person`) REFERENCES `people`(`id_tmdb`) ON DELETE CASCADE)"
)
execSQL("CREATE INDEX index_people_shows_movies_id_show_mode ON people_shows_movies(id_trakt_show, mode)")
execSQL("CREATE INDEX index_people_shows_movies_id_movie_mode ON people_shows_movies(id_trakt_movie, mode)")
execSQL(
"CREATE TABLE IF NOT EXISTS `people_credits` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt_person` INTEGER NOT NULL, " +
"`id_trakt_show` INTEGER, " +
"`id_trakt_movie` INTEGER, " +
"`type` TEXT NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt_show`) REFERENCES `shows`(`id_trakt`) ON DELETE CASCADE, " +
"FOREIGN KEY(`id_trakt_movie`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
execSQL("CREATE INDEX index_people_credits_id_person ON people_credits(id_trakt_person)")
execSQL(
"CREATE TABLE IF NOT EXISTS `people_images` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_tmdb` INTEGER NOT NULL, " +
"`file_path` TEXT NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL)"
)
execSQL("CREATE INDEX index_people_images_id_person ON people_images(id_tmdb)")
}
}
}
private val migration31 = object : Migration(30, 31) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL(
"CREATE TABLE IF NOT EXISTS `ratings` (" +
"`id_trakt` INTEGER NOT NULL, " +
"`type` TEXT NOT NULL, " +
"`rating` INTEGER NOT NULL, " +
"`season_number` INTEGER, " +
"`episode_number` INTEGER, " +
"`rated_at` INTEGER NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"PRIMARY KEY (id_trakt, type))"
)
execSQL("CREATE INDEX index_ratings_id_trakt_type ON ratings(id_trakt, type)")
execSQL("ALTER TABLE seasons ADD COLUMN rating REAL")
execSQL("CREATE INDEX index_people_credits_show ON people_credits(id_trakt_show)")
execSQL("CREATE INDEX index_people_credits_movies ON people_credits(id_trakt_movie)")
execSQL("CREATE INDEX index_people_shows_movies_tmdb_person ON people_shows_movies(id_tmdb_person)")
}
}
}
private val migration32 = object : Migration(31, 32) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE episodes ADD COLUMN episode_number_abs INTEGER")
}
}
private val migration33 = object : Migration(32, 33) {
override fun migrate(database: SupportSQLiteDatabase) {
val preferences = context.applicationContext.getSharedPreferences("PREFERENCES_NETWORK", MODE_PRIVATE)
val preferencesEditor = preferences.edit()
val cursor = database.query("SELECT trakt_token, trakt_refresh_token FROM user")
while (cursor.moveToNext()) {
val accessToken = cursor.getString(cursor.getColumnIndexOrThrow("trakt_token"))
val refreshToken = cursor.getString(cursor.getColumnIndexOrThrow("trakt_refresh_token"))
accessToken?.let { preferencesEditor.putString("TRAKT_ACCESS_TOKEN", it) }
refreshToken?.let { preferencesEditor.putString("TRAKT_REFRESH_TOKEN", it) }
}
preferencesEditor.apply()
}
}
private val migration34 = object : Migration(33, 34) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL("ALTER TABLE episodes ADD COLUMN last_watched_at INTEGER")
execSQL("ALTER TABLE shows_my_shows ADD COLUMN last_watched_at INTEGER")
val cursor = database.query("SELECT id_trakt, updated_at FROM shows_my_shows")
while (cursor.moveToNext()) {
val idShow = cursor.getLong(cursor.getColumnIndexOrThrow("id_trakt"))
val updatedAt = cursor.getLong(cursor.getColumnIndexOrThrow("updated_at"))
val epCursor = database.query(
"SELECT season_number, episode_number FROM episodes WHERE id_show_trakt == $idShow AND is_watched == 1 " +
"ORDER BY season_number DESC, episode_number DESC LIMIT 1"
)
while (epCursor.moveToNext()) {
val episodeNumber = epCursor.getLong(epCursor.getColumnIndexOrThrow("episode_number"))
val seasonNumber = epCursor.getLong(epCursor.getColumnIndexOrThrow("season_number"))
if (updatedAt > 0 && episodeNumber > 0 && seasonNumber > 0) {
execSQL(
"UPDATE episodes SET last_watched_at = $updatedAt " +
"WHERE id_show_trakt == $idShow " +
"AND is_watched == 1 " +
"AND episode_number == $episodeNumber AND season_number == $seasonNumber"
)
execSQL("UPDATE shows_my_shows SET last_watched_at = $updatedAt WHERE id_trakt == $idShow")
}
}
}
}
}
}
private val migration35 = object : Migration(34, 35) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE settings ADD COLUMN discover_filter_networks TEXT NOT NULL DEFAULT ''")
}
}
private val migration36 = object : Migration(35, 36) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
execSQL(
"CREATE TABLE IF NOT EXISTS `movies_collections` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`id_trakt_movie` INTEGER NOT NULL, " +
"`name` TEXT NOT NULL, " +
"`description` TEXT NOT NULL, " +
"`item_count` INTEGER NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt_movie`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
execSQL("CREATE INDEX index_movies_collections_id_trakt ON movies_collections(id_trakt)")
execSQL("CREATE INDEX index_movies_collections_id_trakt_movie ON movies_collections(id_trakt_movie)")
execSQL(
"CREATE TABLE IF NOT EXISTS `movies_collections_items` (" +
"`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, " +
"`id_trakt` INTEGER NOT NULL, " +
"`id_trakt_collection` INTEGER NOT NULL, " +
"`rank` INTEGER NOT NULL, " +
"`created_at` INTEGER NOT NULL, " +
"`updated_at` INTEGER NOT NULL, " +
"FOREIGN KEY(`id_trakt`) REFERENCES `movies`(`id_trakt`) ON DELETE CASCADE)"
)
execSQL("CREATE INDEX index_movies_collections_items_id_trakt ON movies_collections_items(id_trakt)")
execSQL("CREATE INDEX index_movies_collections_items_id_trakt_collection ON movies_collections_items(id_trakt_collection)")
}
}
}
private val migration37 = object : Migration(36, 37) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
val cursor = database.query("SELECT my_shows_recent_is_enabled, my_movies_recent_is_enabled FROM settings")
while (cursor.moveToNext()) {
val myShowsRecentsEnabled = cursor.getInt(cursor.getColumnIndexOrThrow("my_shows_recent_is_enabled"))
val myMoviesRecentsEnabled = cursor.getInt(cursor.getColumnIndexOrThrow("my_movies_recent_is_enabled"))
if (myShowsRecentsEnabled != 1 && myMoviesRecentsEnabled != 1) {
execSQL("UPDATE settings SET my_shows_recent_amount = 0")
}
}
}
}
}
private val migration38 = object : Migration(37, 38) {
override fun migrate(database: SupportSQLiteDatabase) {
with(database) {
val cursor = database.query("SELECT progress_upcoming_enabled FROM settings")
while (cursor.moveToNext()) {
val isEnabled = cursor.getInt(cursor.getColumnIndexOrThrow("progress_upcoming_enabled"))
if (isEnabled != 1) {
val preferences = context.applicationContext.getSharedPreferences("PREFERENCES_MISC", MODE_PRIVATE)
preferences.edit().apply {
putLong("PROGRESS_UPCOMING_DAYS", 0)
apply()
}
}
}
}
}
}
fun getAll() = listOf(
migration2,
migration3,
migration4,
migration5,
migration6,
migration7,
migration8,
migration9,
migration10,
migration11,
migration12,
migration13,
migration14,
migration15,
migration16,
migration17,
migration18,
migration19,
migration20,
migration21,
migration22,
migration23,
migration24,
migration25,
migration26,
migration27,
migration28,
migration29,
migration30,
migration31,
migration32,
migration33,
migration34,
migration35,
migration36,
migration37,
migration38
)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/ArchiveMovie.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "movies_archive",
indices = [Index(value = ["id_trakt"], unique = true)],
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class ArchiveMovie(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long
) {
companion object {
fun fromTraktId(traktId: Long, createdAt: Long) =
ArchiveMovie(
idTrakt = traktId,
createdAt = createdAt,
updatedAt = createdAt
)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/ArchiveShow.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "shows_archive",
indices = [Index(value = ["id_trakt"], unique = true)],
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class ArchiveShow(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long
) {
companion object {
fun fromTraktId(traktId: Long, createdAt: Long) =
ArchiveShow(
idTrakt = traktId,
createdAt = createdAt,
updatedAt = createdAt
)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/CustomImage.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "custom_images",
indices = [
Index(value = ["id_trakt", "family", "type"])
]
)
data class CustomImage(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "family") val family: String,
@ColumnInfo(name = "type") val type: String,
@ColumnInfo(name = "file_url") val fileUrl: String
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/CustomList.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "custom_lists",
indices = [
Index(value = ["id_trakt"], unique = true)
]
)
data class CustomList(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long?,
@ColumnInfo(name = "id_slug") val idSlug: String,
@ColumnInfo(name = "name") val name: String,
@ColumnInfo(name = "description") val description: String?,
@ColumnInfo(name = "privacy") val privacy: String,
@ColumnInfo(name = "display_numbers") val displayNumbers: Boolean,
@ColumnInfo(name = "allow_comments") val allowComments: Boolean,
@ColumnInfo(name = "sort_by") val sortBy: String,
@ColumnInfo(name = "sort_how") val sortHow: String,
@ColumnInfo(name = "sort_by_local") val sortByLocal: String,
@ColumnInfo(name = "sort_how_local") val sortHowLocal: String,
@ColumnInfo(name = "filter_type_local") val filterTypeLocal: String,
@ColumnInfo(name = "item_count") val itemCount: Long,
@ColumnInfo(name = "comment_count") val commentCount: Long,
@ColumnInfo(name = "likes") val likes: Long,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/CustomListItem.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "custom_list_item",
indices = [
Index(value = ["id_list"], unique = false),
Index(value = ["id_trakt", "type"], unique = false),
Index(value = ["id_list", "id_trakt", "type"], unique = true)
],
foreignKeys = [
ForeignKey(
entity = CustomList::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("id_list"),
onDelete = ForeignKey.CASCADE
)
]
)
data class CustomListItem(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_list") val idList: Long,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "type") val type: String,
@ColumnInfo(name = "rank") val rank: Long,
@ColumnInfo(name = "listed_at") val listedAt: Long,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/DiscoverMovie.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
@Entity(
tableName = "movies_discover",
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class DiscoverMovie(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", defaultValue = "-1", index = true) val idTrakt: Long,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/DiscoverShow.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
@Entity(
tableName = "shows_discover",
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class DiscoverShow(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", defaultValue = "-1", index = true) val idTrakt: Long,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/Episode.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.ForeignKey.Companion.CASCADE
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "episodes",
foreignKeys = [
ForeignKey(
entity = Season::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_season"),
onDelete = CASCADE
)
],
indices = [
Index("id_season"),
Index("id_show_trakt")
]
)
@TypeConverters(DateConverter::class)
data class Episode(
@PrimaryKey @ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_season") val idSeason: Long,
@ColumnInfo(name = "id_show_trakt") val idShowTrakt: Long,
@ColumnInfo(name = "id_show_tvdb") val idShowTvdb: Long,
@ColumnInfo(name = "id_show_imdb") val idShowImdb: String,
@ColumnInfo(name = "id_show_tmdb") val idShowTmdb: Long,
@ColumnInfo(name = "season_number") val seasonNumber: Int,
@ColumnInfo(name = "episode_number") val episodeNumber: Int,
@ColumnInfo(name = "episode_number_abs") val episodeNumberAbs: Int?,
@ColumnInfo(name = "episode_overview") val episodeOverview: String,
@ColumnInfo(name = "episode_title") val title: String,
@ColumnInfo(name = "first_aired") val firstAired: ZonedDateTime?,
@ColumnInfo(name = "comments_count") val commentsCount: Int,
@ColumnInfo(name = "rating") val rating: Float,
@ColumnInfo(name = "runtime") val runtime: Int,
@ColumnInfo(name = "votes_count") val votesCount: Int,
@ColumnInfo(name = "is_watched") val isWatched: Boolean,
@ColumnInfo(name = "last_watched_at") val lastWatchedAt: ZonedDateTime?,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/EpisodeTranslation.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "episodes_translations",
indices = [
Index(value = ["id_trakt"], unique = true),
Index(value = ["id_trakt_show"])
],
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt_show"),
onDelete = ForeignKey.CASCADE
)
]
)
data class EpisodeTranslation(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_trakt_show") val idTraktShow: Long,
@ColumnInfo(name = "title") val title: String,
@ColumnInfo(name = "language") val language: String,
@ColumnInfo(name = "overview") val overview: String,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long
) {
companion object {
fun fromTraktId(
traktEpisodeId: Long,
traktShowId: Long,
title: String,
language: String,
overview: String,
createdAt: Long
) =
EpisodeTranslation(
idTrakt = traktEpisodeId,
idTraktShow = traktShowId,
title = title,
language = language,
overview = overview,
createdAt = createdAt,
updatedAt = createdAt
)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/EpisodesSyncLog.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "sync_episodes_log")
data class EpisodesSyncLog(
@PrimaryKey @ColumnInfo(name = "id_show_trakt", defaultValue = "-1") val idTrakt: Long,
@ColumnInfo(name = "synced_at", defaultValue = "0") val syncedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/Movie.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "movies")
data class Movie(
@PrimaryKey @ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_tmdb", defaultValue = "-1") val idTmdb: Long,
@ColumnInfo(name = "id_imdb", defaultValue = "") val idImdb: String,
@ColumnInfo(name = "id_slug", defaultValue = "") val idSlug: String,
@ColumnInfo(name = "title", defaultValue = "") val title: String,
@ColumnInfo(name = "year", defaultValue = "-1") val year: Int,
@ColumnInfo(name = "overview", defaultValue = "") val overview: String,
@ColumnInfo(name = "released", defaultValue = "") val released: String,
@ColumnInfo(name = "runtime", defaultValue = "-1") val runtime: Int,
@ColumnInfo(name = "country", defaultValue = "") val country: String,
@ColumnInfo(name = "trailer", defaultValue = "") val trailer: String,
@ColumnInfo(name = "language", defaultValue = "") val language: String,
@ColumnInfo(name = "homepage", defaultValue = "") val homepage: String,
@ColumnInfo(name = "status", defaultValue = "") val status: String,
@ColumnInfo(name = "rating", defaultValue = "-1") val rating: Float,
@ColumnInfo(name = "votes", defaultValue = "-1") val votes: Long,
@ColumnInfo(name = "comment_count", defaultValue = "-1") val commentCount: Long,
@ColumnInfo(name = "genres", defaultValue = "") val genres: String,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MovieCollection.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "movies_collections",
indices = [
Index(value = ["id_trakt"]),
Index(value = ["id_trakt_movie"]),
],
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt_movie"),
onDelete = ForeignKey.CASCADE
)
]
)
@TypeConverters(DateConverter::class)
data class MovieCollection(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_trakt_movie") val idTraktMovie: Long,
@ColumnInfo(name = "name") val name: String,
@ColumnInfo(name = "description") val description: String,
@ColumnInfo(name = "item_count") val itemCount: Int,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MovieCollectionItem.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "movies_collections_items",
indices = [
Index(value = ["id_trakt"]),
Index(value = ["id_trakt_collection"]),
],
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
@TypeConverters(DateConverter::class)
data class MovieCollectionItem(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_trakt_collection") val idTraktCollection: Long,
@ColumnInfo(name = "rank") val rank: Int,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MovieImage.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "movies_images",
indices = [
Index(value = ["id_tmdb", "type"])
]
)
data class MovieImage(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_tmdb", defaultValue = "-1") val idTmdb: Long,
@ColumnInfo(name = "type", defaultValue = "") val type: String,
@ColumnInfo(name = "file_url", defaultValue = "") val fileUrl: String,
@ColumnInfo(name = "source", defaultValue = "tmdb") val source: String
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MovieRatings.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "movies_ratings",
indices = [Index(value = ["id_trakt"], unique = true)],
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class MovieRatings(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "trakt") val trakt: String?,
@ColumnInfo(name = "imdb") val imdb: String?,
@ColumnInfo(name = "metascore") val metascore: String?,
@ColumnInfo(name = "rotten_tomatoes") val rottenTomatoes: String?,
@ColumnInfo(name = "rotten_tomatoes_url") val rottenTomatoesUrl: String?,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MovieStreaming.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "movies_streamings",
indices = [
Index(value = ["id_trakt"]),
Index(value = ["id_tmdb"]),
],
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
@TypeConverters(DateConverter::class)
data class MovieStreaming(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_tmdb") val idTmdb: Long,
@ColumnInfo(name = "type") val type: String?,
@ColumnInfo(name = "provider_id") val providerId: Long?,
@ColumnInfo(name = "provider_name") val providerName: String?,
@ColumnInfo(name = "display_priority") val displayPriority: Long?,
@ColumnInfo(name = "logo_path") val logoPath: String?,
@ColumnInfo(name = "link") val link: String?,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MovieTranslation.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "movies_translations",
indices = [Index(value = ["id_trakt"], unique = true)],
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class MovieTranslation(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "title") val title: String,
@ColumnInfo(name = "language") val language: String,
@ColumnInfo(name = "overview") val overview: String,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long
) {
companion object {
fun fromTraktId(
traktId: Long,
title: String,
language: String,
overview: String,
createdAt: Long
) =
MovieTranslation(
idTrakt = traktId,
title = title,
language = language,
overview = overview,
createdAt = createdAt,
updatedAt = createdAt
)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MoviesSyncLog.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "sync_movies_log")
data class MoviesSyncLog(
@PrimaryKey @ColumnInfo(name = "id_movie_trakt", defaultValue = "-1") val idTrakt: Long,
@ColumnInfo(name = "synced_at", defaultValue = "0") val syncedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MyMovie.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
@Entity(
tableName = "movies_my_movies",
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class MyMovie(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", defaultValue = "-1", index = true) val idTrakt: Long,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
) {
companion object {
fun fromTraktId(traktId: Long, timestamp: Long) =
MyMovie(
idTrakt = traktId,
createdAt = timestamp,
updatedAt = timestamp
)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/MyShow.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
@Entity(
tableName = "shows_my_shows",
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class MyShow(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", defaultValue = "-1", index = true) val idTrakt: Long,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long,
@ColumnInfo(name = "last_watched_at") val lastWatchedAt: Long?
) {
companion object {
fun fromTraktId(
traktId: Long,
createdAt: Long,
updatedAt: Long,
watchedAt: Long
) = MyShow(
idTrakt = traktId,
createdAt = createdAt,
updatedAt = updatedAt,
lastWatchedAt = watchedAt
)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/News.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(
tableName = "news"
)
data class News(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_news") val idNews: String,
@ColumnInfo(name = "title") val title: String,
@ColumnInfo(name = "url") val url: String,
@ColumnInfo(name = "type") val type: String,
@ColumnInfo(name = "image") val image: String?,
@ColumnInfo(name = "score") val score: Long,
@ColumnInfo(name = "dated_at") val datedAt: Long,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/Person.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "people",
indices = [
Index(value = ["id_trakt"]),
Index(value = ["id_tmdb"], unique = true),
]
)
@TypeConverters(DateConverter::class)
data class Person(
@PrimaryKey @ColumnInfo(name = "id_tmdb") val idTmdb: Long,
@ColumnInfo(name = "id_trakt") val idTrakt: Long?,
@ColumnInfo(name = "id_imdb") val idImdb: String?,
@ColumnInfo(name = "name") val name: String,
@ColumnInfo(name = "department") val department: String,
@ColumnInfo(name = "biography") val biography: String?,
@ColumnInfo(name = "biography_translation") val biographyTranslation: String?,
@ColumnInfo(name = "birthday") val birthday: String?,
@ColumnInfo(name = "birthplace") val birthplace: String?,
@ColumnInfo(name = "character") val character: String?,
@ColumnInfo(name = "episodes_count") val episodesCount: Int?,
@ColumnInfo(name = "job") val job: String?,
@ColumnInfo(name = "deathday") val deathday: String?,
@ColumnInfo(name = "image_path") val image: String?,
@ColumnInfo(name = "homepage") val homepage: String?,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime,
@ColumnInfo(name = "details_updated_at") val detailsUpdatedAt: ZonedDateTime?,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/PersonCredits.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "people_credits",
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt_show"),
onDelete = ForeignKey.CASCADE
),
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt_movie"),
onDelete = ForeignKey.CASCADE
)
],
indices = [
Index(value = ["id_trakt_person"]),
Index(value = ["id_trakt_show"]),
Index(value = ["id_trakt_movie"]),
]
)
@TypeConverters(DateConverter::class)
data class PersonCredits(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long,
@ColumnInfo(name = "id_trakt_person") val idTraktPerson: Long,
@ColumnInfo(name = "id_trakt_show") val idTraktShow: Long?,
@ColumnInfo(name = "id_trakt_movie") val idTraktMovie: Long?,
@ColumnInfo(name = "type") val type: String,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/PersonImage.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "people_images",
indices = [
Index(value = ["id_tmdb"])
]
)
@TypeConverters(DateConverter::class)
data class PersonImage(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_tmdb") val idTmdb: Long,
@ColumnInfo(name = "file_path") val filePath: String,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/PersonShowMovie.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "people_shows_movies",
foreignKeys = [
ForeignKey(
entity = Person::class,
parentColumns = arrayOf("id_tmdb"),
childColumns = arrayOf("id_tmdb_person"),
onDelete = ForeignKey.CASCADE
)
],
indices = [
Index(value = ["id_tmdb_person"]),
Index(value = ["id_trakt_show", "mode"]),
Index(value = ["id_trakt_movie", "mode"])
]
)
@TypeConverters(DateConverter::class)
data class PersonShowMovie(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long,
@ColumnInfo(name = "id_tmdb_person") val idTmdbPerson: Long,
@ColumnInfo(name = "mode") val mode: String,
@ColumnInfo(name = "department") val department: String,
@ColumnInfo(name = "character") val character: String?,
@ColumnInfo(name = "job") val job: String?,
@ColumnInfo(name = "episodes_count") val episodesCount: Int,
@ColumnInfo(name = "id_trakt_show") val idTraktShow: Long?,
@ColumnInfo(name = "id_trakt_movie") val idTraktMovie: Long?,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/Rating.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "ratings",
primaryKeys = ["id_trakt", "type"],
indices = [
Index(value = ["id_trakt", "type"], unique = false),
]
)
@TypeConverters(DateConverter::class)
data class Rating(
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "type") val type: String,
@ColumnInfo(name = "rating") val rating: Int,
@ColumnInfo(name = "season_number") val seasonNumber: Int?,
@ColumnInfo(name = "episode_number") val episodeNumber: Int?,
@ColumnInfo(name = "rated_at") val ratedAt: ZonedDateTime,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/RecentSearch.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "recent_searches")
data class RecentSearch(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long,
@ColumnInfo(name = "text", defaultValue = "") val text: String,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/RelatedMovie.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.ForeignKey.Companion.CASCADE
import androidx.room.PrimaryKey
@Entity(
tableName = "movies_related",
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt_related_movie"),
onDelete = CASCADE
)
]
)
data class RelatedMovie(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", defaultValue = "-1") val idTrakt: Long,
@ColumnInfo(name = "id_trakt_related_movie", defaultValue = "-1", index = true) val idTraktRelatedMovie: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
) {
companion object {
fun fromTraktId(traktId: Long, relatedTraktId: Long, nowUtcMillis: Long) =
RelatedMovie(
idTrakt = traktId,
idTraktRelatedMovie = relatedTraktId,
updatedAt = nowUtcMillis
)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/RelatedShow.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.ForeignKey.Companion.CASCADE
import androidx.room.PrimaryKey
@Entity(
tableName = "shows_related",
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt_related_show"),
onDelete = CASCADE
)
]
)
data class RelatedShow(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", defaultValue = "-1") val idTrakt: Long,
@ColumnInfo(name = "id_trakt_related_show", defaultValue = "-1", index = true) val idTraktRelatedShow: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
) {
companion object {
fun fromTraktId(traktId: Long, relatedShowTraktId: Long, nowUtcMillis: Long): RelatedShow {
return RelatedShow(
idTrakt = traktId,
idTraktRelatedShow = relatedShowTraktId,
updatedAt = nowUtcMillis
)
}
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/Season.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "seasons",
indices = [Index("id_show_trakt")]
)
@TypeConverters(DateConverter::class)
data class Season(
@PrimaryKey @ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_show_trakt") val idShowTrakt: Long,
@ColumnInfo(name = "season_number") val seasonNumber: Int,
@ColumnInfo(name = "season_title") val seasonTitle: String,
@ColumnInfo(name = "season_overview") val seasonOverview: String,
@ColumnInfo(name = "season_first_aired") val seasonFirstAired: ZonedDateTime?,
@ColumnInfo(name = "episodes_count") val episodesCount: Int,
@ColumnInfo(name = "episodes_aired_count") val episodesAiredCount: Int,
@ColumnInfo(name = "rating") val rating: Float?,
@ColumnInfo(name = "is_watched") val isWatched: Boolean
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/Settings.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "settings")
data class Settings(
@PrimaryKey @ColumnInfo(name = "id") val id: Long = 1,
@ColumnInfo(name = "is_initial_run", defaultValue = "0") val isInitialRun: Boolean,
@ColumnInfo(name = "push_notifications_enabled", defaultValue = "1") val pushNotificationsEnabled: Boolean, // Removed
@ColumnInfo(name = "episodes_notifications_enabled", defaultValue = "1") val episodesNotificationsEnabled: Boolean,
@ColumnInfo(name = "episodes_notifications_delay", defaultValue = "0") val episodesNotificationsDelay: Long,
@ColumnInfo(name = "my_shows_recent_amount", defaultValue = "6") val myShowsRecentsAmount: Int,
@ColumnInfo(name = "my_shows_running_sort_by", defaultValue = "NAME") val myShowsRunningSortBy: String,
@ColumnInfo(name = "my_shows_incoming_sort_by", defaultValue = "NAME") val myShowsIncomingSortBy: String,
@ColumnInfo(name = "my_shows_ended_sort_by", defaultValue = "NAME") val myShowsEndedSortBy: String,
@ColumnInfo(name = "my_shows_all_sort_by", defaultValue = "NAME") val myShowsAllSortBy: String,
@ColumnInfo(name = "my_shows_running_is_collapsed", defaultValue = "0") val myShowsRunningIsCollapsed: Boolean,
@ColumnInfo(name = "my_shows_incoming_is_collapsed", defaultValue = "0") val myShowsIncomingIsCollapsed: Boolean,
@ColumnInfo(name = "my_shows_ended_is_collapsed", defaultValue = "0") val myShowsEndedIsCollapsed: Boolean,
@ColumnInfo(name = "my_shows_running_is_enabled", defaultValue = "1") val myShowsRunningIsEnabled: Boolean,
@ColumnInfo(name = "my_shows_incoming_is_enabled", defaultValue = "1") val myShowsIncomingIsEnabled: Boolean,
@ColumnInfo(name = "my_shows_ended_is_enabled", defaultValue = "1") val myShowsEndedIsEnabled: Boolean,
@ColumnInfo(name = "my_shows_recent_is_enabled", defaultValue = "1") val myShowsRecentIsEnabled: Boolean,
@ColumnInfo(name = "see_later_shows_sort_by", defaultValue = "NAME") val seeLaterShowsSortBy: String,
@ColumnInfo(name = "show_anticipated_shows", defaultValue = "1") val showAnticipatedShows: Boolean,
@ColumnInfo(name = "discover_filter_genres", defaultValue = "") val discoverFilterGenres: String,
@ColumnInfo(name = "discover_filter_networks", defaultValue = "") val discoverFilterNetworks: String,
@ColumnInfo(name = "discover_filter_feed", defaultValue = "HOT") val discoverFilterFeed: String,
@ColumnInfo(name = "trakt_sync_schedule", defaultValue = "OFF") val traktSyncSchedule: String,
@ColumnInfo(name = "trakt_quick_sync_enabled", defaultValue = "0") val traktQuickSyncEnabled: Boolean,
@ColumnInfo(name = "trakt_quick_remove_enabled", defaultValue = "0") val traktQuickRemoveEnabled: Boolean,
@ColumnInfo(name = "watchlist_sort_by", defaultValue = "NAME") val watchlistSortBy: String,
@ColumnInfo(name = "archive_shows_sort_by", defaultValue = "NAME") val archiveShowsSortBy: String,
@ColumnInfo(name = "archive_shows_include_statistics", defaultValue = "1") val archiveShowsIncludeStatistics: Boolean,
@ColumnInfo(name = "special_seasons_enabled", defaultValue = "0") val specialSeasonsEnabled: Boolean,
@ColumnInfo(name = "show_anticipated_movies", defaultValue = "0") val showAnticipatedMovies: Boolean,
@ColumnInfo(name = "discover_movies_filter_genres", defaultValue = "") val discoverMoviesFilterGenres: String,
@ColumnInfo(name = "discover_movies_filter_feed", defaultValue = "HOT") val discoverMoviesFilterFeed: String,
@ColumnInfo(name = "my_movies_all_sort_by", defaultValue = "NAME") val myMoviesAllSortBy: String,
@ColumnInfo(name = "see_later_movies_sort_by", defaultValue = "NAME") val seeLaterMoviesSortBy: String,
@ColumnInfo(name = "progress_movies_sort_by", defaultValue = "NAME") val progressMoviesSortBy: String,
@ColumnInfo(name = "show_collection_shows", defaultValue = "1") val showCollectionShows: Boolean,
@ColumnInfo(name = "show_collection_movies", defaultValue = "1") val showCollectionMovies: Boolean,
@ColumnInfo(name = "widgets_show_label", defaultValue = "1") val widgetsShowLabel: Boolean,
@ColumnInfo(name = "my_movies_recent_is_enabled", defaultValue = "1") val myMoviesRecentIsEnabled: Boolean,
@ColumnInfo(name = "quick_rate_enabled", defaultValue = "0") val quickRateEnabled: Boolean,
@ColumnInfo(name = "lists_sort_by", defaultValue = "DATE_UPDATED") val listsSortBy: String,
@ColumnInfo(name = "progress_upcoming_enabled", defaultValue = "1") val progressUpcomingEnabled: Boolean,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/Show.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "shows")
data class Show(
@PrimaryKey @ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_tvdb", defaultValue = "-1") val idTvdb: Long,
@ColumnInfo(name = "id_tmdb", defaultValue = "-1") val idTmdb: Long,
@ColumnInfo(name = "id_imdb", defaultValue = "") val idImdb: String,
@ColumnInfo(name = "id_slug", defaultValue = "") val idSlug: String,
@ColumnInfo(name = "id_tvrage", defaultValue = "-1") val idTvrage: Long,
@ColumnInfo(name = "title", defaultValue = "") val title: String,
@ColumnInfo(name = "year", defaultValue = "-1") val year: Int,
@ColumnInfo(name = "overview", defaultValue = "") val overview: String,
@ColumnInfo(name = "first_aired", defaultValue = "") val firstAired: String,
@ColumnInfo(name = "runtime", defaultValue = "-1") val runtime: Int,
@ColumnInfo(name = "airtime_day", defaultValue = "") val airtimeDay: String,
@ColumnInfo(name = "airtime_time", defaultValue = "") val airtimeTime: String,
@ColumnInfo(name = "airtime_timezone", defaultValue = "") val airtimeTimezone: String,
@ColumnInfo(name = "certification", defaultValue = "") val certification: String,
@ColumnInfo(name = "network", defaultValue = "") val network: String,
@ColumnInfo(name = "country", defaultValue = "") val country: String,
@ColumnInfo(name = "trailer", defaultValue = "") val trailer: String,
@ColumnInfo(name = "homepage", defaultValue = "") val homepage: String,
@ColumnInfo(name = "status", defaultValue = "") val status: String,
@ColumnInfo(name = "rating", defaultValue = "-1") val rating: Float,
@ColumnInfo(name = "votes", defaultValue = "-1") val votes: Long,
@ColumnInfo(name = "comment_count", defaultValue = "-1") val commentCount: Long,
@ColumnInfo(name = "genres", defaultValue = "") val genres: String,
@ColumnInfo(name = "aired_episodes", defaultValue = "-1") val airedEpisodes: Int,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/ShowImage.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "shows_images",
indices = [
Index(value = ["id_tmdb", "type", "family"])
]
)
data class ShowImage(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_tvdb", defaultValue = "-1") val idTvdb: Long,
@ColumnInfo(name = "id_tmdb", defaultValue = "-1") val idTmdb: Long,
@ColumnInfo(name = "type", defaultValue = "") val type: String,
@ColumnInfo(name = "family", defaultValue = "") val family: String,
@ColumnInfo(name = "file_url", defaultValue = "") val fileUrl: String,
@ColumnInfo(name = "thumbnail_url", defaultValue = "") val thumbnailUrl: String,
@ColumnInfo(name = "source", defaultValue = "tvdb") val source: String
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/ShowRatings.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "shows_ratings",
indices = [Index(value = ["id_trakt"], unique = true)],
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class ShowRatings(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "trakt") val trakt: String?,
@ColumnInfo(name = "imdb") val imdb: String?,
@ColumnInfo(name = "metascore") val metascore: String?,
@ColumnInfo(name = "rotten_tomatoes") val rottenTomatoes: String?,
@ColumnInfo(name = "rotten_tomatoes_url") val rottenTomatoesUrl: String?,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/ShowStreaming.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.michaldrabik.data_local.database.converters.DateConverter
import java.time.ZonedDateTime
@Entity(
tableName = "shows_streamings",
indices = [
Index(value = ["id_trakt"]),
Index(value = ["id_tmdb"]),
],
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
@TypeConverters(DateConverter::class)
data class ShowStreaming(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_tmdb") val idTmdb: Long,
@ColumnInfo(name = "type") val type: String?,
@ColumnInfo(name = "provider_id") val providerId: Long?,
@ColumnInfo(name = "provider_name") val providerName: String?,
@ColumnInfo(name = "display_priority") val displayPriority: Long?,
@ColumnInfo(name = "logo_path") val logoPath: String?,
@ColumnInfo(name = "link") val link: String?,
@ColumnInfo(name = "created_at") val createdAt: ZonedDateTime,
@ColumnInfo(name = "updated_at") val updatedAt: ZonedDateTime,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/ShowTranslation.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "shows_translations",
indices = [Index(value = ["id_trakt"], unique = true)],
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class ShowTranslation(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "title") val title: String,
@ColumnInfo(name = "language") val language: String,
@ColumnInfo(name = "overview") val overview: String,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long
) {
companion object {
fun fromTraktId(
traktId: Long,
title: String,
language: String,
overview: String,
createdAt: Long
) =
ShowTranslation(
idTrakt = traktId,
title = title,
language = language,
overview = overview,
createdAt = createdAt,
updatedAt = createdAt
)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/TraktSyncLog.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
@Entity(
tableName = "sync_trakt_log",
indices = [
Index(value = ["id_trakt", "type"], unique = true)
]
)
data class TraktSyncLog(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", index = true) val idTrakt: Long,
@ColumnInfo(name = "type", index = true) val type: String,
@ColumnInfo(name = "synced_at") val syncedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/TraktSyncQueue.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "trakt_sync_queue")
data class TraktSyncQueue(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long,
@ColumnInfo(name = "id_trakt") val idTrakt: Long,
@ColumnInfo(name = "id_list") val idList: Long?,
@ColumnInfo(name = "type") val type: String,
@ColumnInfo(name = "operation") val operation: String,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "updated_at") val updatedAt: Long
) {
companion object {
fun createEpisode(
episodeTraktId: Long,
showTraktId: Long?,
createdAt: Long,
updatedAt: Long,
clearProgress: Boolean
): TraktSyncQueue {
val operation = if (clearProgress) Operation.ADD_WITH_CLEAR else Operation.ADD
return TraktSyncQueue(0, episodeTraktId, showTraktId, Type.EPISODE.slug, operation.slug, createdAt, updatedAt)
}
fun createShowWatchlist(
idTrakt: Long,
createdAt: Long,
updatedAt: Long
) = TraktSyncQueue(0, idTrakt, null, Type.SHOW_WATCHLIST.slug, Operation.ADD.slug, createdAt, updatedAt)
fun createMovie(
idTrakt: Long,
createdAt: Long,
updatedAt: Long
) = TraktSyncQueue(0, idTrakt, null, Type.MOVIE.slug, Operation.ADD.slug, createdAt, updatedAt)
fun createMovieWatchlist(
idTrakt: Long,
createdAt: Long,
updatedAt: Long
) = TraktSyncQueue(0, idTrakt, null, Type.MOVIE_WATCHLIST.slug, Operation.ADD.slug, createdAt, updatedAt)
fun createListShow(
idTrakt: Long,
idList: Long,
operation: Operation,
createdAt: Long,
updatedAt: Long
) = TraktSyncQueue(0, idTrakt, idList, Type.LIST_ITEM_SHOW.slug, operation.slug, createdAt, updatedAt)
fun createListMovie(
idTrakt: Long,
idList: Long,
operation: Operation,
createdAt: Long,
updatedAt: Long
) = TraktSyncQueue(0, idTrakt, idList, Type.LIST_ITEM_MOVIE.slug, operation.slug, createdAt, updatedAt)
fun createHiddenShow(
idTrakt: Long,
operation: Operation,
createdAt: Long,
updatedAt: Long
) = TraktSyncQueue(0, idTrakt, null, Type.HIDDEN_SHOW.slug, operation.slug, createdAt, updatedAt)
fun createHiddenMovie(
idTrakt: Long,
operation: Operation,
createdAt: Long,
updatedAt: Long
) = TraktSyncQueue(0, idTrakt, null, Type.HIDDEN_MOVIE.slug, operation.slug, createdAt, updatedAt)
}
enum class Type(val slug: String) {
EPISODE("episode"),
SHOW_WATCHLIST("show_watchlist"),
MOVIE("movie"),
MOVIE_WATCHLIST("movie_watchlist"),
LIST_ITEM_SHOW("list_item_show"),
LIST_ITEM_MOVIE("list_item_movie"),
HIDDEN_SHOW("hidden_show"),
HIDDEN_MOVIE("hidden_movie")
}
enum class Operation(val slug: String) {
ADD("add"),
ADD_WITH_CLEAR("add_clear"),
REMOVE("remove")
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/TranslationsMoviesSyncLog.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "sync_movies_translations_log")
data class TranslationsMoviesSyncLog(
@PrimaryKey @ColumnInfo(name = "id_movie_trakt") val idTrakt: Long,
@ColumnInfo(name = "synced_at") val syncedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/TranslationsSyncLog.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "sync_translations_log")
data class TranslationsSyncLog(
@PrimaryKey @ColumnInfo(name = "id_show_trakt") val idTrakt: Long,
@ColumnInfo(name = "synced_at") val syncedAt: Long
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/User.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "user")
data class User(
@PrimaryKey @ColumnInfo(name = "id") val id: Long = 1,
@ColumnInfo(name = "tvdb_token", defaultValue = "") val tvdbToken: String,
@ColumnInfo(name = "tvdb_token_timestamp", defaultValue = "0") val tvdbTokenTimestamp: Long,
@ColumnInfo(name = "trakt_token", defaultValue = "") val traktToken: String,
@ColumnInfo(name = "trakt_refresh_token", defaultValue = "") val traktRefreshToken: String,
@ColumnInfo(name = "trakt_token_timestamp", defaultValue = "0") val traktTokenTimestamp: Long,
@ColumnInfo(name = "trakt_username", defaultValue = "") val traktUsername: String,
@ColumnInfo(name = "reddit_token", defaultValue = "") val redditToken: String,
@ColumnInfo(name = "reddit_token_timestamp", defaultValue = "0") val redditTokenTimestamp: Long,
)
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/WatchlistMovie.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
@Entity(
tableName = "movies_see_later",
foreignKeys = [
ForeignKey(
entity = Movie::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class WatchlistMovie(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", defaultValue = "-1", index = true) val idTrakt: Long,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
) {
companion object {
fun fromTraktId(traktId: Long, nowUtcMillis: Long) =
WatchlistMovie(idTrakt = traktId, createdAt = nowUtcMillis, updatedAt = nowUtcMillis)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/database/model/WatchlistShow.kt
================================================
package com.michaldrabik.data_local.database.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
@Entity(
tableName = "shows_see_later",
foreignKeys = [
ForeignKey(
entity = Show::class,
parentColumns = arrayOf("id_trakt"),
childColumns = arrayOf("id_trakt"),
onDelete = ForeignKey.CASCADE
)
]
)
data class WatchlistShow(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Long = 0,
@ColumnInfo(name = "id_trakt", defaultValue = "-1", index = true) val idTrakt: Long,
@ColumnInfo(name = "created_at", defaultValue = "-1") val createdAt: Long,
@ColumnInfo(name = "updated_at", defaultValue = "-1") val updatedAt: Long
) {
companion object {
fun fromTraktId(traktId: Long, nowUtcMillis: Long) =
WatchlistShow(idTrakt = traktId, createdAt = nowUtcMillis, updatedAt = nowUtcMillis)
}
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/di/LocalDataModule.kt
================================================
package com.michaldrabik.data_local.di
import com.michaldrabik.data_local.LocalDataSource
import com.michaldrabik.data_local.MainLocalDataSource
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
abstract class LocalDataModule {
@Binds
@Singleton
internal abstract fun providesLocalDataSource(source: MainLocalDataSource): LocalDataSource
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/di/SourcesModule.kt
================================================
package com.michaldrabik.data_local.di
import com.michaldrabik.data_local.database.AppDatabase
import com.michaldrabik.data_local.sources.ArchiveMoviesLocalDataSource
import com.michaldrabik.data_local.sources.ArchiveShowsLocalDataSource
import com.michaldrabik.data_local.sources.CustomImagesLocalDataSource
import com.michaldrabik.data_local.sources.CustomListsItemsLocalDataSource
import com.michaldrabik.data_local.sources.CustomListsLocalDataSource
import com.michaldrabik.data_local.sources.DiscoverMoviesLocalDataSource
import com.michaldrabik.data_local.sources.DiscoverShowsLocalDataSource
import com.michaldrabik.data_local.sources.EpisodeTranslationsLocalDataSource
import com.michaldrabik.data_local.sources.EpisodesLocalDataSource
import com.michaldrabik.data_local.sources.EpisodesSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.MovieCollectionsItemsLocalDataSource
import com.michaldrabik.data_local.sources.MovieCollectionsLocalDataSource
import com.michaldrabik.data_local.sources.MovieImagesLocalDataSource
import com.michaldrabik.data_local.sources.MovieRatingsLocalDataSource
import com.michaldrabik.data_local.sources.MovieStreamingsLocalDataSource
import com.michaldrabik.data_local.sources.MovieTranslationsLocalDataSource
import com.michaldrabik.data_local.sources.MoviesLocalDataSource
import com.michaldrabik.data_local.sources.MoviesSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.MyMoviesLocalDataSource
import com.michaldrabik.data_local.sources.MyShowsLocalDataSource
import com.michaldrabik.data_local.sources.NewsLocalDataSource
import com.michaldrabik.data_local.sources.PeopleCreditsLocalDataSource
import com.michaldrabik.data_local.sources.PeopleImagesLocalDataSource
import com.michaldrabik.data_local.sources.PeopleLocalDataSource
import com.michaldrabik.data_local.sources.PeopleShowsMoviesLocalDataSource
import com.michaldrabik.data_local.sources.RatingsLocalDataSource
import com.michaldrabik.data_local.sources.RecentSearchLocalDataSource
import com.michaldrabik.data_local.sources.RelatedMoviesLocalDataSource
import com.michaldrabik.data_local.sources.RelatedShowsLocalDataSource
import com.michaldrabik.data_local.sources.SeasonsLocalDataSource
import com.michaldrabik.data_local.sources.SettingsLocalDataSource
import com.michaldrabik.data_local.sources.ShowImagesLocalDataSource
import com.michaldrabik.data_local.sources.ShowRatingsLocalDataSource
import com.michaldrabik.data_local.sources.ShowStreamingsLocalDataSource
import com.michaldrabik.data_local.sources.ShowTranslationsLocalDataSource
import com.michaldrabik.data_local.sources.ShowsLocalDataSource
import com.michaldrabik.data_local.sources.TraktSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.TraktSyncQueueLocalDataSource
import com.michaldrabik.data_local.sources.TranslationsMoviesSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.TranslationsShowsSyncLogLocalDataSource
import com.michaldrabik.data_local.sources.UserLocalDataSource
import com.michaldrabik.data_local.sources.WatchlistMoviesLocalDataSource
import com.michaldrabik.data_local.sources.WatchlistShowsLocalDataSource
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
class SourcesModule {
@Provides
@Singleton
internal fun providesShows(database: AppDatabase): ShowsLocalDataSource =
database.showsDao()
@Provides
@Singleton
internal fun providesMovies(database: AppDatabase): MoviesLocalDataSource =
database.moviesDao()
@Provides
@Singleton
internal fun providesArchivesShows(database: AppDatabase): ArchiveShowsLocalDataSource =
database.archiveShowsDao()
@Provides
@Singleton
internal fun providesArchivesMovies(database: AppDatabase): ArchiveMoviesLocalDataSource =
database.archiveMoviesDao()
@Provides
@Singleton
internal fun providesCustomListsItems(database: AppDatabase): CustomListsItemsLocalDataSource =
database.customListsItemsDao()
@Provides
@Singleton
internal fun providesCustomImages(database: AppDatabase): CustomImagesLocalDataSource =
database.customImagesDao()
@Provides
@Singleton
internal fun providesCustomLists(database: AppDatabase): CustomListsLocalDataSource =
database.customListsDao()
@Provides
@Singleton
internal fun providesDiscoverShows(database: AppDatabase): DiscoverShowsLocalDataSource =
database.discoverShowsDao()
@Provides
@Singleton
internal fun providesDiscoverMovies(database: AppDatabase): DiscoverMoviesLocalDataSource =
database.discoverMoviesDao()
@Provides
@Singleton
internal fun providesEpisodes(database: AppDatabase): EpisodesLocalDataSource =
database.episodesDao()
@Provides
@Singleton
internal fun providesEpisodesSyncLog(database: AppDatabase): EpisodesSyncLogLocalDataSource =
database.episodesSyncLogDao()
@Provides
@Singleton
internal fun providesEpisodesTranslations(database: AppDatabase): EpisodeTranslationsLocalDataSource =
database.episodeTranslationsDao()
@Provides
@Singleton
internal fun providesMovieImages(database: AppDatabase): MovieImagesLocalDataSource =
database.movieImagesDao()
@Provides
@Singleton
internal fun providesMovieRatings(database: AppDatabase): MovieRatingsLocalDataSource =
database.movieRatingsDao()
@Provides
@Singleton
internal fun providesMovieSyncLog(database: AppDatabase): MoviesSyncLogLocalDataSource =
database.moviesSyncLogDao()
@Provides
@Singleton
internal fun providesMovieStreaming(database: AppDatabase): MovieStreamingsLocalDataSource =
database.movieStreamingsDao()
@Provides
@Singleton
internal fun providesMovieCollections(database: AppDatabase): MovieCollectionsLocalDataSource =
database.movieCollectionsDao()
@Provides
@Singleton
internal fun providesMovieCollectionsItems(database: AppDatabase): MovieCollectionsItemsLocalDataSource =
database.movieCollectionsItemsDao()
@Provides
@Singleton
internal fun providesMovieTranslation(database: AppDatabase): MovieTranslationsLocalDataSource =
database.movieTranslationsDao()
@Provides
@Singleton
internal fun providesMyMovies(database: AppDatabase): MyMoviesLocalDataSource =
database.myMoviesDao()
@Provides
@Singleton
internal fun providesMyShows(database: AppDatabase): MyShowsLocalDataSource =
database.myShowsDao()
@Provides
@Singleton
internal fun providesNews(database: AppDatabase): NewsLocalDataSource =
database.newsDao()
@Provides
@Singleton
internal fun providesPeopleCredits(database: AppDatabase): PeopleCreditsLocalDataSource =
database.peopleCreditsDao()
@Provides
@Singleton
internal fun providesPeople(database: AppDatabase): PeopleLocalDataSource =
database.peopleDao()
@Provides
@Singleton
internal fun providesPeopleImages(database: AppDatabase): PeopleImagesLocalDataSource =
database.peopleImagesDao()
@Provides
@Singleton
internal fun providesPeopleShowsMovies(database: AppDatabase): PeopleShowsMoviesLocalDataSource =
database.peopleShowsMoviesDao()
@Provides
@Singleton
internal fun providesRatings(database: AppDatabase): RatingsLocalDataSource =
database.ratingsDao()
@Provides
@Singleton
internal fun providesRecentSearch(database: AppDatabase): RecentSearchLocalDataSource =
database.recentSearchDao()
@Provides
@Singleton
internal fun providesSeasons(database: AppDatabase): SeasonsLocalDataSource =
database.seasonsDao()
@Provides
@Singleton
internal fun providesSettings(database: AppDatabase): SettingsLocalDataSource =
database.settingsDao()
@Provides
@Singleton
internal fun providesShowImages(database: AppDatabase): ShowImagesLocalDataSource =
database.showImagesDao()
@Provides
@Singleton
internal fun providesShowRatings(database: AppDatabase): ShowRatingsLocalDataSource =
database.showRatingsDao()
@Provides
@Singleton
internal fun providesShowStreamings(database: AppDatabase): ShowStreamingsLocalDataSource =
database.showStreamingsDao()
@Provides
@Singleton
internal fun providesShowTranslations(database: AppDatabase): ShowTranslationsLocalDataSource =
database.showTranslationsDao()
@Provides
@Singleton
internal fun providesTraktSyncLog(database: AppDatabase): TraktSyncLogLocalDataSource =
database.traktSyncLogDao()
@Provides
@Singleton
internal fun providesTraktSyncQueue(database: AppDatabase): TraktSyncQueueLocalDataSource =
database.traktSyncQueueDao()
@Provides
@Singleton
internal fun providesTranslationsMovies(database: AppDatabase): TranslationsMoviesSyncLogLocalDataSource =
database.translationsMoviesSyncLogDao()
@Provides
@Singleton
internal fun providesTranslationsShows(database: AppDatabase): TranslationsShowsSyncLogLocalDataSource =
database.translationsSyncLogDao()
@Provides
@Singleton
internal fun providesUser(database: AppDatabase): UserLocalDataSource =
database.userDao()
@Provides
@Singleton
internal fun providesWatchlistMovies(database: AppDatabase): WatchlistMoviesLocalDataSource =
database.watchlistMoviesDao()
@Provides
@Singleton
internal fun providesWatchlistShows(database: AppDatabase): WatchlistShowsLocalDataSource =
database.watchlistShowsDao()
@Provides
@Singleton
internal fun providesRelatedMovies(database: AppDatabase): RelatedMoviesLocalDataSource =
database.relatedMoviesDao()
@Provides
@Singleton
internal fun providesRelatedShows(database: AppDatabase): RelatedShowsLocalDataSource =
database.relatedShowsDao()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/di/StorageModule.kt
================================================
package com.michaldrabik.data_local.di
import android.content.Context
import androidx.room.Room
import com.michaldrabik.data_local.database.AppDatabase
import com.michaldrabik.data_local.database.migrations.DATABASE_NAME
import com.michaldrabik.data_local.database.migrations.Migrations
import com.michaldrabik.data_local.utilities.TransactionsProvider
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import timber.log.Timber
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
class StorageModule {
@Provides
@Singleton
internal fun providesDatabase(
@ApplicationContext context: Context,
migrations: Migrations
): AppDatabase {
Timber.d("Creating database...")
return Room.databaseBuilder(
context.applicationContext,
AppDatabase::class.java,
DATABASE_NAME
).apply {
migrations.getAll().forEach { addMigrations(it) }
}.build()
}
@Provides
@Singleton
internal fun providesMigrations(@ApplicationContext context: Context): Migrations =
Migrations(context)
@Provides
@Singleton
internal fun providesTransactions(database: AppDatabase): TransactionsProvider =
TransactionsProvider(database)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/ArchiveMoviesLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.ArchiveMovie
import com.michaldrabik.data_local.database.model.Movie
interface ArchiveMoviesLocalDataSource {
suspend fun getAll(): List
suspend fun getAll(ids: List): List
suspend fun getAllTraktIds(): List
suspend fun getById(traktId: Long): Movie?
suspend fun insert(movie: ArchiveMovie)
suspend fun deleteById(traktId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/ArchiveShowsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.ArchiveShow
import com.michaldrabik.data_local.database.model.Show
interface ArchiveShowsLocalDataSource {
suspend fun getAll(): List
suspend fun getAll(ids: List): List
suspend fun getAllTraktIds(): List
suspend fun getById(traktId: Long): Show?
suspend fun insert(show: ArchiveShow)
suspend fun deleteById(traktId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/CustomImagesLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.CustomImage
interface CustomImagesLocalDataSource {
suspend fun getById(traktId: Long, family: String, type: String): CustomImage?
suspend fun deleteById(traktId: Long, family: String, type: String)
suspend fun insertImage(image: CustomImage)
suspend fun upsert(image: CustomImage)
suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/CustomListsItemsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.CustomListItem
interface CustomListsItemsLocalDataSource {
suspend fun update(items: List)
suspend fun getListsForItem(idTrakt: Long, type: String): List
suspend fun getByIdTrakt(idList: Long, idTrakt: Long, type: String): CustomListItem?
suspend fun getItemsById(idList: Long): List
suspend fun getItemsForListImages(idList: Long, limit: Int): List
suspend fun getRankForList(idList: Long): Long?
suspend fun insertItem(item: CustomListItem)
suspend fun deleteItem(idList: Long, idTrakt: Long, type: String)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/CustomListsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.CustomList
interface CustomListsLocalDataSource {
suspend fun insert(items: List): List
suspend fun update(items: List)
suspend fun getAll(): List
suspend fun getById(id: Long): CustomList?
suspend fun updateTraktId(id: Long, idTrakt: Long, idSlug: String, timestamp: Long)
suspend fun updateTimestamp(id: Long, timestamp: Long)
suspend fun updateSortByLocal(id: Long, sortBy: String, sortHow: String, timestamp: Long)
suspend fun updateFilterTypeLocal(id: Long, filterType: String, timestamp: Long)
suspend fun deleteById(id: Long)
suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/DiscoverMoviesLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.DiscoverMovie
interface DiscoverMoviesLocalDataSource {
suspend fun getAll(): List
suspend fun getMostRecent(): DiscoverMovie?
suspend fun upsert(movies: List)
suspend fun deleteAll()
suspend fun replace(movies: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/DiscoverShowsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.DiscoverShow
interface DiscoverShowsLocalDataSource {
suspend fun getAll(): List
suspend fun getMostRecent(): DiscoverShow?
suspend fun upsert(shows: List)
suspend fun deleteAll()
suspend fun replace(shows: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/EpisodeTranslationsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.EpisodeTranslation
interface EpisodeTranslationsLocalDataSource {
suspend fun getById(traktEpisodeId: Long, traktShowId: Long, language: String): EpisodeTranslation?
suspend fun getByIds(traktEpisodeIds: List, traktShowId: Long, language: String): List
suspend fun insertSingle(translation: EpisodeTranslation)
suspend fun deleteByLanguage(languages: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/EpisodesLocalDataSource.kt
================================================
// ktlint-disable max-line-length
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.Episode
interface EpisodesLocalDataSource {
suspend fun upsert(episodes: List)
suspend fun delete(items: List)
suspend fun upsertChunked(items: List)
suspend fun isEpisodeWatched(showTraktId: Long, episodeTraktId: Long): Boolean
suspend fun getAllForSeason(seasonTraktId: Long): List
suspend fun getAllByShowId(showTraktId: Long): List
suspend fun getAllByShowId(showTraktId: Long, seasonNumber: Int): List
suspend fun getAllByShowsIds(showTraktIds: List): List
suspend fun getAllByShowsIdsChunk(showTraktIds: List): List
suspend fun getFirstUnwatched(
showTraktId: Long,
toTime: Long
): Episode?
suspend fun getFirstUnwatched(
showTraktId: Long,
fromTime: Long,
toTime: Long
): Episode?
suspend fun getFirstUnwatchedAfterEpisode(
showTraktId: Long,
seasonNumber: Int,
episodeNumber: Int,
toTime: Long
): Episode?
suspend fun getLastWatched(showTraktId: Long): Episode?
suspend fun getTotalCount(showTraktId: Long, toTime: Long): Int
suspend fun getTotalCount(showTraktId: Long): Int
suspend fun getWatchedCount(showTraktId: Long, toTime: Long): Int
suspend fun getWatchedCount(showTraktId: Long): Int
suspend fun getAllWatchedForShows(showsIds: List): List
suspend fun getAllWatchedIdsForShows(showsIds: List): List
suspend fun deleteAllUnwatchedForShow(showTraktId: Long)
suspend fun deleteAllForShow(showTraktId: Long)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/EpisodesSyncLogLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.EpisodesSyncLog
interface EpisodesSyncLogLocalDataSource {
suspend fun getAll(): List
suspend fun upsert(log: EpisodesSyncLog)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MovieCollectionsItemsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.database.model.MovieCollectionItem
interface MovieCollectionsItemsLocalDataSource {
suspend fun getById(collectionId: Long): List
suspend fun deleteById(collectionId: Long)
suspend fun replace(
collectionId: Long,
items: List,
)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MovieCollectionsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.MovieCollection
interface MovieCollectionsLocalDataSource {
suspend fun getById(traktId: Long): MovieCollection?
suspend fun getByMovieId(movieTraktId: Long): List
suspend fun replaceByMovieId(movieTraktId: Long, entities: List)
suspend fun insertAll(items: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MovieImagesLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.MovieImage
interface MovieImagesLocalDataSource {
suspend fun getByMovieId(tmdbId: Long, type: String): MovieImage?
suspend fun insertMovieImage(image: MovieImage)
suspend fun upsert(image: MovieImage)
suspend fun deleteByMovieId(id: Long, type: String)
suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MovieRatingsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.MovieRatings
interface MovieRatingsLocalDataSource {
suspend fun upsert(entity: MovieRatings)
suspend fun getById(traktId: Long): MovieRatings?
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MovieStreamingsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.MovieStreaming
interface MovieStreamingsLocalDataSource {
suspend fun replace(traktId: Long, entities: List)
suspend fun getById(traktId: Long): List
suspend fun deleteById(traktId: Long)
suspend fun deleteAll()
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MovieTranslationsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.MovieTranslation
interface MovieTranslationsLocalDataSource {
suspend fun getById(traktId: Long, language: String): MovieTranslation?
suspend fun getAll(language: String): List
suspend fun insertSingle(translation: MovieTranslation)
suspend fun deleteByLanguage(languages: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MoviesLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.Movie
interface MoviesLocalDataSource {
suspend fun getAll(): List
suspend fun getAll(ids: List): List
suspend fun getAllChunked(ids: List): List
suspend fun getById(traktId: Long): Movie?
suspend fun getByTmdbId(tmdbId: Long): Movie?
suspend fun getBySlug(slug: String): Movie?
suspend fun getById(imdbId: String): Movie?
suspend fun deleteById(traktId: Long)
suspend fun upsert(movies: List)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MoviesSyncLogLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.MoviesSyncLog
interface MoviesSyncLogLocalDataSource {
suspend fun getAll(): List
suspend fun upsert(log: MoviesSyncLog)
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MyMoviesLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.Movie
import com.michaldrabik.data_local.database.model.MyMovie
interface MyMoviesLocalDataSource {
suspend fun getAll(): List
suspend fun getAll(ids: List): List
suspend fun getAllRecent(limit: Int): List
suspend fun getAllTraktIds(): List
suspend fun getById(traktId: Long): Movie?
suspend fun insert(movies: List)
suspend fun deleteById(traktId: Long)
suspend fun checkExists(traktId: Long): Boolean
}
================================================
FILE: data-local/src/main/java/com/michaldrabik/data_local/sources/MyShowsLocalDataSource.kt
================================================
package com.michaldrabik.data_local.sources
import com.michaldrabik.data_local.database.model.MyShow
import com.michaldrabik.data_local.database.model.Show
interface MyShowsLocalDataSource {
suspend fun getAll(): List