From 3a5e7b36db4321797fb22df941ff6b429d1b9f76 Mon Sep 17 00:00:00 2001 From: Adetunji Dahunsi Date: Tue, 31 May 2022 14:32:01 -0400 Subject: [PATCH] Add UserDataRepository Change-Id: I96cd2e6d137ad1c26fe2a4fdd3ada733b5be06b0 --- .idea/codeStyles/Project.xml | 19 +--- .../core/data/test/TestDataModule.kt | 7 ++ .../nowinandroid/core/data/di/DataModule.kt | 7 ++ .../core/data/repository/AuthorsRepository.kt | 15 --- .../OfflineFirstAuthorsRepository.kt | 10 -- .../OfflineFirstTopicsRepository.kt | 10 -- .../OfflineFirstUserDataRepository.kt | 42 ++++++++ .../core/data/repository/TopicsRepository.kt | 15 --- .../data/repository/UserDataRepository.kt | 48 +++++++++ .../repository/fake/FakeAuthorsRepository.kt | 12 --- .../repository/fake/FakeTopicsRepository.kt | 10 -- .../repository/fake/FakeUserDataRepository.kt | 52 ++++++++++ .../OfflineFirstAuthorsRepositoryTest.kt | 1 - .../OfflineFirstTopicsRepositoryTest.kt | 60 +---------- .../OfflineFirstUserDataRepositoryTest.kt | 99 +++++++++++++++++++ core-datastore/build.gradle.kts | 1 + .../datastore/NiaPreferencesDataSource.kt | 10 ++ .../nowinandroid/core/model/data/UserData.kt | 26 +++++ .../repository/TestAuthorsRepository.kt | 26 ----- .../repository/TestTopicsRepository.kt | 26 ----- .../repository/TestUserDataRepository.kt | 79 +++++++++++++++ .../feature/author/AuthorViewModel.kt | 11 ++- .../feature/author/AuthorViewModelTest.kt | 13 ++- .../feature/foryou/ForYouViewModel.kt | 32 +++--- .../feature/foryou/ForYouViewModelTest.kt | 79 ++++++++------- .../feature/interests/InterestsViewModel.kt | 19 ++-- .../interests/InterestsViewModelTest.kt | 32 +++--- .../feature/topic/TopicViewModel.kt | 11 ++- .../feature/topic/TopicViewModelTest.kt | 13 ++- 29 files changed, 492 insertions(+), 293 deletions(-) create mode 100644 core-data/src/main/java/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepository.kt create mode 100644 core-data/src/main/java/com/google/samples/apps/nowinandroid/core/data/repository/UserDataRepository.kt create mode 100644 core-data/src/main/java/com/google/samples/apps/nowinandroid/core/data/repository/fake/FakeUserDataRepository.kt create mode 100644 core-data/src/test/java/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt create mode 100644 core-model/src/main/java/com/google/samples/apps/nowinandroid/core/model/data/UserData.kt create mode 100644 core-testing/src/main/java/com/google/samples/apps/nowinandroid/core/testing/repository/TestUserDataRepository.kt diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index a24d14540..0a9e39c9d 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -34,14 +34,7 @@