diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a05d3e6..26a1c67 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -11,11 +11,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup GraphQL
- run: ./gradlew downloadApolloSchema --endpoint="https://dads-engine.herokuapp.com" --schema="libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote/schema.json"
+ run: ./gradlew downloadApolloSchema --endpoint="https://dads-engine.herokuapp.com" --schema="data/remote/src/commonMain/graphql/com/bael/dads/data/remote/schema.json"
- name: Cache GraphQL setup
uses: actions/cache@v2
with:
- path: libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote
+ path: data/remote/src/commonMain/graphql/com/bael/dads/data/remote
key: ${{ github.sha }}
build:
runs-on: macos-latest
@@ -26,7 +26,7 @@ jobs:
- name: Cache GraphQL setup
uses: actions/cache@v2
with:
- path: libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote
+ path: data/remote/src/commonMain/graphql/com/bael/dads/data/remote
key: ${{ github.sha }}
- name: Build application
run: ./gradlew assembleDebug --stacktrace
@@ -39,7 +39,7 @@ jobs:
- name: Cache GraphQL setup
uses: actions/cache@v2
with:
- path: libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote
+ path: data/remote/src/commonMain/graphql/com/bael/dads/data/remote
key: ${{ github.sha }}
- name: Test application
uses: reactivecircus/android-emulator-runner@v2
diff --git a/README.md b/README.md
index 9bc9f55..4d51110 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@
- [JavaPoet](https://github.com/square/javapoet) - Personal diff-state engine printer.
- [Lifecycle](https://developer.android.com/topic/libraries/architecture/coroutines) - Coroutines teams up with Android's component lifecycle.
- [Navigation component](https://developer.android.com/guide/navigation/navigation-getting-started) - The key player for adopting single-activity architecture with ease.
-- [Room](https://developer.android.com/training/data-storage/room) - ORM for SQLite database. Also, try out its integration with [Database Inspector](https://developer.android.com/studio/inspect/database).
+- [SQLDelight](https://github.com/cashapp/sqldelight) - ORM for SQLite database, Multiplatform. Also, try out its integration with [Database Inspector](https://developer.android.com/studio/inspect/database).
- [View Binding](https://developer.android.com/topic/libraries/view-binding) - Providing safe access to view.
- [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel) - Presenter with its semi data persistence behavior.
- [WorkManager](https://developer.android.com/topic/libraries/architecture/workmanager) - Background job scheduler. You should also try out its integration with [WorkManager Inspector](https://developer.android.com/studio/preview/features#workmanager-inspector).
@@ -42,9 +42,9 @@
- [ViewPager2](https://developer.android.com/reference/androidx/viewpager2/widget/ViewPager2) - Personal option over `RecyclerView` when dealing view snapping experience.
#### Internal
-- [LiveListAdapter](libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/LiveListAdapter.kt)
+- [LiveListAdapter](android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/LiveListAdapter.kt)
ListAdapter w/ every visible cell (`ViewHolder`) is reactive. Cell acts like observer of data they hold, so it will auto-refresh if their related data is updated.
-- [RenderExecutor Processor](processor/src/main/kotlin/com/bael/dads/processor)
+- [RenderExecutor Processor](android/processor/src/main/kotlin/com/bael/dads/processor)
Processor for `RenderWith` annotation. Diff-state engine generator for rendering view component.
#### Remote
@@ -61,12 +61,23 @@ Processor for `RenderWith` annotation. Diff-state engine generator for rendering
* [LeakCanary](https://square.github.io/leakcanary) (Debug) - Memory leak detector.
* [StrictMode](https://developer.android.com/reference/android/os/StrictMode) (Debug) - Tool for checking if any *should-be-background* operation is done on main thread.
+
## MAD Scorecard
[
](https://madscorecard.withgoogle.com/scorecards/966921635/)
+[
]()
+# Supports
+Dads is ready to support multiplatform with the Clean Architecture concept for project structure (`data`-`domain`-`presentation`).
+
+
+
+JVM, JS, or Native, He is just waiting your implementation of presentation part!
+
+
+
## Architecture
Dads adopts [MVVM](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel) with [Unidirectional flow (UDF)](https://en.wikipedia.org/wiki/Unidirectional_Data_Flow_(computer_science)) pattern.
@@ -97,10 +108,10 @@ Jokes are requested from proprietary GraphQL service, the [Dads-Engine](https://
* Since this project employs GraphQL stack, you need to download the [schema](https://www.apollographql.com/docs/tutorial/schema/) first:
* Go to hosted [GraphQL Playground](https://dads-engine.herokuapp.com/graphql),
* Open tab `SCHEMA` at the right side. `DOWNLOAD` it,
- * Put the `schema.json` in directory: `libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote/`,
+ * Put the `schema.json` in directory: `data/remote/src/commonMain/graphql/com/bael/dads/data/remote/`,
* Or you can run this command as alternative.
```
- ./gradlew downloadApolloSchema --endpoint="https://dads-engine.herokuapp.com" --schema="libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote/schema.json"
+ ./gradlew downloadApolloSchema --endpoint="https://dads-engine.herokuapp.com" --schema="data/remote/src/commonMain/graphql/com/bael/dads/data/remote/schema.json"
```
* Set `JWT` key in `keys.properties` file (located in project root folder):
```
diff --git a/annotation/.gitignore b/android/annotation/.gitignore
similarity index 100%
rename from annotation/.gitignore
rename to android/annotation/.gitignore
diff --git a/annotation/build.gradle.kts b/android/annotation/build.gradle.kts
similarity index 100%
rename from annotation/build.gradle.kts
rename to android/annotation/build.gradle.kts
diff --git a/annotation/src/main/kotlin/com/bael/dads/annotation/RenderWith.kt b/android/annotation/src/main/kotlin/com/bael/dads/annotation/RenderWith.kt
similarity index 100%
rename from annotation/src/main/kotlin/com/bael/dads/annotation/RenderWith.kt
rename to android/annotation/src/main/kotlin/com/bael/dads/annotation/RenderWith.kt
diff --git a/app/.gitignore b/android/app/.gitignore
similarity index 100%
rename from app/.gitignore
rename to android/app/.gitignore
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
new file mode 100644
index 0000000..e693352
--- /dev/null
+++ b/android/app/build.gradle.kts
@@ -0,0 +1,69 @@
+import Library.AndroidX.hiltCompiler
+import Library.AndroidX.hiltNavigation
+import Library.AndroidX.hiltWork
+import Library.AndroidX.navigationFragment
+import Library.AndroidX.navigationUi
+import Library.AndroidX.work
+import Library.Apollo.apolloKotlin
+import Library.Google.dagger
+import Library.Google.daggerCompiler
+import Library.Google.firebaseBom
+import Library.KotlinX.serialization
+import Library.Square.leakCanary
+import Library.Google.firebaseAnalytics as analytics
+import Library.Google.firebaseCrashlytics as crashlytics
+
+plugins {
+ id("androidApp")
+}
+
+dependencies {
+ // AndroidX
+ implementation(hiltNavigation)
+ implementation(hiltWork)
+ kapt(hiltCompiler)
+
+ implementation(navigationFragment)
+ implementation(navigationUi)
+
+ implementation(work)
+
+ // Apollo
+ implementation(apolloKotlin)
+
+ // Google
+ implementation(dagger)
+ kapt(daggerCompiler)
+
+ implementation(platform(firebaseBom))
+ implementation(analytics)
+ implementation(crashlytics)
+
+ // KotlinX
+ implementation(serialization)
+
+ // Square
+ debugImplementation(leakCanary)
+}
+
+dependencies {
+ // Shared
+ implementation(project(":shared"))
+
+ // Data
+ implementation(project(":data:database"))
+ implementation(project(":data:remote"))
+
+ // Domain
+ implementation(project(":domain:home"))
+ implementation(project(":shared"))
+
+ // Feature
+ implementation(project(":android:feature:home"))
+
+ // Library
+ implementation(project(":android:library:preference"))
+ implementation(project(":android:library:presentation"))
+ implementation(project(":android:library:threading"))
+ implementation(project(":android:library:worker"))
+}
diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
new file mode 100644
index 0000000..c560176
--- /dev/null
+++ b/android/app/proguard-rules.pro
@@ -0,0 +1,30 @@
+# ProGuard Configuration file
+#
+# See http://proguard.sourceforge.net/index.html#manual/usage.html
+
+# Firebase Crashlytics
+-keepattributes SourceFile,LineNumberTable
+-keep public class * extends java.lang.Exception
+-keep class com.google.firebase.crashlytics.** { *; }
+-dontwarn com.google.firebase.crashlytics.**
+
+# Jetpack - Navigation Component
+-keep class androidx.navigation.fragment.NavHostFragment
+
+# KotlinX - Serialization
+-keepattributes *Annotation*, InnerClasses
+-dontnote kotlinx.serialization.AnnotationsKt # core serialization annotations
+
+-keepclassmembers class kotlinx.serialization.json.** {
+ *** Companion;
+}
+-keepclasseswithmembers class kotlinx.serialization.json.** {
+ kotlinx.serialization.KSerializer serializer(...);
+}
+-keep,includedescriptorclasses class com.bael.dads.**$$serializer { *; }
+-keepclassmembers class com.bael.dads.** {
+ *** Companion;
+}
+-keepclasseswithmembers class com.bael.dads.** {
+ kotlinx.serialization.KSerializer serializer(...);
+}
diff --git a/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
similarity index 100%
rename from app/src/debug/AndroidManifest.xml
rename to android/app/src/debug/AndroidManifest.xml
diff --git a/app/src/debug/google-services.json b/android/app/src/debug/google-services.json
similarity index 100%
rename from app/src/debug/google-services.json
rename to android/app/src/debug/google-services.json
diff --git a/app/src/debug/kotlin/com/bael/dads/DadsDebugApplication.kt b/android/app/src/debug/kotlin/com/bael/dads/DadsDebugApplication.kt
similarity index 100%
rename from app/src/debug/kotlin/com/bael/dads/DadsDebugApplication.kt
rename to android/app/src/debug/kotlin/com/bael/dads/DadsDebugApplication.kt
diff --git a/app/src/debug/res/values/strings.xml b/android/app/src/debug/res/values/strings.xml
similarity index 100%
rename from app/src/debug/res/values/strings.xml
rename to android/app/src/debug/res/values/strings.xml
diff --git a/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
similarity index 100%
rename from app/src/main/AndroidManifest.xml
rename to android/app/src/main/AndroidManifest.xml
diff --git a/app/src/main/kotlin/com/bael/dads/DadsApplication.kt b/android/app/src/main/kotlin/com/bael/dads/DadsApplication.kt
similarity index 94%
rename from app/src/main/kotlin/com/bael/dads/DadsApplication.kt
rename to android/app/src/main/kotlin/com/bael/dads/DadsApplication.kt
index 2d953d5..e581de0 100644
--- a/app/src/main/kotlin/com/bael/dads/DadsApplication.kt
+++ b/android/app/src/main/kotlin/com/bael/dads/DadsApplication.kt
@@ -4,7 +4,7 @@ import android.app.Application
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode
-import com.bael.dads.lib.preference.Preference
+import com.bael.dads.library.preference.Preference
import kotlinx.coroutines.runBlocking
import javax.inject.Inject
diff --git a/app/src/main/kotlin/com/bael/dads/activity/MainActivity.kt b/android/app/src/main/kotlin/com/bael/dads/activity/MainActivity.kt
similarity index 100%
rename from app/src/main/kotlin/com/bael/dads/activity/MainActivity.kt
rename to android/app/src/main/kotlin/com/bael/dads/activity/MainActivity.kt
diff --git a/app/src/main/kotlin/com/bael/dads/di/module/MainActivityModule.kt b/android/app/src/main/kotlin/com/bael/dads/di/module/MainActivityModule.kt
similarity index 69%
rename from app/src/main/kotlin/com/bael/dads/di/module/MainActivityModule.kt
rename to android/app/src/main/kotlin/com/bael/dads/di/module/MainActivityModule.kt
index 6d3abc4..c353472 100644
--- a/app/src/main/kotlin/com/bael/dads/di/module/MainActivityModule.kt
+++ b/android/app/src/main/kotlin/com/bael/dads/di/module/MainActivityModule.kt
@@ -1,8 +1,8 @@
package com.bael.dads.di.module
import com.bael.dads.activity.MainActivity
-import com.bael.dads.lib.presentation.di.ActivityNameQualifier
-import com.bael.dads.lib.presentation.di.ActivityNameQualifier.Companion.ACTIVITY_MAIN
+import com.bael.dads.library.presentation.di.qualifier.ActivityNameQualifier
+import com.bael.dads.library.presentation.di.qualifier.ActivityNameQualifier.Companion.ACTIVITY_MAIN
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -15,7 +15,7 @@ import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
-class MainActivityModule {
+internal class MainActivityModule {
@Provides
@Singleton
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/android/app/src/main/res/drawable/ic_launcher_foreground.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_launcher_foreground.xml
rename to android/app/src/main/res/drawable/ic_launcher_foreground.xml
diff --git a/app/src/main/res/font/product_sans.ttf b/android/app/src/main/res/font/product_sans.ttf
similarity index 100%
rename from app/src/main/res/font/product_sans.ttf
rename to android/app/src/main/res/font/product_sans.ttf
diff --git a/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml
similarity index 100%
rename from app/src/main/res/layout/activity_main.xml
rename to android/app/src/main/res/layout/activity_main.xml
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
similarity index 100%
rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
rename to android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
similarity index 100%
rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
rename to android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
diff --git a/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml
similarity index 100%
rename from app/src/main/res/values-night/styles.xml
rename to android/app/src/main/res/values-night/styles.xml
diff --git a/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
similarity index 100%
rename from app/src/main/res/values/strings.xml
rename to android/app/src/main/res/values/strings.xml
diff --git a/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
similarity index 100%
rename from app/src/main/res/values/styles.xml
rename to android/app/src/main/res/values/styles.xml
diff --git a/app/src/main/res/xml/provider_paths.xml b/android/app/src/main/res/xml/provider_paths.xml
similarity index 100%
rename from app/src/main/res/xml/provider_paths.xml
rename to android/app/src/main/res/xml/provider_paths.xml
diff --git a/app/src/release/AndroidManifest.xml b/android/app/src/release/AndroidManifest.xml
similarity index 100%
rename from app/src/release/AndroidManifest.xml
rename to android/app/src/release/AndroidManifest.xml
diff --git a/app/src/release/google-services.enc b/android/app/src/release/google-services.enc
similarity index 100%
rename from app/src/release/google-services.enc
rename to android/app/src/release/google-services.enc
diff --git a/app/src/release/kotlin/com/bael/dads/DadsReleaseApplication.kt b/android/app/src/release/kotlin/com/bael/dads/DadsReleaseApplication.kt
similarity index 100%
rename from app/src/release/kotlin/com/bael/dads/DadsReleaseApplication.kt
rename to android/app/src/release/kotlin/com/bael/dads/DadsReleaseApplication.kt
diff --git a/domains/domain_common/.gitignore b/android/feature/home/.gitignore
similarity index 100%
rename from domains/domain_common/.gitignore
rename to android/feature/home/.gitignore
diff --git a/android/feature/home/build.gradle.kts b/android/feature/home/build.gradle.kts
new file mode 100644
index 0000000..7acd781
--- /dev/null
+++ b/android/feature/home/build.gradle.kts
@@ -0,0 +1,39 @@
+import Library.Airbnb.lottie
+import Library.AndroidX.constraintLayout
+import Library.AndroidX.swipeRefreshLayout
+import Library.AndroidX.viewPager2
+import Library.AndroidX.work
+
+plugins {
+ id("androidFeature")
+}
+
+dependencies {
+ // AndroidX
+ implementation(constraintLayout)
+ implementation(swipeRefreshLayout)
+ implementation(viewPager2)
+ implementation(work)
+
+ // Airbnb
+ implementation(lottie)
+}
+
+dependencies {
+ // Shared
+ implementation(project(":shared"))
+
+ // Data
+ androidTestImplementation(project(":data:database"))
+ androidTestImplementation(project(":data:database_test"))
+
+ androidTestImplementation(project(":data:remote"))
+ androidTestImplementation(project(":data:remote_test"))
+
+ // Domain
+ implementation(project(":domain:home"))
+
+ // Library
+ implementation(project(":android:library:preference"))
+ implementation(project(":android:library:worker"))
+}
diff --git a/domains/domain_common/consumer-rules.pro b/android/feature/home/consumer-rules.pro
similarity index 100%
rename from domains/domain_common/consumer-rules.pro
rename to android/feature/home/consumer-rules.pro
diff --git a/domains/domain_common/proguard-rules.pro b/android/feature/home/proguard-rules.pro
similarity index 100%
rename from domains/domain_common/proguard-rules.pro
rename to android/feature/home/proguard-rules.pro
diff --git a/features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/home/UITest.kt b/android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/home/UITest.kt
similarity index 85%
rename from features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/home/UITest.kt
rename to android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/home/UITest.kt
index 6b4ef47..d4b3135 100644
--- a/features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/home/UITest.kt
+++ b/android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/home/UITest.kt
@@ -1,8 +1,8 @@
package com.bael.dads.feature.home.screen.home
import com.bael.dads.feature.home.R
-import com.bael.dads.lib.instrumentation.fragment.BaseFragmentTest
-import com.bael.dads.lib.presentation.ext.readText
+import com.bael.dads.library.instrumentation.fragment.BaseFragmentTest
+import com.bael.dads.library.presentation.ext.readText
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Test
diff --git a/features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/seen/UITest.kt b/android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/seen/UITest.kt
similarity index 79%
rename from features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/seen/UITest.kt
rename to android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/seen/UITest.kt
index 94a8e5c..1cb3e71 100644
--- a/features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/seen/UITest.kt
+++ b/android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/screen/seen/UITest.kt
@@ -1,11 +1,12 @@
package com.bael.dads.feature.home.screen.seen
+import com.bael.dads.data.database.entity.DadJoke
+import com.bael.dads.data.database.repository.DadJokeRepository
import com.bael.dads.feature.home.R
-import com.bael.dads.lib.database.DadsDatabase
-import com.bael.dads.lib.database.entity.DadJoke
-import com.bael.dads.lib.instrumentation.fragment.BaseFragmentTest
-import com.bael.dads.lib.presentation.ext.readText
+import com.bael.dads.library.instrumentation.fragment.BaseFragmentTest
+import com.bael.dads.library.presentation.ext.readText
import dagger.hilt.android.testing.HiltAndroidTest
+import kotlinx.coroutines.runBlocking
import org.junit.Test
import javax.inject.Inject
@@ -16,18 +17,13 @@ import javax.inject.Inject
@HiltAndroidTest
internal class UITest : BaseFragmentTest() {
@Inject
- lateinit var database: DadsDatabase
+ lateinit var dadJokeRepository: DadJokeRepository
override fun setupTest() {}
@Test
fun givenEmptySeenDadJokes_thenEmptyStateShouldShow() {
runTest {
- // given
- database.dadJoke.insertDadJokes(
- dadJokes = listOf()
- )
-
// when
launch(graphResId = R.navigation.nav_graph)
@@ -40,7 +36,7 @@ internal class UITest : BaseFragmentTest() {
fun givenSeenDadJokes_dadJokesShouldShow() {
runTest {
// given
- database.dadJoke.insertDadJokes(
+ dadJokeRepository.insertDadJokes(
dadJokes = listOf(
DadJoke(
id = 1,
@@ -76,6 +72,8 @@ internal class UITest : BaseFragmentTest() {
}
override fun clearTest() {
- database.closeConnection()
+ runBlocking {
+ dadJokeRepository.deleteAllDadJokes()
+ }
}
}
diff --git a/features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/sheet/detail/UITest.kt b/android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/sheet/detail/UITest.kt
similarity index 72%
rename from features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/sheet/detail/UITest.kt
rename to android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/sheet/detail/UITest.kt
index 807a980..eef7d22 100644
--- a/features/feature_home/src/androidTest/kotlin/com/bael/dads/feature/home/sheet/detail/UITest.kt
+++ b/android/feature/home/src/androidTest/kotlin/com/bael/dads/feature/home/sheet/detail/UITest.kt
@@ -2,8 +2,11 @@ package com.bael.dads.feature.home.sheet.detail
import androidx.core.os.bundleOf
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.instrumentation.sheet.BaseSheetTest
+import com.bael.dads.library.instrumentation.sheet.BaseSheetTest
+import com.bael.dads.shared.time.DateTime.now
import dagger.hilt.android.testing.HiltAndroidTest
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
import org.junit.Test
/**
@@ -25,11 +28,11 @@ internal class UITest : BaseSheetTest() {
punchline = "Punchline 1",
favored = false,
seen = false,
- updatedAt = 0L
+ updatedAt = now
)
// when
- launch(args = bundleOf("dadJoke" to dadJoke))
+ launch(args = bundleOf("dadJoke" to Json.encodeToString(dadJoke)))
// then
isDisplayed(text = "Setup 1")
diff --git a/features/feature_home/src/main/AndroidManifest.xml b/android/feature/home/src/main/AndroidManifest.xml
similarity index 100%
rename from features/feature_home/src/main/AndroidManifest.xml
rename to android/feature/home/src/main/AndroidManifest.xml
diff --git a/features/feature_home/src/main/assets/anim_reminder.json b/android/feature/home/src/main/assets/anim_reminder.json
similarity index 100%
rename from features/feature_home/src/main/assets/anim_reminder.json
rename to android/feature/home/src/main/assets/anim_reminder.json
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/DadJokeFeedAdapter.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/DadJokeFeedAdapter.kt
similarity index 94%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/DadJokeFeedAdapter.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/DadJokeFeedAdapter.kt
index 2fa2f11..6474d87 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/DadJokeFeedAdapter.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/DadJokeFeedAdapter.kt
@@ -7,7 +7,7 @@ import com.bael.dads.feature.home.adapter.cell.DadJokeFeedCell
import com.bael.dads.feature.home.adapter.diffcallback.DadJokeDiffCallback
import com.bael.dads.feature.home.databinding.CellFeedBinding.inflate
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.LiveListAdapter
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.LiveListAdapter
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/SeenDadJokeAdapter.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/SeenDadJokeAdapter.kt
similarity index 94%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/SeenDadJokeAdapter.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/SeenDadJokeAdapter.kt
index 3861d15..503a1fe 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/SeenDadJokeAdapter.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/SeenDadJokeAdapter.kt
@@ -7,7 +7,7 @@ import com.bael.dads.feature.home.adapter.cell.SeenDadJokeCell
import com.bael.dads.feature.home.adapter.diffcallback.DadJokeDiffCallback
import com.bael.dads.feature.home.databinding.CellSeenBinding.inflate
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.LiveListAdapter
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.LiveListAdapter
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/DadJokeFeedCell.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/DadJokeFeedCell.kt
similarity index 95%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/DadJokeFeedCell.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/DadJokeFeedCell.kt
index 05eecf5..123e3bb 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/DadJokeFeedCell.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/DadJokeFeedCell.kt
@@ -2,8 +2,8 @@ package com.bael.dads.feature.home.adapter.cell
import com.bael.dads.feature.home.databinding.CellFeedBinding
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.ext.toRichText
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell.BaseCell
+import com.bael.dads.library.presentation.ext.toRichText
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.cell.BaseCell
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/SeenDadJokeCell.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/SeenDadJokeCell.kt
similarity index 86%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/SeenDadJokeCell.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/SeenDadJokeCell.kt
index 5badbe8..defab6b 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/SeenDadJokeCell.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/cell/SeenDadJokeCell.kt
@@ -2,8 +2,8 @@ package com.bael.dads.feature.home.adapter.cell
import com.bael.dads.feature.home.databinding.CellSeenBinding
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.ext.toRichText
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell.BaseCell
+import com.bael.dads.library.presentation.ext.toRichText
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.cell.BaseCell
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/diffcallback/DadJokeDiffCallback.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/diffcallback/DadJokeDiffCallback.kt
similarity index 100%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/adapter/diffcallback/DadJokeDiffCallback.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/adapter/diffcallback/DadJokeDiffCallback.kt
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/animation/Animation.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/animation/Animation.kt
similarity index 100%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/animation/Animation.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/animation/Animation.kt
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/FeedScreenModule.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/FeedScreenModule.kt
similarity index 93%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/FeedScreenModule.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/FeedScreenModule.kt
index 9a6085b..34507ec 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/FeedScreenModule.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/FeedScreenModule.kt
@@ -4,7 +4,7 @@ import com.bael.dads.feature.home.screen.feed.DefaultRendererInitializer
import com.bael.dads.feature.home.screen.feed.Renderer
import com.bael.dads.feature.home.screen.feed.State
import com.bael.dads.feature.home.screen.feed.ViewModel
-import com.bael.dads.lib.presentation.renderer.RendererInitializer
+import com.bael.dads.library.presentation.renderer.RendererInitializer
import dagger.Binds
import dagger.Module
import dagger.Provides
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/HomeScreenModule.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/HomeScreenModule.kt
similarity index 87%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/HomeScreenModule.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/HomeScreenModule.kt
index c4de6b5..48bb1c2 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/HomeScreenModule.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/HomeScreenModule.kt
@@ -6,10 +6,10 @@ import com.bael.dads.feature.home.screen.home.DefaultRendererInitializer
import com.bael.dads.feature.home.screen.home.Renderer
import com.bael.dads.feature.home.screen.home.State
import com.bael.dads.feature.home.screen.home.ViewModel
-import com.bael.dads.lib.presentation.ext.readDrawable
-import com.bael.dads.lib.presentation.ext.readText
-import com.bael.dads.lib.presentation.renderer.RendererInitializer
-import com.bael.dads.lib.presentation.widget.tab.data.BottomTab
+import com.bael.dads.library.presentation.ext.readDrawable
+import com.bael.dads.library.presentation.ext.readText
+import com.bael.dads.library.presentation.renderer.RendererInitializer
+import com.bael.dads.library.presentation.widget.tab.data.BottomTab
import dagger.Binds
import dagger.Module
import dagger.Provides
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/SeenScreenModule.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/SeenScreenModule.kt
similarity index 93%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/SeenScreenModule.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/SeenScreenModule.kt
index de519c4..b7eccb8 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/SeenScreenModule.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/screen/SeenScreenModule.kt
@@ -4,7 +4,7 @@ import com.bael.dads.feature.home.screen.seen.DefaultRendererInitializer
import com.bael.dads.feature.home.screen.seen.Renderer
import com.bael.dads.feature.home.screen.seen.State
import com.bael.dads.feature.home.screen.seen.ViewModel
-import com.bael.dads.lib.presentation.renderer.RendererInitializer
+import com.bael.dads.library.presentation.renderer.RendererInitializer
import dagger.Binds
import dagger.Module
import dagger.Provides
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/DetailSheetModule.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/DetailSheetModule.kt
similarity index 93%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/DetailSheetModule.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/DetailSheetModule.kt
index e546fb2..9353c2b 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/DetailSheetModule.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/DetailSheetModule.kt
@@ -4,7 +4,7 @@ import com.bael.dads.feature.home.sheet.detail.DefaultRendererInitializer
import com.bael.dads.feature.home.sheet.detail.Renderer
import com.bael.dads.feature.home.sheet.detail.State
import com.bael.dads.feature.home.sheet.detail.ViewModel
-import com.bael.dads.lib.presentation.renderer.RendererInitializer
+import com.bael.dads.library.presentation.renderer.RendererInitializer
import dagger.Binds
import dagger.Module
import dagger.Provides
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SettingsSheetModule.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SettingsSheetModule.kt
similarity index 93%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SettingsSheetModule.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SettingsSheetModule.kt
index 94ca4c5..5dbddb4 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SettingsSheetModule.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SettingsSheetModule.kt
@@ -4,7 +4,7 @@ import com.bael.dads.feature.home.sheet.settings.DefaultRendererInitializer
import com.bael.dads.feature.home.sheet.settings.Renderer
import com.bael.dads.feature.home.sheet.settings.State
import com.bael.dads.feature.home.sheet.settings.ViewModel
-import com.bael.dads.lib.presentation.renderer.RendererInitializer
+import com.bael.dads.library.presentation.renderer.RendererInitializer
import dagger.Binds
import dagger.Module
import dagger.Provides
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SharePreviewSheetModule.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SharePreviewSheetModule.kt
similarity index 93%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SharePreviewSheetModule.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SharePreviewSheetModule.kt
index 8d9526d..207a7ef 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SharePreviewSheetModule.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/di/module/sheet/SharePreviewSheetModule.kt
@@ -4,7 +4,7 @@ import com.bael.dads.feature.home.sheet.sharepreview.DefaultRendererInitializer
import com.bael.dads.feature.home.sheet.sharepreview.Renderer
import com.bael.dads.feature.home.sheet.sharepreview.State
import com.bael.dads.feature.home.sheet.sharepreview.ViewModel
-import com.bael.dads.lib.presentation.renderer.RendererInitializer
+import com.bael.dads.library.presentation.renderer.RendererInitializer
import dagger.Binds
import dagger.Module
import dagger.Provides
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/notification/NewFeedReminderNotification.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/notification/NewFeedReminderNotification.kt
similarity index 90%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/notification/NewFeedReminderNotification.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/notification/NewFeedReminderNotification.kt
index 058e687..a9ea59b 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/notification/NewFeedReminderNotification.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/notification/NewFeedReminderNotification.kt
@@ -13,9 +13,9 @@ import androidx.core.app.NotificationCompat.Builder
import androidx.core.app.NotificationManagerCompat.IMPORTANCE_LOW
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.feature.home.R
-import com.bael.dads.lib.presentation.di.ActivityNameQualifier
-import com.bael.dads.lib.presentation.di.ActivityNameQualifier.Companion.ACTIVITY_MAIN
-import com.bael.dads.lib.presentation.notification.NotificationConfiguration
+import com.bael.dads.library.presentation.di.qualifier.ActivityNameQualifier
+import com.bael.dads.library.presentation.di.qualifier.ActivityNameQualifier.Companion.ACTIVITY_MAIN
+import com.bael.dads.library.presentation.notification.NotificationConfiguration
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import dagger.hilt.android.qualifiers.ApplicationContext
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/factory/NewFeedReminderNotificationFactory.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/notification/factory/NewFeedReminderNotificationFactory.kt
similarity index 86%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/factory/NewFeedReminderNotificationFactory.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/notification/factory/NewFeedReminderNotificationFactory.kt
index 5aa6ef3..5c7afe6 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/factory/NewFeedReminderNotificationFactory.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/notification/factory/NewFeedReminderNotificationFactory.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.feature.home.factory
+package com.bael.dads.feature.home.notification.factory
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.feature.home.notification.NewFeedReminderNotification
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Event.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Event.kt
similarity index 100%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Event.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Event.kt
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Renderer.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Renderer.kt
similarity index 74%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Renderer.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Renderer.kt
index f37b504..f79879e 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Renderer.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/Renderer.kt
@@ -1,9 +1,9 @@
package com.bael.dads.feature.home.screen.feed
import com.bael.dads.annotation.RenderWith
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.renderer.BaseRenderer
+import com.bael.dads.library.presentation.renderer.BaseRenderer
+import com.bael.dads.shared.response.Response
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/State.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/State.kt
similarity index 68%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/State.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/State.kt
index 5322761..355af38 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/State.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/State.kt
@@ -1,8 +1,8 @@
package com.bael.dads.feature.home.screen.feed
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.state.BaseState
+import com.bael.dads.library.presentation.state.BaseState
+import com.bael.dads.shared.response.Response
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/UI.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/UI.kt
similarity index 86%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/UI.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/UI.kt
index 34c8d0f..7674aa1 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/UI.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/UI.kt
@@ -14,12 +14,6 @@ import androidx.work.NetworkType.CONNECTED
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import androidx.work.workDataOf
-import com.bael.dads.domain.common.exception.NoNetworkException
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Empty
-import com.bael.dads.domain.common.response.Response.Error
-import com.bael.dads.domain.common.response.Response.Loading
-import com.bael.dads.domain.common.response.Response.Success
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.feature.home.R
import com.bael.dads.feature.home.adapter.DadJokeFeedAdapter
@@ -29,22 +23,29 @@ import com.bael.dads.feature.home.databinding.ScreenFeedBinding
import com.bael.dads.feature.home.databinding.ScreenFeedBinding.inflate
import com.bael.dads.feature.home.worker.FetchDadJokeFeedWorker
import com.bael.dads.feature.home.worker.FetchDadJokeFeedWorker.Companion.INPUT_CURSOR_ID
-import com.bael.dads.lib.presentation.ext.readText
-import com.bael.dads.lib.presentation.fragment.BaseFragment
-import com.bael.dads.lib.presentation.widget.animation.error
-import com.bael.dads.lib.presentation.widget.animation.loading
-import com.bael.dads.lib.presentation.widget.animation.noInternet
-import com.bael.dads.lib.presentation.widget.listener.OnPageSnapListener
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.ResponseStateAdapter
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.data.ResponseState
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.data.ResponseState.AnimationProperty
-import com.bael.dads.lib.presentation.widget.viewpager.transformer.StackTransformer
+import com.bael.dads.library.presentation.ext.readText
+import com.bael.dads.library.presentation.fragment.BaseFragment
+import com.bael.dads.library.presentation.widget.animation.error
+import com.bael.dads.library.presentation.widget.animation.loading
+import com.bael.dads.library.presentation.widget.animation.noInternet
+import com.bael.dads.library.presentation.widget.listener.OnPageSnapListener
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.ResponseStateAdapter
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.data.ResponseState
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.data.ResponseState.AnimationProperty
+import com.bael.dads.library.presentation.widget.viewpager.transformer.StackTransformer
+import com.bael.dads.shared.exception.NoNetworkException
+import com.bael.dads.shared.extension.serialize
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Empty
+import com.bael.dads.shared.response.Response.Error
+import com.bael.dads.shared.response.Response.Loading
+import com.bael.dads.shared.response.Response.Success
import dagger.hilt.android.AndroidEntryPoint
import java.util.concurrent.TimeUnit.MINUTES
import javax.inject.Inject
import com.bael.dads.feature.home.sheet.sharepreview.UI as SharePreviewSheet
import com.bael.dads.feature.home.worker.FetchDadJokeFeedWorker.Companion.TAG as FetchDadJokeFeedWorkerTag
-import com.bael.dads.lib.presentation.R as RPresentation
+import com.bael.dads.library.presentation.R as RPresentation
/**
* Created by ErickSumargo on 01/01/21.
@@ -223,7 +224,7 @@ internal class UI :
private fun shareDadJoke(dadJoke: DadJoke) {
SharePreviewSheet().also { sheet ->
- sheet.arguments = bundleOf("dadJoke" to dadJoke)
+ sheet.arguments = bundleOf("dadJoke" to dadJoke.serialize())
sheet.show(fragmentManager = activity?.supportFragmentManager)
}
}
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/ViewModel.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/ViewModel.kt
similarity index 89%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/ViewModel.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/ViewModel.kt
index 84adcba..c2903a7 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/ViewModel.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/feed/ViewModel.kt
@@ -2,19 +2,19 @@ package com.bael.dads.feature.home.screen.feed
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
-import com.bael.dads.domain.common.ext.findSuccess
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Empty
-import com.bael.dads.domain.common.response.Response.Error
-import com.bael.dads.domain.common.response.Response.Loading
-import com.bael.dads.domain.common.response.Response.Success
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.FavorDadJokeUseCase
import com.bael.dads.domain.home.usecase.LoadDadJokeFeedUseCase
import com.bael.dads.domain.home.usecase.ObserveDadJokeUseCase
import com.bael.dads.domain.home.usecase.SetDadJokeSeenUseCase
-import com.bael.dads.lib.presentation.ext.reduce
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.presentation.ext.reduce
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
+import com.bael.dads.shared.ext.findSuccess
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Empty
+import com.bael.dads.shared.response.Response.Error
+import com.bael.dads.shared.response.Response.Loading
+import com.bael.dads.shared.response.Response.Success
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collect
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Event.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Event.kt
similarity index 100%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Event.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Event.kt
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Renderer.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Renderer.kt
similarity index 76%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Renderer.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Renderer.kt
index 54a7b3e..ae6f0e5 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Renderer.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/Renderer.kt
@@ -1,7 +1,7 @@
package com.bael.dads.feature.home.screen.home
import com.bael.dads.annotation.RenderWith
-import com.bael.dads.lib.presentation.renderer.BaseRenderer
+import com.bael.dads.library.presentation.renderer.BaseRenderer
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/State.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/State.kt
similarity index 73%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/State.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/State.kt
index 4f509ee..a424bab 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/State.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/State.kt
@@ -1,6 +1,6 @@
package com.bael.dads.feature.home.screen.home
-import com.bael.dads.lib.presentation.state.BaseState
+import com.bael.dads.library.presentation.state.BaseState
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/UI.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/UI.kt
similarity index 92%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/UI.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/UI.kt
index d042266..519112b 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/UI.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/UI.kt
@@ -11,13 +11,13 @@ import androidx.lifecycle.lifecycleScope
import com.bael.dads.feature.home.R
import com.bael.dads.feature.home.databinding.ScreenHomeBinding
import com.bael.dads.feature.home.databinding.ScreenHomeBinding.inflate
-import com.bael.dads.lib.presentation.ext.hideSoftKeyboard
-import com.bael.dads.lib.presentation.ext.showSoftKeyboard
-import com.bael.dads.lib.presentation.fragment.BaseFragment
-import com.bael.dads.lib.presentation.widget.listener.OnTextChangedListener
-import com.bael.dads.lib.presentation.widget.tab.adapter.BottomTabAdapter
-import com.bael.dads.lib.presentation.widget.tab.data.BottomTab
-import com.bael.dads.lib.presentation.widget.viewpager.adapter.ScreenPagerAdapter
+import com.bael.dads.library.presentation.ext.hideSoftKeyboard
+import com.bael.dads.library.presentation.ext.showSoftKeyboard
+import com.bael.dads.library.presentation.fragment.BaseFragment
+import com.bael.dads.library.presentation.widget.listener.OnTextChangedListener
+import com.bael.dads.library.presentation.widget.tab.adapter.BottomTabAdapter
+import com.bael.dads.library.presentation.widget.tab.data.BottomTab
+import com.bael.dads.library.presentation.widget.viewpager.adapter.ScreenPagerAdapter
import com.google.android.material.tabs.TabLayoutMediator
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.channels.awaitClose
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/ViewModel.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/ViewModel.kt
similarity index 86%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/ViewModel.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/ViewModel.kt
index 82a7078..2f296dc 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/home/ViewModel.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/home/ViewModel.kt
@@ -1,8 +1,8 @@
package com.bael.dads.feature.home.screen.home
import androidx.lifecycle.SavedStateHandle
-import com.bael.dads.lib.presentation.ext.reduce
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.presentation.ext.reduce
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import javax.inject.Inject
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Event.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Event.kt
similarity index 100%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Event.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Event.kt
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Renderer.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Renderer.kt
similarity index 77%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Renderer.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Renderer.kt
index 5ea565b..c198cc8 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Renderer.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/Renderer.kt
@@ -1,9 +1,9 @@
package com.bael.dads.feature.home.screen.seen
import com.bael.dads.annotation.RenderWith
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.renderer.BaseRenderer
+import com.bael.dads.library.presentation.renderer.BaseRenderer
+import com.bael.dads.shared.response.Response
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/State.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/State.kt
similarity index 72%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/State.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/State.kt
index fc1a462..e58af85 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/State.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/State.kt
@@ -1,8 +1,8 @@
package com.bael.dads.feature.home.screen.seen
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.state.BaseState
+import com.bael.dads.library.presentation.state.BaseState
+import com.bael.dads.shared.response.Response
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/UI.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/UI.kt
similarity index 92%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/UI.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/UI.kt
index a6ce5bf..9419fc6 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/UI.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/UI.kt
@@ -10,22 +10,23 @@ import androidx.fragment.app.viewModels
import androidx.hilt.navigation.fragment.hiltNavGraphViewModels
import androidx.lifecycle.lifecycleScope
import com.airbnb.lottie.LottieDrawable.INFINITE
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Empty
-import com.bael.dads.domain.common.response.Response.Error
-import com.bael.dads.domain.common.response.Response.Loading
-import com.bael.dads.domain.common.response.Response.Success
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.feature.home.R
import com.bael.dads.feature.home.adapter.SeenDadJokeAdapter
import com.bael.dads.feature.home.adapter.diffcallback.DadJokeDiffCallback
import com.bael.dads.feature.home.databinding.ScreenSeenBinding
import com.bael.dads.feature.home.databinding.ScreenSeenBinding.inflate
-import com.bael.dads.lib.presentation.ext.readDrawable
-import com.bael.dads.lib.presentation.ext.readText
-import com.bael.dads.lib.presentation.fragment.BaseFragment
-import com.bael.dads.lib.presentation.widget.animation.empty
-import com.bael.dads.lib.presentation.widget.animation.loading
+import com.bael.dads.library.presentation.ext.readDrawable
+import com.bael.dads.library.presentation.ext.readText
+import com.bael.dads.library.presentation.fragment.BaseFragment
+import com.bael.dads.library.presentation.widget.animation.empty
+import com.bael.dads.library.presentation.widget.animation.loading
+import com.bael.dads.shared.extension.serialize
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Empty
+import com.bael.dads.shared.response.Response.Error
+import com.bael.dads.shared.response.Response.Loading
+import com.bael.dads.shared.response.Response.Success
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collect
import com.bael.dads.feature.home.screen.home.ViewModel as HomeViewModel
@@ -247,7 +248,7 @@ internal class UI :
private fun showDetailSheet(dadJoke: DadJoke) {
DetailSheet().also { sheet ->
- sheet.arguments = bundleOf("dadJoke" to dadJoke)
+ sheet.arguments = bundleOf("dadJoke" to dadJoke.serialize())
sheet.onDismissListener = callback@{ _dadJoke ->
if (dadJoke == _dadJoke) return@callback
viewModel.favorDadJoke(dadJoke, favored = _dadJoke?.favored ?: false)
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/ViewModel.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/ViewModel.kt
similarity index 91%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/ViewModel.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/ViewModel.kt
index 90eee99..750a970 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/ViewModel.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/screen/seen/ViewModel.kt
@@ -2,19 +2,19 @@ package com.bael.dads.feature.home.screen.seen
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
-import com.bael.dads.domain.common.ext.findSuccess
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Empty
-import com.bael.dads.domain.common.response.Response.Error
-import com.bael.dads.domain.common.response.Response.Loading
-import com.bael.dads.domain.common.response.Response.Success
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.FavorDadJokeUseCase
import com.bael.dads.domain.home.usecase.LoadFavoredDadJokeUseCase
import com.bael.dads.domain.home.usecase.LoadSeenDadJokeUseCase
import com.bael.dads.domain.home.usecase.ObserveDadJokeUseCase
-import com.bael.dads.lib.presentation.ext.reduce
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.presentation.ext.reduce
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
+import com.bael.dads.shared.ext.findSuccess
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Empty
+import com.bael.dads.shared.response.Response.Error
+import com.bael.dads.shared.response.Response.Loading
+import com.bael.dads.shared.response.Response.Success
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collect
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Event.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Event.kt
similarity index 100%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Event.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Event.kt
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Renderer.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Renderer.kt
similarity index 82%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Renderer.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Renderer.kt
index 4b7a82b..931c018 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Renderer.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/Renderer.kt
@@ -2,7 +2,7 @@ package com.bael.dads.feature.home.sheet.detail
import com.bael.dads.annotation.RenderWith
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.renderer.BaseRenderer
+import com.bael.dads.library.presentation.renderer.BaseRenderer
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/State.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/State.kt
similarity index 78%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/State.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/State.kt
index bfeb9fc..6f1be12 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/State.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/State.kt
@@ -1,7 +1,7 @@
package com.bael.dads.feature.home.sheet.detail
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.state.BaseState
+import com.bael.dads.library.presentation.state.BaseState
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/UI.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/UI.kt
similarity index 91%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/UI.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/UI.kt
index 1d8947c..4018003 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/UI.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/UI.kt
@@ -8,8 +8,9 @@ import androidx.fragment.app.viewModels
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.feature.home.databinding.SheetDetailBinding
import com.bael.dads.feature.home.databinding.SheetDetailBinding.inflate
-import com.bael.dads.lib.presentation.ext.toRichText
-import com.bael.dads.lib.presentation.sheet.BaseSheet
+import com.bael.dads.library.presentation.ext.toRichText
+import com.bael.dads.library.presentation.sheet.BaseSheet
+import com.bael.dads.shared.extension.serialize
import dagger.hilt.android.AndroidEntryPoint
import com.bael.dads.feature.home.sheet.sharepreview.UI as SharePreviewSheet
@@ -83,7 +84,7 @@ internal class UI :
private fun showSharePreviewSheet(dadJoke: DadJoke) {
SharePreviewSheet().also { sheet ->
- sheet.arguments = bundleOf("dadJoke" to dadJoke)
+ sheet.arguments = bundleOf("dadJoke" to dadJoke.serialize())
sheet.show(fragmentManager = activity?.supportFragmentManager)
}
}
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/ViewModel.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/ViewModel.kt
similarity index 76%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/ViewModel.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/ViewModel.kt
index cd705e7..6b8e9df 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/ViewModel.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/detail/ViewModel.kt
@@ -2,8 +2,9 @@ package com.bael.dads.feature.home.sheet.detail
import androidx.lifecycle.SavedStateHandle
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.ext.reduce
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.presentation.ext.reduce
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
+import com.bael.dads.shared.extension.deserialize
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@@ -20,9 +21,8 @@ internal class ViewModel @Inject constructor(
get() = state.dadJoke
fun receiveDadJoke() {
- val dadJoke = savedStateHandle.get("dadJoke")
val newState = state.reduce {
- copy(dadJoke = dadJoke)
+ copy(dadJoke = savedStateHandle.get("dadJoke")?.deserialize())
}
render(newState)
}
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Event.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Event.kt
similarity index 100%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Event.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Event.kt
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Renderer.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Renderer.kt
similarity index 76%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Renderer.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Renderer.kt
index 63d6e58..2a1b6fb 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Renderer.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/Renderer.kt
@@ -1,7 +1,7 @@
package com.bael.dads.feature.home.sheet.settings
import com.bael.dads.annotation.RenderWith
-import com.bael.dads.lib.presentation.renderer.BaseRenderer
+import com.bael.dads.library.presentation.renderer.BaseRenderer
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/State.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/State.kt
similarity index 70%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/State.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/State.kt
index 21c8f88..dffe198 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/State.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/State.kt
@@ -1,6 +1,6 @@
package com.bael.dads.feature.home.sheet.settings
-import com.bael.dads.lib.presentation.state.BaseState
+import com.bael.dads.library.presentation.state.BaseState
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/UI.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/UI.kt
similarity index 96%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/UI.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/UI.kt
index fe4f963..778cd42 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/UI.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/UI.kt
@@ -13,9 +13,9 @@ import com.bael.dads.feature.home.databinding.ItemGroupSettingsBinding
import com.bael.dads.feature.home.databinding.ItemSettingBinding
import com.bael.dads.feature.home.databinding.SheetSettingsBinding
import com.bael.dads.feature.home.databinding.SheetSettingsBinding.inflate
-import com.bael.dads.lib.preference.Preference
-import com.bael.dads.lib.presentation.ext.readText
-import com.bael.dads.lib.presentation.sheet.BaseSheet
+import com.bael.dads.library.preference.Preference
+import com.bael.dads.library.presentation.ext.readText
+import com.bael.dads.library.presentation.sheet.BaseSheet
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import javax.inject.Inject
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/ViewModel.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/ViewModel.kt
similarity index 85%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/ViewModel.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/ViewModel.kt
index d5e2ade..0661a77 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/ViewModel.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/settings/ViewModel.kt
@@ -1,7 +1,7 @@
package com.bael.dads.feature.home.sheet.settings
import androidx.lifecycle.SavedStateHandle
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Event.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Event.kt
similarity index 100%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Event.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Event.kt
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Renderer.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Renderer.kt
similarity index 82%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Renderer.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Renderer.kt
index d6675e8..94baa6f 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Renderer.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/Renderer.kt
@@ -2,7 +2,7 @@ package com.bael.dads.feature.home.sheet.sharepreview
import com.bael.dads.annotation.RenderWith
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.renderer.BaseRenderer
+import com.bael.dads.library.presentation.renderer.BaseRenderer
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/State.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/State.kt
similarity index 79%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/State.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/State.kt
index 33d64a3..e3a8e07 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/State.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/State.kt
@@ -1,7 +1,7 @@
package com.bael.dads.feature.home.sheet.sharepreview
import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.state.BaseState
+import com.bael.dads.library.presentation.state.BaseState
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/UI.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/UI.kt
similarity index 97%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/UI.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/UI.kt
index 22ba291..99d3ed7 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/UI.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/UI.kt
@@ -21,8 +21,8 @@ import androidx.lifecycle.lifecycleScope
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.feature.home.databinding.SheetSharePreviewBinding
import com.bael.dads.feature.home.databinding.SheetSharePreviewBinding.inflate
-import com.bael.dads.lib.presentation.ext.toRichText
-import com.bael.dads.lib.presentation.sheet.BaseSheet
+import com.bael.dads.library.presentation.ext.toRichText
+import com.bael.dads.library.presentation.sheet.BaseSheet
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/ViewModel.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/ViewModel.kt
similarity index 66%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/ViewModel.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/ViewModel.kt
index 1343d76..5e45c59 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/ViewModel.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/sheet/sharepreview/ViewModel.kt
@@ -1,9 +1,9 @@
package com.bael.dads.feature.home.sheet.sharepreview
import androidx.lifecycle.SavedStateHandle
-import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.presentation.ext.reduce
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.presentation.ext.reduce
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
+import com.bael.dads.shared.extension.deserialize
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@@ -18,9 +18,8 @@ internal class ViewModel @Inject constructor(
) : BaseViewModel(initState, savedStateHandle) {
fun receiveDadJoke() {
- val dadJoke = savedStateHandle.get("dadJoke")
val newState = state.reduce {
- copy(dadJoke = dadJoke)
+ copy(dadJoke = savedStateHandle.get("dadJoke")?.deserialize())
}
render(newState)
}
diff --git a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/worker/FetchDadJokeFeedWorker.kt b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/worker/FetchDadJokeFeedWorker.kt
similarity index 88%
rename from features/feature_home/src/main/kotlin/com/bael/dads/feature/home/worker/FetchDadJokeFeedWorker.kt
rename to android/feature/home/src/main/kotlin/com/bael/dads/feature/home/worker/FetchDadJokeFeedWorker.kt
index aba6e68..9c505dc 100644
--- a/features/feature_home/src/main/kotlin/com/bael/dads/feature/home/worker/FetchDadJokeFeedWorker.kt
+++ b/android/feature/home/src/main/kotlin/com/bael/dads/feature/home/worker/FetchDadJokeFeedWorker.kt
@@ -4,14 +4,14 @@ import android.content.Context
import androidx.hilt.work.HiltWorker
import androidx.work.ListenableWorker.Result.retry
import androidx.work.WorkerParameters
-import com.bael.dads.domain.common.response.Response.Success
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.LoadDadJokeFeedUseCase
import com.bael.dads.domain.home.usecase.LoadDadJokeUseCase
-import com.bael.dads.feature.home.factory.NewFeedReminderNotificationFactory
-import com.bael.dads.lib.preference.Preference
-import com.bael.dads.lib.presentation.notification.NotificationPublisher
-import com.bael.dads.lib.worker.BaseWorker
+import com.bael.dads.feature.home.notification.factory.NewFeedReminderNotificationFactory
+import com.bael.dads.library.preference.Preference
+import com.bael.dads.library.presentation.notification.NotificationPublisher
+import com.bael.dads.library.worker.BaseWorker
+import com.bael.dads.shared.response.Response.Success
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import kotlinx.coroutines.flow.collect
diff --git a/features/feature_home/src/main/res/drawable/bg_border.xml b/android/feature/home/src/main/res/drawable/bg_border.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/bg_border.xml
rename to android/feature/home/src/main/res/drawable/bg_border.xml
diff --git a/features/feature_home/src/main/res/drawable/bg_round.xml b/android/feature/home/src/main/res/drawable/bg_round.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/bg_round.xml
rename to android/feature/home/src/main/res/drawable/bg_round.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_clear.xml b/android/feature/home/src/main/res/drawable/ic_clear.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_clear.xml
rename to android/feature/home/src/main/res/drawable/ic_clear.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_feed.xml b/android/feature/home/src/main/res/drawable/ic_feed.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_feed.xml
rename to android/feature/home/src/main/res/drawable/ic_feed.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_like.xml b/android/feature/home/src/main/res/drawable/ic_like.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_like.xml
rename to android/feature/home/src/main/res/drawable/ic_like.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_like_outline.xml b/android/feature/home/src/main/res/drawable/ic_like_outline.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_like_outline.xml
rename to android/feature/home/src/main/res/drawable/ic_like_outline.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_logo.xml b/android/feature/home/src/main/res/drawable/ic_logo.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_logo.xml
rename to android/feature/home/src/main/res/drawable/ic_logo.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_no_internet.xml b/android/feature/home/src/main/res/drawable/ic_no_internet.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_no_internet.xml
rename to android/feature/home/src/main/res/drawable/ic_no_internet.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_search.xml b/android/feature/home/src/main/res/drawable/ic_search.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_search.xml
rename to android/feature/home/src/main/res/drawable/ic_search.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_seen.xml b/android/feature/home/src/main/res/drawable/ic_seen.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_seen.xml
rename to android/feature/home/src/main/res/drawable/ic_seen.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_settings.xml b/android/feature/home/src/main/res/drawable/ic_settings.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_settings.xml
rename to android/feature/home/src/main/res/drawable/ic_settings.xml
diff --git a/features/feature_home/src/main/res/drawable/ic_share.xml b/android/feature/home/src/main/res/drawable/ic_share.xml
similarity index 100%
rename from features/feature_home/src/main/res/drawable/ic_share.xml
rename to android/feature/home/src/main/res/drawable/ic_share.xml
diff --git a/features/feature_home/src/main/res/layout/cell_feed.xml b/android/feature/home/src/main/res/layout/cell_feed.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/cell_feed.xml
rename to android/feature/home/src/main/res/layout/cell_feed.xml
diff --git a/features/feature_home/src/main/res/layout/cell_seen.xml b/android/feature/home/src/main/res/layout/cell_seen.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/cell_seen.xml
rename to android/feature/home/src/main/res/layout/cell_seen.xml
diff --git a/features/feature_home/src/main/res/layout/item_group_settings.xml b/android/feature/home/src/main/res/layout/item_group_settings.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/item_group_settings.xml
rename to android/feature/home/src/main/res/layout/item_group_settings.xml
diff --git a/features/feature_home/src/main/res/layout/item_menu.xml b/android/feature/home/src/main/res/layout/item_menu.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/item_menu.xml
rename to android/feature/home/src/main/res/layout/item_menu.xml
diff --git a/features/feature_home/src/main/res/layout/item_setting.xml b/android/feature/home/src/main/res/layout/item_setting.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/item_setting.xml
rename to android/feature/home/src/main/res/layout/item_setting.xml
diff --git a/features/feature_home/src/main/res/layout/screen_feed.xml b/android/feature/home/src/main/res/layout/screen_feed.xml
similarity index 85%
rename from features/feature_home/src/main/res/layout/screen_feed.xml
rename to android/feature/home/src/main/res/layout/screen_feed.xml
index 28b536d..30aaf34 100644
--- a/features/feature_home/src/main/res/layout/screen_feed.xml
+++ b/android/feature/home/src/main/res/layout/screen_feed.xml
@@ -6,7 +6,7 @@
android:layout_height="wrap_content"
tools:context=".screen.feed.UI">
-
-
+
diff --git a/features/feature_home/src/main/res/layout/screen_home.xml b/android/feature/home/src/main/res/layout/screen_home.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/screen_home.xml
rename to android/feature/home/src/main/res/layout/screen_home.xml
diff --git a/features/feature_home/src/main/res/layout/screen_seen.xml b/android/feature/home/src/main/res/layout/screen_seen.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/screen_seen.xml
rename to android/feature/home/src/main/res/layout/screen_seen.xml
diff --git a/features/feature_home/src/main/res/layout/sheet_detail.xml b/android/feature/home/src/main/res/layout/sheet_detail.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/sheet_detail.xml
rename to android/feature/home/src/main/res/layout/sheet_detail.xml
diff --git a/features/feature_home/src/main/res/layout/sheet_settings.xml b/android/feature/home/src/main/res/layout/sheet_settings.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/sheet_settings.xml
rename to android/feature/home/src/main/res/layout/sheet_settings.xml
diff --git a/features/feature_home/src/main/res/layout/sheet_share_preview.xml b/android/feature/home/src/main/res/layout/sheet_share_preview.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/sheet_share_preview.xml
rename to android/feature/home/src/main/res/layout/sheet_share_preview.xml
diff --git a/features/feature_home/src/main/res/layout/toolbar_home.xml b/android/feature/home/src/main/res/layout/toolbar_home.xml
similarity index 100%
rename from features/feature_home/src/main/res/layout/toolbar_home.xml
rename to android/feature/home/src/main/res/layout/toolbar_home.xml
diff --git a/features/feature_home/src/main/res/navigation/nav_graph.xml b/android/feature/home/src/main/res/navigation/nav_graph.xml
similarity index 100%
rename from features/feature_home/src/main/res/navigation/nav_graph.xml
rename to android/feature/home/src/main/res/navigation/nav_graph.xml
diff --git a/features/feature_home/src/main/res/values/strings.xml b/android/feature/home/src/main/res/values/strings.xml
similarity index 100%
rename from features/feature_home/src/main/res/values/strings.xml
rename to android/feature/home/src/main/res/values/strings.xml
diff --git a/features/feature_home/src/main/res/xml/scene_favorite_menu.xml b/android/feature/home/src/main/res/xml/scene_favorite_menu.xml
similarity index 100%
rename from features/feature_home/src/main/res/xml/scene_favorite_menu.xml
rename to android/feature/home/src/main/res/xml/scene_favorite_menu.xml
diff --git a/features/feature_home/src/main/res/xml/scene_feed.xml b/android/feature/home/src/main/res/xml/scene_feed.xml
similarity index 100%
rename from features/feature_home/src/main/res/xml/scene_feed.xml
rename to android/feature/home/src/main/res/xml/scene_feed.xml
diff --git a/domains/domain_home/.gitignore b/android/library/instrumentation/.gitignore
similarity index 100%
rename from domains/domain_home/.gitignore
rename to android/library/instrumentation/.gitignore
diff --git a/android/library/instrumentation/build.gradle.kts b/android/library/instrumentation/build.gradle.kts
new file mode 100644
index 0000000..89b4dc1
--- /dev/null
+++ b/android/library/instrumentation/build.gradle.kts
@@ -0,0 +1,38 @@
+import Library.AndroidX.appCompat
+import Library.AndroidX.archTesting
+import Library.AndroidX.espresso
+import Library.AndroidX.fragment
+import Library.AndroidX.fragmentTesting
+import Library.AndroidX.navigationTesting
+import Library.AndroidX.runner
+import Library.Google.daggerTesting
+import Library.Google.material
+import Library.KotlinX.coroutinesTest
+
+plugins {
+ id("androidLibrary")
+}
+
+dependencies {
+ // AndroidX
+ implementation(appCompat)
+ implementation(archTesting)
+ implementation(espresso)
+ implementation(fragment)
+ implementation(fragmentTesting)
+ implementation(navigationTesting)
+ implementation(runner)
+
+ // Google
+ implementation(daggerTesting)
+ implementation(material)
+
+ // KotlinX
+ implementation(coroutinesTest)
+}
+
+dependencies {
+ // Library
+ implementation(project(":android:library:presentation"))
+ implementation(project(":android:library:threading"))
+}
diff --git a/domains/domain_home/consumer-rules.pro b/android/library/instrumentation/consumer-rules.pro
similarity index 100%
rename from domains/domain_home/consumer-rules.pro
rename to android/library/instrumentation/consumer-rules.pro
diff --git a/domains/domain_home/proguard-rules.pro b/android/library/instrumentation/proguard-rules.pro
similarity index 100%
rename from domains/domain_home/proguard-rules.pro
rename to android/library/instrumentation/proguard-rules.pro
diff --git a/libs/lib_instrumentation/src/main/AndroidManifest.xml b/android/library/instrumentation/src/main/AndroidManifest.xml
similarity index 82%
rename from libs/lib_instrumentation/src/main/AndroidManifest.xml
rename to android/library/instrumentation/src/main/AndroidManifest.xml
index 3f7c3a4..496dc98 100644
--- a/libs/lib_instrumentation/src/main/AndroidManifest.xml
+++ b/android/library/instrumentation/src/main/AndroidManifest.xml
@@ -1,6 +1,6 @@
+ package="com.bael.dads.library.instrumentation">
diff --git a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/activity/MainTestActivity.kt b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/activity/MainTestActivity.kt
similarity index 79%
rename from libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/activity/MainTestActivity.kt
rename to android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/activity/MainTestActivity.kt
index 71eafdb..378f798 100644
--- a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/activity/MainTestActivity.kt
+++ b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/activity/MainTestActivity.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.instrumentation.activity
+package com.bael.dads.library.instrumentation.activity
import androidx.appcompat.app.AppCompatActivity
import dagger.hilt.android.AndroidEntryPoint
diff --git a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/di/module/MainTestActivityModule.kt b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/di/module/MainTestActivityModule.kt
similarity index 60%
rename from libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/di/module/MainTestActivityModule.kt
rename to android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/di/module/MainTestActivityModule.kt
index 8452011..c24c4e9 100644
--- a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/di/module/MainTestActivityModule.kt
+++ b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/di/module/MainTestActivityModule.kt
@@ -1,8 +1,8 @@
-package com.bael.dads.lib.instrumentation.di.module
+package com.bael.dads.library.instrumentation.di.module
-import com.bael.dads.lib.instrumentation.activity.MainTestActivity
-import com.bael.dads.lib.presentation.di.ActivityNameQualifier
-import com.bael.dads.lib.presentation.di.ActivityNameQualifier.Companion.ACTIVITY_MAIN
+import com.bael.dads.library.instrumentation.activity.MainTestActivity
+import com.bael.dads.library.presentation.di.qualifier.ActivityNameQualifier
+import com.bael.dads.library.presentation.di.qualifier.ActivityNameQualifier.Companion.ACTIVITY_MAIN
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
diff --git a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/fragment/BaseFragmentTest.kt b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/fragment/BaseFragmentTest.kt
similarity index 88%
rename from libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/fragment/BaseFragmentTest.kt
rename to android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/fragment/BaseFragmentTest.kt
index 33db134..9975e0b 100644
--- a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/fragment/BaseFragmentTest.kt
+++ b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/fragment/BaseFragmentTest.kt
@@ -1,12 +1,12 @@
-package com.bael.dads.lib.instrumentation.fragment
+package com.bael.dads.library.instrumentation.fragment
import android.content.Context
import androidx.annotation.NavigationRes
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.test.core.app.ApplicationProvider.getApplicationContext
-import com.bael.dads.lib.instrumentation.ui.BaseUITest
-import com.bael.dads.lib.presentation.fragment.BaseFragment
-import com.bael.dads.lib.threading.Thread
+import com.bael.dads.library.instrumentation.ui.BaseUITest
+import com.bael.dads.library.presentation.fragment.BaseFragment
+import com.bael.dads.library.threading.Thread
import dagger.hilt.android.testing.HiltAndroidRule
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.test.TestCoroutineDispatcher
diff --git a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/fragment/FragmentExt.kt b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/fragment/FragmentExt.kt
similarity index 94%
rename from libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/fragment/FragmentExt.kt
rename to android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/fragment/FragmentExt.kt
index ae259c8..3e79d01 100644
--- a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/fragment/FragmentExt.kt
+++ b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/fragment/FragmentExt.kt
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package com.bael.dads.lib.instrumentation.fragment
+package com.bael.dads.library.instrumentation.fragment
import android.annotation.SuppressLint
import android.content.ComponentName
@@ -31,8 +31,8 @@ import androidx.lifecycle.ViewModelStore
import androidx.navigation.Navigation.setViewNavController
import androidx.navigation.testing.TestNavHostController
import androidx.test.core.app.ActivityScenario
-import com.bael.dads.lib.instrumentation.R
-import com.bael.dads.lib.instrumentation.activity.MainTestActivity
+import com.bael.dads.library.instrumentation.R
+import com.bael.dads.library.instrumentation.activity.MainTestActivity
/**
* launchFragmentInContainer from the androidx.fragment:fragment-testing library
diff --git a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/runner/HiltTestRunner.kt b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/runner/HiltTestRunner.kt
similarity index 90%
rename from libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/runner/HiltTestRunner.kt
rename to android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/runner/HiltTestRunner.kt
index 3db5d18..6b0b299 100644
--- a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/runner/HiltTestRunner.kt
+++ b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/runner/HiltTestRunner.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.instrumentation.runner
+package com.bael.dads.library.instrumentation.runner
import android.app.Application
import android.content.Context
diff --git a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/sheet/BaseSheetTest.kt b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/sheet/BaseSheetTest.kt
similarity index 86%
rename from libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/sheet/BaseSheetTest.kt
rename to android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/sheet/BaseSheetTest.kt
index e26ef90..050e602 100644
--- a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/sheet/BaseSheetTest.kt
+++ b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/sheet/BaseSheetTest.kt
@@ -1,14 +1,14 @@
-package com.bael.dads.lib.instrumentation.sheet
+package com.bael.dads.library.instrumentation.sheet
import android.content.Context
import android.os.Bundle
import androidx.annotation.NavigationRes
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.test.core.app.ApplicationProvider.getApplicationContext
-import com.bael.dads.lib.instrumentation.fragment.launchFragmentInHiltContainer
-import com.bael.dads.lib.instrumentation.ui.BaseUITest
-import com.bael.dads.lib.presentation.sheet.BaseSheet
-import com.bael.dads.lib.threading.Thread
+import com.bael.dads.library.instrumentation.fragment.launchFragmentInHiltContainer
+import com.bael.dads.library.instrumentation.ui.BaseUITest
+import com.bael.dads.library.presentation.sheet.BaseSheet
+import com.bael.dads.library.threading.Thread
import dagger.hilt.android.testing.HiltAndroidRule
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.test.TestCoroutineDispatcher
diff --git a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/ui/BaseUITest.kt b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/ui/BaseUITest.kt
similarity index 94%
rename from libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/ui/BaseUITest.kt
rename to android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/ui/BaseUITest.kt
index d5ed083..3bd4877 100644
--- a/libs/lib_instrumentation/src/main/kotlin/com/bael/dads/lib/instrumentation/ui/BaseUITest.kt
+++ b/android/library/instrumentation/src/main/kotlin/com/bael/dads/library/instrumentation/ui/BaseUITest.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.instrumentation.ui
+package com.bael.dads.library.instrumentation.ui
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
diff --git a/libs/lib_instrumentation/src/main/res/values/styles.xml b/android/library/instrumentation/src/main/res/values/styles.xml
similarity index 100%
rename from libs/lib_instrumentation/src/main/res/values/styles.xml
rename to android/library/instrumentation/src/main/res/values/styles.xml
diff --git a/features/feature_home/.gitignore b/android/library/preference/.gitignore
similarity index 100%
rename from features/feature_home/.gitignore
rename to android/library/preference/.gitignore
diff --git a/android/library/preference/build.gradle.kts b/android/library/preference/build.gradle.kts
new file mode 100644
index 0000000..83528b1
--- /dev/null
+++ b/android/library/preference/build.gradle.kts
@@ -0,0 +1,15 @@
+import Library.AndroidX.dataStore
+
+plugins {
+ id("androidLibrary")
+}
+
+dependencies {
+ // AndroidX
+ implementation(dataStore)
+}
+
+dependencies {
+ // Library
+ implementation(project(":android:library:threading"))
+}
diff --git a/features/feature_home/consumer-rules.pro b/android/library/preference/consumer-rules.pro
similarity index 100%
rename from features/feature_home/consumer-rules.pro
rename to android/library/preference/consumer-rules.pro
diff --git a/features/feature_home/proguard-rules.pro b/android/library/preference/proguard-rules.pro
similarity index 100%
rename from features/feature_home/proguard-rules.pro
rename to android/library/preference/proguard-rules.pro
diff --git a/android/library/preference/src/main/AndroidManifest.xml b/android/library/preference/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..eb1fbd6
--- /dev/null
+++ b/android/library/preference/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/DataStorePreference.kt b/android/library/preference/src/main/kotlin/com/bael/dads/library/preference/DataStorePreference.kt
similarity index 97%
rename from libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/DataStorePreference.kt
rename to android/library/preference/src/main/kotlin/com/bael/dads/library/preference/DataStorePreference.kt
index d03021d..774e283 100644
--- a/libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/DataStorePreference.kt
+++ b/android/library/preference/src/main/kotlin/com/bael/dads/library/preference/DataStorePreference.kt
@@ -1,6 +1,6 @@
@file:Suppress("UNCHECKED_CAST")
-package com.bael.dads.lib.preference
+package com.bael.dads.library.preference
import android.content.Context
import androidx.datastore.core.DataStore
@@ -13,7 +13,7 @@ import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.core.longPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
-import com.bael.dads.lib.threading.Thread
+import com.bael.dads.library.threading.Thread
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.withContext
diff --git a/libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/Preference.kt b/android/library/preference/src/main/kotlin/com/bael/dads/library/preference/Preference.kt
similarity index 81%
rename from libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/Preference.kt
rename to android/library/preference/src/main/kotlin/com/bael/dads/library/preference/Preference.kt
index 20309bd..85a3665 100644
--- a/libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/Preference.kt
+++ b/android/library/preference/src/main/kotlin/com/bael/dads/library/preference/Preference.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.preference
+package com.bael.dads.library.preference
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/di/module/PreferenceModule.kt b/android/library/preference/src/main/kotlin/com/bael/dads/library/preference/di/module/PreferenceModule.kt
similarity index 69%
rename from libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/di/module/PreferenceModule.kt
rename to android/library/preference/src/main/kotlin/com/bael/dads/library/preference/di/module/PreferenceModule.kt
index 4de447a..9bde9fc 100644
--- a/libs/lib_preference/src/main/kotlin/com/bael/dads/lib/preference/di/module/PreferenceModule.kt
+++ b/android/library/preference/src/main/kotlin/com/bael/dads/library/preference/di/module/PreferenceModule.kt
@@ -1,7 +1,7 @@
-package com.bael.dads.lib.preference.di.module
+package com.bael.dads.library.preference.di.module
-import com.bael.dads.lib.preference.DataStorePreference
-import com.bael.dads.lib.preference.Preference
+import com.bael.dads.library.preference.DataStorePreference
+import com.bael.dads.library.preference.Preference
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
diff --git a/libs/lib_database_test/.gitignore b/android/library/preference_test/.gitignore
similarity index 100%
rename from libs/lib_database_test/.gitignore
rename to android/library/preference_test/.gitignore
diff --git a/android/library/preference_test/build.gradle.kts b/android/library/preference_test/build.gradle.kts
new file mode 100644
index 0000000..0ee96d4
--- /dev/null
+++ b/android/library/preference_test/build.gradle.kts
@@ -0,0 +1,15 @@
+import Library.Google.daggerTesting
+
+plugins {
+ id("androidLibrary")
+}
+
+dependencies {
+ // Google
+ implementation(daggerTesting)
+}
+
+dependencies {
+ // Library
+ implementation(project(":android:library:preference"))
+}
diff --git a/libs/lib_database/consumer-rules.pro b/android/library/preference_test/consumer-rules.pro
similarity index 100%
rename from libs/lib_database/consumer-rules.pro
rename to android/library/preference_test/consumer-rules.pro
diff --git a/libs/lib_database/proguard-rules.pro b/android/library/preference_test/proguard-rules.pro
similarity index 100%
rename from libs/lib_database/proguard-rules.pro
rename to android/library/preference_test/proguard-rules.pro
diff --git a/android/library/preference_test/src/main/AndroidManifest.xml b/android/library/preference_test/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..887ac4a
--- /dev/null
+++ b/android/library/preference_test/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/libs/lib_preference_test/src/main/kotlin/com/bael/dads/lib/preference/test/FakePreference.kt b/android/library/preference_test/src/main/kotlin/com/bael/dads/library/preference/test/FakePreference.kt
similarity index 83%
rename from libs/lib_preference_test/src/main/kotlin/com/bael/dads/lib/preference/test/FakePreference.kt
rename to android/library/preference_test/src/main/kotlin/com/bael/dads/library/preference/test/FakePreference.kt
index 723b32e..a3ae602 100644
--- a/libs/lib_preference_test/src/main/kotlin/com/bael/dads/lib/preference/test/FakePreference.kt
+++ b/android/library/preference_test/src/main/kotlin/com/bael/dads/library/preference/test/FakePreference.kt
@@ -1,8 +1,8 @@
@file:Suppress("UNCHECKED_CAST")
-package com.bael.dads.lib.preference.test
+package com.bael.dads.library.preference.test
-import com.bael.dads.lib.preference.Preference
+import com.bael.dads.library.preference.Preference
import javax.inject.Inject
/**
diff --git a/libs/lib_preference_test/src/main/kotlin/com/bael/dads/lib/preference/test/di/module/PreferenceTestModule.kt b/android/library/preference_test/src/main/kotlin/com/bael/dads/library/preference/test/di/module/PreferenceTestModule.kt
similarity index 66%
rename from libs/lib_preference_test/src/main/kotlin/com/bael/dads/lib/preference/test/di/module/PreferenceTestModule.kt
rename to android/library/preference_test/src/main/kotlin/com/bael/dads/library/preference/test/di/module/PreferenceTestModule.kt
index 6f066b9..ae44d2f 100644
--- a/libs/lib_preference_test/src/main/kotlin/com/bael/dads/lib/preference/test/di/module/PreferenceTestModule.kt
+++ b/android/library/preference_test/src/main/kotlin/com/bael/dads/library/preference/test/di/module/PreferenceTestModule.kt
@@ -1,8 +1,8 @@
-package com.bael.dads.lib.preference.test.di.module
+package com.bael.dads.library.preference.test.di.module
-import com.bael.dads.lib.preference.Preference
-import com.bael.dads.lib.preference.di.module.PreferenceModule
-import com.bael.dads.lib.preference.test.FakePreference
+import com.bael.dads.library.preference.Preference
+import com.bael.dads.library.preference.di.module.PreferenceModule
+import com.bael.dads.library.preference.test.FakePreference
import dagger.Binds
import dagger.Module
import dagger.hilt.components.SingletonComponent
diff --git a/libs/lib_instrumentation/.gitignore b/android/library/presentation/.gitignore
similarity index 100%
rename from libs/lib_instrumentation/.gitignore
rename to android/library/presentation/.gitignore
diff --git a/android/library/presentation/build.gradle.kts b/android/library/presentation/build.gradle.kts
new file mode 100644
index 0000000..4e4d7e8
--- /dev/null
+++ b/android/library/presentation/build.gradle.kts
@@ -0,0 +1,44 @@
+import Library.Airbnb.lottie
+import Library.AndroidX.constraintLayout
+import Library.AndroidX.fragment
+import Library.AndroidX.lifecycle
+import Library.AndroidX.navigationFragment
+import Library.AndroidX.navigationUi
+import Library.AndroidX.recyclerView
+import Library.AndroidX.viewPager2
+import Library.Google.material
+
+plugins {
+ id("androidLibrary")
+}
+
+android {
+ buildFeatures.apply {
+ viewBinding = true
+ }
+}
+
+dependencies {
+ // AndroidX
+ implementation(constraintLayout)
+ implementation(fragment)
+ implementation(lifecycle)
+ implementation(navigationFragment)
+ implementation(navigationUi)
+ implementation(recyclerView)
+ implementation(viewPager2)
+
+ // Airbnb
+ implementation(lottie)
+
+ // Google
+ implementation(material)
+}
+
+dependencies {
+ // Shared
+ implementation(project(":shared"))
+
+ // Library
+ implementation(project(":android:library:threading"))
+}
diff --git a/libs/lib_database_test/consumer-rules.pro b/android/library/presentation/consumer-rules.pro
similarity index 100%
rename from libs/lib_database_test/consumer-rules.pro
rename to android/library/presentation/consumer-rules.pro
diff --git a/libs/lib_database_test/proguard-rules.pro b/android/library/presentation/proguard-rules.pro
similarity index 100%
rename from libs/lib_database_test/proguard-rules.pro
rename to android/library/presentation/proguard-rules.pro
diff --git a/android/library/presentation/src/main/AndroidManifest.xml b/android/library/presentation/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..64c7b2b
--- /dev/null
+++ b/android/library/presentation/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/libs/lib_presentation/src/main/assets/anim_empty.json b/android/library/presentation/src/main/assets/anim_empty.json
similarity index 100%
rename from libs/lib_presentation/src/main/assets/anim_empty.json
rename to android/library/presentation/src/main/assets/anim_empty.json
diff --git a/libs/lib_presentation/src/main/assets/anim_error.json b/android/library/presentation/src/main/assets/anim_error.json
similarity index 100%
rename from libs/lib_presentation/src/main/assets/anim_error.json
rename to android/library/presentation/src/main/assets/anim_error.json
diff --git a/libs/lib_presentation/src/main/assets/anim_loading.json b/android/library/presentation/src/main/assets/anim_loading.json
similarity index 100%
rename from libs/lib_presentation/src/main/assets/anim_loading.json
rename to android/library/presentation/src/main/assets/anim_loading.json
diff --git a/libs/lib_presentation/src/main/assets/anim_no_internet.json b/android/library/presentation/src/main/assets/anim_no_internet.json
similarity index 100%
rename from libs/lib_presentation/src/main/assets/anim_no_internet.json
rename to android/library/presentation/src/main/assets/anim_no_internet.json
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/di/ActivityNameQualifier.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/di/qualifier/ActivityNameQualifier.kt
similarity index 82%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/di/ActivityNameQualifier.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/di/qualifier/ActivityNameQualifier.kt
index f18c2cd..d550887 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/di/ActivityNameQualifier.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/di/qualifier/ActivityNameQualifier.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.di
+package com.bael.dads.library.presentation.di.qualifier
import javax.inject.Qualifier
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/event/EventStore.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/event/EventStore.kt
similarity index 76%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/event/EventStore.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/event/EventStore.kt
index cfae842..e892195 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/event/EventStore.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/event/EventStore.kt
@@ -1,8 +1,8 @@
@file:Suppress("UNCHECKED_CAST")
-package com.bael.dads.lib.presentation.event
+package com.bael.dads.library.presentation.event
-import com.bael.dads.lib.presentation.store.Store
+import com.bael.dads.library.presentation.store.Store
import kotlinx.coroutines.flow.MutableStateFlow
/**
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/ContextExt.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/ContextExt.kt
similarity index 88%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/ContextExt.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/ContextExt.kt
index ec169e5..4c538f0 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/ContextExt.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/ContextExt.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.ext
+package com.bael.dads.library.presentation.ext
import android.content.Context
import android.graphics.drawable.Drawable
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/DrawableExt.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/DrawableExt.kt
similarity index 89%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/DrawableExt.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/DrawableExt.kt
index bbdce48..95519af 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/DrawableExt.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/DrawableExt.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.ext
+package com.bael.dads.library.presentation.ext
import android.content.Context
import android.graphics.drawable.ColorDrawable
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/FragmentExt.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/FragmentExt.kt
similarity index 91%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/FragmentExt.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/FragmentExt.kt
index 1bda3f5..eee51e9 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/FragmentExt.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/FragmentExt.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.ext
+package com.bael.dads.library.presentation.ext
import android.graphics.drawable.Drawable
import androidx.annotation.DrawableRes
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/SoftKeyboardExt.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/SoftKeyboardExt.kt
similarity index 92%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/SoftKeyboardExt.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/SoftKeyboardExt.kt
index fdc55fb..5a94236 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/SoftKeyboardExt.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/SoftKeyboardExt.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.ext
+package com.bael.dads.library.presentation.ext
import android.content.Context.INPUT_METHOD_SERVICE
import android.view.View
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/StateExt.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/StateExt.kt
similarity index 56%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/StateExt.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/StateExt.kt
index e3e38eb..938d6e2 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/StateExt.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/StateExt.kt
@@ -1,6 +1,6 @@
-package com.bael.dads.lib.presentation.ext
+package com.bael.dads.library.presentation.ext
-import com.bael.dads.lib.presentation.state.BaseState
+import com.bael.dads.library.presentation.state.BaseState
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/StringExt.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/StringExt.kt
similarity index 90%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/StringExt.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/StringExt.kt
index 29ccb7c..c7a0b4d 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/ext/StringExt.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/ext/StringExt.kt
@@ -1,6 +1,6 @@
@file:Suppress("DEPRECATION")
-package com.bael.dads.lib.presentation.ext
+package com.bael.dads.library.presentation.ext
import android.os.Build.VERSION.SDK_INT
import android.os.Build.VERSION_CODES.N
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/fragment/BaseFragment.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/fragment/BaseFragment.kt
similarity index 92%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/fragment/BaseFragment.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/fragment/BaseFragment.kt
index 3c37fb4..4fbe813 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/fragment/BaseFragment.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/fragment/BaseFragment.kt
@@ -1,6 +1,6 @@
@file:Suppress("UNCHECKED_CAST")
-package com.bael.dads.lib.presentation.fragment
+package com.bael.dads.library.presentation.fragment
import android.os.Bundle
import android.view.LayoutInflater
@@ -13,9 +13,9 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavDirections
import androidx.navigation.fragment.findNavController
import androidx.viewbinding.ViewBinding
-import com.bael.dads.lib.presentation.renderer.RendererInitializer
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
-import com.bael.dads.lib.threading.Thread
+import com.bael.dads.library.presentation.renderer.RendererInitializer
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.threading.Thread
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.snackbar.Snackbar.LENGTH_SHORT
import kotlinx.coroutines.flow.launchIn
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/notification/NotificationConfiguration.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/notification/NotificationConfiguration.kt
similarity index 84%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/notification/NotificationConfiguration.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/notification/NotificationConfiguration.kt
index 8de3970..eff6366 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/notification/NotificationConfiguration.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/notification/NotificationConfiguration.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.notification
+package com.bael.dads.library.presentation.notification
import android.app.Notification
import androidx.core.app.NotificationCompat.Builder
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/notification/NotificationPublisher.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/notification/NotificationPublisher.kt
similarity index 96%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/notification/NotificationPublisher.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/notification/NotificationPublisher.kt
index 717690b..70c7780 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/notification/NotificationPublisher.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/notification/NotificationPublisher.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.notification
+package com.bael.dads.library.presentation.notification
import android.app.Notification
import android.app.NotificationChannel
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/BaseRenderExecutor.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/BaseRenderExecutor.kt
similarity index 87%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/BaseRenderExecutor.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/BaseRenderExecutor.kt
index 630fbfa..b725978 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/BaseRenderExecutor.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/BaseRenderExecutor.kt
@@ -1,11 +1,11 @@
@file:Suppress("UNCHECKED_CAST")
-package com.bael.dads.lib.presentation.renderer
+package com.bael.dads.library.presentation.renderer
import androidx.lifecycle.Lifecycle.State.RESUMED
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.scan
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/BaseRenderer.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/BaseRenderer.kt
similarity index 71%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/BaseRenderer.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/BaseRenderer.kt
index 35d3368..db0a721 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/BaseRenderer.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/BaseRenderer.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.renderer
+package com.bael.dads.library.presentation.renderer
import androidx.lifecycle.LifecycleOwner
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/RendererInitializer.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/RendererInitializer.kt
similarity index 71%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/RendererInitializer.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/RendererInitializer.kt
index 4d9b895..88f91d2 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/renderer/RendererInitializer.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/renderer/RendererInitializer.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.renderer
+package com.bael.dads.library.presentation.renderer
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/sheet/BaseSheet.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/sheet/BaseSheet.kt
similarity index 91%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/sheet/BaseSheet.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/sheet/BaseSheet.kt
index 118f621..f7c5da9 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/sheet/BaseSheet.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/sheet/BaseSheet.kt
@@ -1,6 +1,6 @@
@file:Suppress("UNCHECKED_CAST")
-package com.bael.dads.lib.presentation.sheet
+package com.bael.dads.library.presentation.sheet
import android.app.Dialog
import android.content.DialogInterface
@@ -16,17 +16,17 @@ import androidx.lifecycle.Lifecycle.State.RESUMED
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.viewbinding.ViewBinding
-import com.bael.dads.lib.presentation.ext.screenHeight
-import com.bael.dads.lib.presentation.renderer.RendererInitializer
-import com.bael.dads.lib.presentation.viewmodel.BaseViewModel
-import com.bael.dads.lib.threading.Thread
+import com.bael.dads.library.presentation.ext.screenHeight
+import com.bael.dads.library.presentation.renderer.RendererInitializer
+import com.bael.dads.library.presentation.viewmodel.BaseViewModel
+import com.bael.dads.library.threading.Thread
import com.google.android.material.bottomsheet.BottomSheetBehavior.from
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import javax.inject.Inject
-import com.bael.dads.lib.presentation.R as RPresentation
+import com.bael.dads.library.presentation.R as RPresentation
import com.google.android.material.R as RMaterial
/**
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/state/BaseState.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/state/BaseState.kt
similarity index 70%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/state/BaseState.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/state/BaseState.kt
index c6c705d..5f3f012 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/state/BaseState.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/state/BaseState.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.state
+package com.bael.dads.library.presentation.state
import java.io.Serializable
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/state/StateStore.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/state/StateStore.kt
similarity index 75%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/state/StateStore.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/state/StateStore.kt
index 6e6cb59..8a2221d 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/state/StateStore.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/state/StateStore.kt
@@ -1,6 +1,6 @@
-package com.bael.dads.lib.presentation.state
+package com.bael.dads.library.presentation.state
-import com.bael.dads.lib.presentation.store.Store
+import com.bael.dads.library.presentation.store.Store
import kotlinx.coroutines.flow.MutableStateFlow
/**
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/store/Store.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/store/Store.kt
similarity index 77%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/store/Store.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/store/Store.kt
index a1c6da2..3f76f54 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/store/Store.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/store/Store.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.store
+package com.bael.dads.library.presentation.store
import kotlinx.coroutines.flow.Flow
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/viewmodel/BaseViewModel.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/viewmodel/BaseViewModel.kt
similarity index 83%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/viewmodel/BaseViewModel.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/viewmodel/BaseViewModel.kt
index 8530d46..7bc1102 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/viewmodel/BaseViewModel.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/viewmodel/BaseViewModel.kt
@@ -1,11 +1,11 @@
-package com.bael.dads.lib.presentation.viewmodel
+package com.bael.dads.library.presentation.viewmodel
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
-import com.bael.dads.lib.presentation.event.EventStore
-import com.bael.dads.lib.presentation.state.StateStore
-import com.bael.dads.lib.presentation.store.Store
-import com.bael.dads.lib.threading.Thread
+import com.bael.dads.library.presentation.event.EventStore
+import com.bael.dads.library.presentation.state.StateStore
+import com.bael.dads.library.presentation.store.Store
+import com.bael.dads.library.threading.Thread
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.filterNotNull
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/animation/Animation.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/animation/Animation.kt
similarity index 81%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/animation/Animation.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/animation/Animation.kt
index ac5989d..86de291 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/animation/Animation.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/animation/Animation.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.widget.animation
+package com.bael.dads.library.presentation.widget.animation
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/listener/OnPageSnapListener.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/listener/OnPageSnapListener.kt
similarity index 89%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/listener/OnPageSnapListener.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/listener/OnPageSnapListener.kt
index 852af8c..4ee09dc 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/listener/OnPageSnapListener.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/listener/OnPageSnapListener.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.widget.listener
+package com.bael.dads.library.presentation.widget.listener
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/listener/OnTextChangedListener.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/listener/OnTextChangedListener.kt
similarity index 89%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/listener/OnTextChangedListener.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/listener/OnTextChangedListener.kt
index 70f1e38..8b1d001 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/listener/OnTextChangedListener.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/listener/OnTextChangedListener.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.widget.listener
+package com.bael.dads.library.presentation.widget.listener
import android.text.Editable
import android.text.TextWatcher
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/BaseAdapter.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/BaseAdapter.kt
similarity index 81%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/BaseAdapter.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/BaseAdapter.kt
index e18f5c2..8a4cf3f 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/BaseAdapter.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/BaseAdapter.kt
@@ -1,10 +1,10 @@
-package com.bael.dads.lib.presentation.widget.recyclerview.adapter
+package com.bael.dads.library.presentation.widget.recyclerview.adapter
import android.view.LayoutInflater
import android.view.LayoutInflater.from
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView.Adapter
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell.BaseCell
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.cell.BaseCell
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/BaseListAdapter.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/BaseListAdapter.kt
similarity index 88%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/BaseListAdapter.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/BaseListAdapter.kt
index ba24927..cf77968 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/BaseListAdapter.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/BaseListAdapter.kt
@@ -1,11 +1,11 @@
-package com.bael.dads.lib.presentation.widget.recyclerview.adapter
+package com.bael.dads.library.presentation.widget.recyclerview.adapter
import android.view.LayoutInflater
import android.view.LayoutInflater.from
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil.ItemCallback
import androidx.recyclerview.widget.ListAdapter
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell.BaseCell
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.cell.BaseCell
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/LiveListAdapter.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/LiveListAdapter.kt
similarity index 87%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/LiveListAdapter.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/LiveListAdapter.kt
index 6e7fcfb..c400c4f 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/LiveListAdapter.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/LiveListAdapter.kt
@@ -1,9 +1,9 @@
-package com.bael.dads.lib.presentation.widget.recyclerview.adapter
+package com.bael.dads.library.presentation.widget.recyclerview.adapter
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DiffUtil.ItemCallback
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell.BaseCell
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.cell.BaseCell
import kotlinx.coroutines.Job
/**
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/ResponseStateAdapter.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/ResponseStateAdapter.kt
similarity index 66%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/ResponseStateAdapter.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/ResponseStateAdapter.kt
index 40902c2..32a2dcd 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/ResponseStateAdapter.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/ResponseStateAdapter.kt
@@ -1,11 +1,11 @@
-package com.bael.dads.lib.presentation.widget.recyclerview.adapter
+package com.bael.dads.library.presentation.widget.recyclerview.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import com.bael.dads.lib.presentation.databinding.ItemResponseStateBinding.inflate
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell.ResponseStateCell
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.data.ResponseState
+import com.bael.dads.library.presentation.databinding.ItemResponseStateBinding.inflate
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.cell.ResponseStateCell
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.data.ResponseState
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/SingleItemAdapter.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/SingleItemAdapter.kt
similarity index 53%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/SingleItemAdapter.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/SingleItemAdapter.kt
index d3661ea..46218e9 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/SingleItemAdapter.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/SingleItemAdapter.kt
@@ -1,6 +1,6 @@
-package com.bael.dads.lib.presentation.widget.recyclerview.adapter
+package com.bael.dads.library.presentation.widget.recyclerview.adapter
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell.BaseCell
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.cell.BaseCell
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/cell/BaseCell.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/cell/BaseCell.kt
similarity index 87%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/cell/BaseCell.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/cell/BaseCell.kt
index 83ec800..247acd3 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/cell/BaseCell.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/cell/BaseCell.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell
+package com.bael.dads.library.presentation.widget.recyclerview.adapter.cell
import android.content.Context
import androidx.recyclerview.widget.RecyclerView.ViewHolder
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/cell/ResponseStateCell.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/cell/ResponseStateCell.kt
similarity index 87%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/cell/ResponseStateCell.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/cell/ResponseStateCell.kt
index 5c31d5c..604ea59 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/cell/ResponseStateCell.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/cell/ResponseStateCell.kt
@@ -1,12 +1,12 @@
-package com.bael.dads.lib.presentation.widget.recyclerview.adapter.cell
+package com.bael.dads.library.presentation.widget.recyclerview.adapter.cell
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.ViewGroup
import com.airbnb.lottie.LottieDrawable.INFINITE
-import com.bael.dads.lib.presentation.databinding.ItemResponseStateBinding
-import com.bael.dads.lib.presentation.widget.recyclerview.adapter.data.ResponseState
+import com.bael.dads.library.presentation.databinding.ItemResponseStateBinding
+import com.bael.dads.library.presentation.widget.recyclerview.adapter.data.ResponseState
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/data/ResponseState.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/data/ResponseState.kt
similarity index 79%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/data/ResponseState.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/data/ResponseState.kt
index 6fe5061..71c15ed 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/recyclerview/adapter/data/ResponseState.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/recyclerview/adapter/data/ResponseState.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.widget.recyclerview.adapter.data
+package com.bael.dads.library.presentation.widget.recyclerview.adapter.data
/**
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/tab/adapter/BottomTabAdapter.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/tab/adapter/BottomTabAdapter.kt
similarity index 86%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/tab/adapter/BottomTabAdapter.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/tab/adapter/BottomTabAdapter.kt
index 3d8f9c9..f086ce0 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/tab/adapter/BottomTabAdapter.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/tab/adapter/BottomTabAdapter.kt
@@ -1,13 +1,13 @@
-package com.bael.dads.lib.presentation.widget.tab.adapter
+package com.bael.dads.library.presentation.widget.tab.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
-import com.bael.dads.lib.presentation.databinding.ItemBottomTabBinding
-import com.bael.dads.lib.presentation.databinding.ItemBottomTabBinding.bind
-import com.bael.dads.lib.presentation.databinding.ItemBottomTabBinding.inflate
-import com.bael.dads.lib.presentation.widget.tab.data.BottomTab
+import com.bael.dads.library.presentation.databinding.ItemBottomTabBinding
+import com.bael.dads.library.presentation.databinding.ItemBottomTabBinding.bind
+import com.bael.dads.library.presentation.databinding.ItemBottomTabBinding.inflate
+import com.bael.dads.library.presentation.widget.tab.data.BottomTab
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayout.Tab
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/tab/data/BottomTab.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/tab/data/BottomTab.kt
similarity index 73%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/tab/data/BottomTab.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/tab/data/BottomTab.kt
index b9d17f2..dfac617 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/tab/data/BottomTab.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/tab/data/BottomTab.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.widget.tab.data
+package com.bael.dads.library.presentation.widget.tab.data
import android.graphics.drawable.Drawable
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/NestedScrollableHost.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/NestedScrollableHost.kt
similarity index 98%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/NestedScrollableHost.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/NestedScrollableHost.kt
index e97c536..06259b4 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/NestedScrollableHost.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/NestedScrollableHost.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.bael.dads.lib.presentation.widget.viewpager
+package com.bael.dads.library.presentation.widget.viewpager
import android.content.Context
import android.util.AttributeSet
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/adapter/ScreenPagerAdapter.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/adapter/ScreenPagerAdapter.kt
similarity index 89%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/adapter/ScreenPagerAdapter.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/adapter/ScreenPagerAdapter.kt
index 41984f2..19704a9 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/adapter/ScreenPagerAdapter.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/adapter/ScreenPagerAdapter.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.widget.viewpager.adapter
+package com.bael.dads.library.presentation.widget.viewpager.adapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
diff --git a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/transformer/StackTransformer.kt b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/transformer/StackTransformer.kt
similarity index 95%
rename from libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/transformer/StackTransformer.kt
rename to android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/transformer/StackTransformer.kt
index a7269f9..9a29a8a 100644
--- a/libs/lib_presentation/src/main/kotlin/com/bael/dads/lib/presentation/widget/viewpager/transformer/StackTransformer.kt
+++ b/android/library/presentation/src/main/kotlin/com/bael/dads/library/presentation/widget/viewpager/transformer/StackTransformer.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.presentation.widget.viewpager.transformer
+package com.bael.dads.library.presentation.widget.viewpager.transformer
import android.view.View
import androidx.core.view.ViewCompat.setElevation
diff --git a/libs/lib_presentation/src/main/res/drawable/bg_circle.xml b/android/library/presentation/src/main/res/drawable/bg_circle.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/drawable/bg_circle.xml
rename to android/library/presentation/src/main/res/drawable/bg_circle.xml
diff --git a/libs/lib_presentation/src/main/res/drawable/bg_sheet.xml b/android/library/presentation/src/main/res/drawable/bg_sheet.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/drawable/bg_sheet.xml
rename to android/library/presentation/src/main/res/drawable/bg_sheet.xml
diff --git a/libs/lib_presentation/src/main/res/layout/item_bottom_tab.xml b/android/library/presentation/src/main/res/layout/item_bottom_tab.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/layout/item_bottom_tab.xml
rename to android/library/presentation/src/main/res/layout/item_bottom_tab.xml
diff --git a/libs/lib_presentation/src/main/res/layout/item_response_state.xml b/android/library/presentation/src/main/res/layout/item_response_state.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/layout/item_response_state.xml
rename to android/library/presentation/src/main/res/layout/item_response_state.xml
diff --git a/libs/lib_presentation/src/main/res/values-night/styles.xml b/android/library/presentation/src/main/res/values-night/styles.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/values-night/styles.xml
rename to android/library/presentation/src/main/res/values-night/styles.xml
diff --git a/libs/lib_presentation/src/main/res/values/colors.xml b/android/library/presentation/src/main/res/values/colors.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/values/colors.xml
rename to android/library/presentation/src/main/res/values/colors.xml
diff --git a/libs/lib_presentation/src/main/res/values/strings.xml b/android/library/presentation/src/main/res/values/strings.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/values/strings.xml
rename to android/library/presentation/src/main/res/values/strings.xml
diff --git a/libs/lib_presentation/src/main/res/values/styles.xml b/android/library/presentation/src/main/res/values/styles.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/values/styles.xml
rename to android/library/presentation/src/main/res/values/styles.xml
diff --git a/libs/lib_presentation/src/main/res/xml/scene_bottom_tab.xml b/android/library/presentation/src/main/res/xml/scene_bottom_tab.xml
similarity index 100%
rename from libs/lib_presentation/src/main/res/xml/scene_bottom_tab.xml
rename to android/library/presentation/src/main/res/xml/scene_bottom_tab.xml
diff --git a/libs/lib_preference/.gitignore b/android/library/threading/.gitignore
similarity index 100%
rename from libs/lib_preference/.gitignore
rename to android/library/threading/.gitignore
diff --git a/android/library/threading/build.gradle.kts b/android/library/threading/build.gradle.kts
new file mode 100644
index 0000000..2c57152
--- /dev/null
+++ b/android/library/threading/build.gradle.kts
@@ -0,0 +1,3 @@
+plugins {
+ id("androidLibrary")
+}
diff --git a/libs/lib_instrumentation/consumer-rules.pro b/android/library/threading/consumer-rules.pro
similarity index 100%
rename from libs/lib_instrumentation/consumer-rules.pro
rename to android/library/threading/consumer-rules.pro
diff --git a/libs/lib_instrumentation/proguard-rules.pro b/android/library/threading/proguard-rules.pro
similarity index 100%
rename from libs/lib_instrumentation/proguard-rules.pro
rename to android/library/threading/proguard-rules.pro
diff --git a/android/library/threading/src/main/AndroidManifest.xml b/android/library/threading/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..7f941d2
--- /dev/null
+++ b/android/library/threading/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/DefaultThread.kt b/android/library/threading/src/main/kotlin/com/bael/dads/library/threading/DefaultThread.kt
similarity index 93%
rename from libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/DefaultThread.kt
rename to android/library/threading/src/main/kotlin/com/bael/dads/library/threading/DefaultThread.kt
index 4b9fa93..0b7cb74 100644
--- a/libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/DefaultThread.kt
+++ b/android/library/threading/src/main/kotlin/com/bael/dads/library/threading/DefaultThread.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.threading
+package com.bael.dads.library.threading
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers.Default
diff --git a/libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/Thread.kt b/android/library/threading/src/main/kotlin/com/bael/dads/library/threading/Thread.kt
similarity index 85%
rename from libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/Thread.kt
rename to android/library/threading/src/main/kotlin/com/bael/dads/library/threading/Thread.kt
index 49f7680..c2eb976 100644
--- a/libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/Thread.kt
+++ b/android/library/threading/src/main/kotlin/com/bael/dads/library/threading/Thread.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.threading
+package com.bael.dads.library.threading
import kotlinx.coroutines.CoroutineDispatcher
diff --git a/libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/di/module/ThreadingModule.kt b/android/library/threading/src/main/kotlin/com/bael/dads/library/threading/di/module/ThreadingModule.kt
similarity index 70%
rename from libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/di/module/ThreadingModule.kt
rename to android/library/threading/src/main/kotlin/com/bael/dads/library/threading/di/module/ThreadingModule.kt
index f13eca0..f677aec 100644
--- a/libs/lib_threading/src/main/kotlin/com/bael/dads/lib/threading/di/module/ThreadingModule.kt
+++ b/android/library/threading/src/main/kotlin/com/bael/dads/library/threading/di/module/ThreadingModule.kt
@@ -1,7 +1,7 @@
-package com.bael.dads.lib.threading.di.module
+package com.bael.dads.library.threading.di.module
-import com.bael.dads.lib.threading.DefaultThread
-import com.bael.dads.lib.threading.Thread
+import com.bael.dads.library.threading.DefaultThread
+import com.bael.dads.library.threading.Thread
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
diff --git a/libs/lib_preference_test/.gitignore b/android/library/threading_test/.gitignore
similarity index 100%
rename from libs/lib_preference_test/.gitignore
rename to android/library/threading_test/.gitignore
diff --git a/android/library/threading_test/build.gradle.kts b/android/library/threading_test/build.gradle.kts
new file mode 100644
index 0000000..0f95aeb
--- /dev/null
+++ b/android/library/threading_test/build.gradle.kts
@@ -0,0 +1,19 @@
+import Library.Google.daggerTesting
+import Library.KotlinX.coroutinesTest
+
+plugins {
+ id("androidLibrary")
+}
+
+dependencies {
+ // Google
+ implementation(daggerTesting)
+
+ // KotlinX
+ implementation(coroutinesTest)
+}
+
+dependencies {
+ // Library
+ implementation(project(":android:library:threading"))
+}
diff --git a/libs/lib_preference/consumer-rules.pro b/android/library/threading_test/consumer-rules.pro
similarity index 100%
rename from libs/lib_preference/consumer-rules.pro
rename to android/library/threading_test/consumer-rules.pro
diff --git a/libs/lib_preference/proguard-rules.pro b/android/library/threading_test/proguard-rules.pro
similarity index 100%
rename from libs/lib_preference/proguard-rules.pro
rename to android/library/threading_test/proguard-rules.pro
diff --git a/android/library/threading_test/src/main/AndroidManifest.xml b/android/library/threading_test/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..4191cbb
--- /dev/null
+++ b/android/library/threading_test/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/libs/lib_threading_test/src/main/kotlin/com/bael/dads/lib/threading/test/FakeThread.kt b/android/library/threading_test/src/main/kotlin/com/bael/dads/library/threading/test/FakeThread.kt
similarity index 87%
rename from libs/lib_threading_test/src/main/kotlin/com/bael/dads/lib/threading/test/FakeThread.kt
rename to android/library/threading_test/src/main/kotlin/com/bael/dads/library/threading/test/FakeThread.kt
index 6881b2a..ff89790 100644
--- a/libs/lib_threading_test/src/main/kotlin/com/bael/dads/lib/threading/test/FakeThread.kt
+++ b/android/library/threading_test/src/main/kotlin/com/bael/dads/library/threading/test/FakeThread.kt
@@ -1,6 +1,6 @@
-package com.bael.dads.lib.threading.test
+package com.bael.dads.library.threading.test
-import com.bael.dads.lib.threading.Thread
+import com.bael.dads.library.threading.Thread
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.test.TestCoroutineDispatcher
import javax.inject.Inject
diff --git a/libs/lib_threading_test/src/main/kotlin/com/bael/dads/lib/threading/test/di/module/ThreadingTestModule.kt b/android/library/threading_test/src/main/kotlin/com/bael/dads/library/threading/test/di/module/ThreadingTestModule.kt
similarity index 66%
rename from libs/lib_threading_test/src/main/kotlin/com/bael/dads/lib/threading/test/di/module/ThreadingTestModule.kt
rename to android/library/threading_test/src/main/kotlin/com/bael/dads/library/threading/test/di/module/ThreadingTestModule.kt
index c196935..4d5a06e 100644
--- a/libs/lib_threading_test/src/main/kotlin/com/bael/dads/lib/threading/test/di/module/ThreadingTestModule.kt
+++ b/android/library/threading_test/src/main/kotlin/com/bael/dads/library/threading/test/di/module/ThreadingTestModule.kt
@@ -1,8 +1,8 @@
-package com.bael.dads.lib.threading.test.di.module
+package com.bael.dads.library.threading.test.di.module
-import com.bael.dads.lib.threading.Thread
-import com.bael.dads.lib.threading.di.module.ThreadingModule
-import com.bael.dads.lib.threading.test.FakeThread
+import com.bael.dads.library.threading.Thread
+import com.bael.dads.library.threading.di.module.ThreadingModule
+import com.bael.dads.library.threading.test.FakeThread
import dagger.Binds
import dagger.Module
import dagger.hilt.components.SingletonComponent
diff --git a/libs/lib_presentation/.gitignore b/android/library/worker/.gitignore
similarity index 100%
rename from libs/lib_presentation/.gitignore
rename to android/library/worker/.gitignore
diff --git a/android/library/worker/build.gradle.kts b/android/library/worker/build.gradle.kts
new file mode 100644
index 0000000..e35723c
--- /dev/null
+++ b/android/library/worker/build.gradle.kts
@@ -0,0 +1,14 @@
+import Library.AndroidX.hiltWork
+import Library.AndroidX.startup
+import Library.AndroidX.work
+
+plugins {
+ id("androidLibrary")
+}
+
+dependencies {
+ // AndroidX
+ implementation(hiltWork)
+ implementation(startup)
+ implementation(work)
+}
diff --git a/libs/lib_preference_test/consumer-rules.pro b/android/library/worker/consumer-rules.pro
similarity index 100%
rename from libs/lib_preference_test/consumer-rules.pro
rename to android/library/worker/consumer-rules.pro
diff --git a/libs/lib_preference_test/proguard-rules.pro b/android/library/worker/proguard-rules.pro
similarity index 100%
rename from libs/lib_preference_test/proguard-rules.pro
rename to android/library/worker/proguard-rules.pro
diff --git a/libs/lib_worker/src/main/AndroidManifest.xml b/android/library/worker/src/main/AndroidManifest.xml
similarity index 83%
rename from libs/lib_worker/src/main/AndroidManifest.xml
rename to android/library/worker/src/main/AndroidManifest.xml
index 2a5d305..d8d29bb 100644
--- a/libs/lib_worker/src/main/AndroidManifest.xml
+++ b/android/library/worker/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
+ package="com.bael.dads.library.worker">
diff --git a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/BaseWorker.kt b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/BaseWorker.kt
similarity index 93%
rename from libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/BaseWorker.kt
rename to android/library/worker/src/main/kotlin/com/bael/dads/library/worker/BaseWorker.kt
index b0356f6..9d8b7fd 100644
--- a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/BaseWorker.kt
+++ b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/BaseWorker.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.worker
+package com.bael.dads.library.worker
import android.content.Context
import androidx.work.CoroutineWorker
diff --git a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/di/entry/EntryPoint.kt b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/di/entry/EntryPoint.kt
similarity index 87%
rename from libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/di/entry/EntryPoint.kt
rename to android/library/worker/src/main/kotlin/com/bael/dads/library/worker/di/entry/EntryPoint.kt
index 3776a3d..a08c249 100644
--- a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/di/entry/EntryPoint.kt
+++ b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/di/entry/EntryPoint.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.worker.di.entry
+package com.bael.dads.library.worker.di.entry
import androidx.hilt.work.HiltWorkerFactory
import dagger.hilt.EntryPoint
diff --git a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/di/module/WorkerModule.kt b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/di/module/WorkerModule.kt
similarity index 92%
rename from libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/di/module/WorkerModule.kt
rename to android/library/worker/src/main/kotlin/com/bael/dads/library/worker/di/module/WorkerModule.kt
index 4401924..85eec16 100644
--- a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/di/module/WorkerModule.kt
+++ b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/di/module/WorkerModule.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.worker.di.module
+package com.bael.dads.library.worker.di.module
import android.content.Context
import androidx.work.WorkManager
diff --git a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/factory/NoOpWorkerFactory.kt b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/factory/NoOpWorkerFactory.kt
similarity index 90%
rename from libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/factory/NoOpWorkerFactory.kt
rename to android/library/worker/src/main/kotlin/com/bael/dads/library/worker/factory/NoOpWorkerFactory.kt
index 931c474..1bd3789 100644
--- a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/factory/NoOpWorkerFactory.kt
+++ b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/factory/NoOpWorkerFactory.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.worker.factory
+package com.bael.dads.library.worker.factory
import android.content.Context
import androidx.work.ListenableWorker
diff --git a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/initializer/WorkManagerInitializer.kt b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/initializer/WorkManagerInitializer.kt
similarity index 91%
rename from libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/initializer/WorkManagerInitializer.kt
rename to android/library/worker/src/main/kotlin/com/bael/dads/library/worker/initializer/WorkManagerInitializer.kt
index 4878d9a..0026032 100644
--- a/libs/lib_worker/src/main/kotlin/com/bael/dads/lib/worker/initializer/WorkManagerInitializer.kt
+++ b/android/library/worker/src/main/kotlin/com/bael/dads/library/worker/initializer/WorkManagerInitializer.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.worker.initializer
+package com.bael.dads.library.worker.initializer
import android.content.Context
import androidx.startup.Initializer
@@ -6,8 +6,8 @@ import androidx.work.Configuration
import androidx.work.Configuration.Provider
import androidx.work.WorkManager
import androidx.work.WorkerFactory
-import com.bael.dads.lib.worker.di.entry.EntryPoint
-import com.bael.dads.lib.worker.factory.NoOpWorkerFactory
+import com.bael.dads.library.worker.di.entry.EntryPoint
+import com.bael.dads.library.worker.factory.NoOpWorkerFactory
import dagger.hilt.android.EntryPointAccessors
/**
diff --git a/libs/lib_remote_test/.gitignore b/android/processor/.gitignore
similarity index 100%
rename from libs/lib_remote_test/.gitignore
rename to android/processor/.gitignore
diff --git a/android/processor/build.gradle.kts b/android/processor/build.gradle.kts
new file mode 100644
index 0000000..67d5fca
--- /dev/null
+++ b/android/processor/build.gradle.kts
@@ -0,0 +1,25 @@
+import Library.Google.autoService
+import Library.JavaX.inject
+import Library.Square.javaPoet
+
+plugins {
+ id("kotlin")
+ kotlin("kapt")
+}
+
+dependencies {
+ // Google
+ implementation(autoService)
+ kapt(autoService)
+
+ // JavaX
+ implementation(inject)
+
+ // Square
+ implementation(javaPoet)
+}
+
+dependencies {
+ // Internal
+ implementation(project(":android:annotation"))
+}
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/ext/AnnotationMirrorExt.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/ext/AnnotationMirrorExt.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/ext/AnnotationMirrorExt.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/ext/AnnotationMirrorExt.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/ext/ClassNameExt.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/ext/ClassNameExt.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/ext/ClassNameExt.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/ext/ClassNameExt.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/ext/ElementExt.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/ext/ElementExt.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/ext/ElementExt.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/ext/ElementExt.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/ext/NameExt.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/ext/NameExt.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/ext/NameExt.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/ext/NameExt.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/ext/TypeElementExt.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/ext/TypeElementExt.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/ext/TypeElementExt.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/ext/TypeElementExt.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/generator/BaseGenerator.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/generator/BaseGenerator.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/generator/BaseGenerator.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/generator/BaseGenerator.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/generator/render/RenderGenerator.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/generator/render/RenderGenerator.kt
similarity index 95%
rename from processor/src/main/kotlin/com/bael/dads/processor/generator/render/RenderGenerator.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/generator/render/RenderGenerator.kt
index 126dc31..f856668 100644
--- a/processor/src/main/kotlin/com/bael/dads/processor/generator/render/RenderGenerator.kt
+++ b/android/processor/src/main/kotlin/com/bael/dads/processor/generator/render/RenderGenerator.kt
@@ -53,12 +53,12 @@ internal class RenderGenerator : BaseGenerator(annotation = RenderWith::class) {
)
rendererInitializerClass = ClassName.get(
- "com.bael.dads.lib.presentation.renderer",
+ "com.bael.dads.library.presentation.renderer",
"RendererInitializer"
)
baseRenderExecutorClass = ClassName.get(
- "com.bael.dads.lib.presentation.renderer",
+ "com.bael.dads.library.presentation.renderer",
"BaseRenderExecutor"
)
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/generator/render/file/DefaultRendererInitializerFile.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/generator/render/file/DefaultRendererInitializerFile.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/generator/render/file/DefaultRendererInitializerFile.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/generator/render/file/DefaultRendererInitializerFile.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/generator/render/file/RenderExecutorFile.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/generator/render/file/RenderExecutorFile.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/generator/render/file/RenderExecutorFile.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/generator/render/file/RenderExecutorFile.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/generator/util/CustomEquals.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/generator/util/CustomEquals.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/generator/util/CustomEquals.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/generator/util/CustomEquals.kt
diff --git a/processor/src/main/kotlin/com/bael/dads/processor/logger/Logger.kt b/android/processor/src/main/kotlin/com/bael/dads/processor/logger/Logger.kt
similarity index 100%
rename from processor/src/main/kotlin/com/bael/dads/processor/logger/Logger.kt
rename to android/processor/src/main/kotlin/com/bael/dads/processor/logger/Logger.kt
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
deleted file mode 100644
index 62ab2c3..0000000
--- a/app/build.gradle.kts
+++ /dev/null
@@ -1,3 +0,0 @@
-plugins {
- id("app")
-}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
deleted file mode 100644
index 8e412a2..0000000
--- a/app/proguard-rules.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-# ProGuard Configuration file
-#
-# See http://proguard.sourceforge.net/index.html#manual/usage.html
-
-# Firebase Crashlytics
--keepattributes SourceFile,LineNumberTable
--keep public class * extends java.lang.Exception
--keep class com.google.firebase.crashlytics.** { *; }
--dontwarn com.google.firebase.crashlytics.**
-
-# Jetpack - Navigation Component
--keep class androidx.navigation.fragment.NavHostFragment
diff --git a/assets/kmm.png b/assets/kmm.png
new file mode 100644
index 0000000..46fa857
Binary files /dev/null and b/assets/kmm.png differ
diff --git a/build.gradle.kts b/build.gradle.kts
index 2a496ac..e8ba746 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,6 +4,10 @@ allprojects {
repositories {
google()
mavenCentral()
+ maven {
+ setUrl("https://www.jetbrains.com/intellij-repository/releases")
+ setUrl("https://jetbrains.bintray.com/intellij-third-party-dependencies")
+ }
}
}
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 49c9509..5f3de59 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -1,27 +1,46 @@
+import Plugin.Apollo.apollo
+import Plugin.Google.dagger
+import Plugin.Google.firebaseCrashlytics
+import Plugin.Google.gms
+import Plugin.KotlinX.serialization
+import Plugin.Square.sqlDelight
+import Plugin.Android.gradle as androidGradle
+import Plugin.KotlinX.kotlin as kotlinGradle
+
plugins {
`kotlin-dsl`
}
gradlePlugin {
plugins {
- register("app") {
- id = "app"
- implementationClass = "plugin.ApplicationPlugin"
+ register("shared") {
+ id = "shared"
+ implementationClass = "plugin.shared.SharedModulePlugin"
+ }
+
+ register("data") {
+ id = "data"
+ implementationClass = "plugin.shared.DataModulePlugin"
}
register("domain") {
id = "domain"
- implementationClass = "plugin.DomainPlugin"
+ implementationClass = "plugin.shared.DomainModulePlugin"
+ }
+
+ register("androidApp") {
+ id = "androidApp"
+ implementationClass = "plugin.android.AppModulePlugin"
}
- register("feature") {
- id = "feature"
- implementationClass = "plugin.FeaturePlugin"
+ register("androidFeature") {
+ id = "androidFeature"
+ implementationClass = "plugin.android.FeatureModulePlugin"
}
- register("library") {
- id = "library"
- implementationClass = "plugin.LibraryPlugin"
+ register("androidLibrary") {
+ id = "androidLibrary"
+ implementationClass = "plugin.android.LibraryModulePlugin"
}
}
}
@@ -37,20 +56,30 @@ kotlin {
}
dependencies {
+ // Android
+ implementation(androidGradle)
+
// Apollo
- implementation(Plugin.apollo)
+ implementation(apollo)
// Google
- implementation(Plugin.crashlytics)
- implementation(Plugin.dagger)
- implementation(Plugin.gms)
- implementation(Plugin.gradle)
+ implementation(firebaseCrashlytics)
+ implementation(dagger)
+ implementation(gms)
// KotlinX
- implementation(Plugin.kotlin)
+ implementation(kotlinGradle)
+ implementation(serialization)
+
+ // Square
+ implementation(sqlDelight)
}
repositories {
google()
mavenCentral()
+ maven {
+ setUrl("https://www.jetbrains.com/intellij-repository/releases")
+ setUrl("https://jetbrains.bintray.com/intellij-third-party-dependencies")
+ }
}
diff --git a/buildSrc/buildSrc/src/main/kotlin/Application.kt b/buildSrc/buildSrc/src/main/kotlin/Application.kt
index 709fcbe..ea3f68e 100644
--- a/buildSrc/buildSrc/src/main/kotlin/Application.kt
+++ b/buildSrc/buildSrc/src/main/kotlin/Application.kt
@@ -3,15 +3,15 @@
*/
object Application {
- val id: String = "com.bael.dads"
+ const val id: String = "com.bael.dads"
- val versionCode: Int = 2
+ const val versionCode: Int = 2
- val versionName: String = "1.1"
+ const val versionName: String = "1.1"
- val compileSdk: Int = 30
+ const val compileSdk: Int = 30
- val targetSdk: Int = 30
+ const val targetSdk: Int = 30
- val minSdk: Int = 23
+ const val minSdk: Int = 23
}
diff --git a/buildSrc/buildSrc/src/main/kotlin/Library.kt b/buildSrc/buildSrc/src/main/kotlin/Library.kt
index 1c80c87..5c3f3fc 100644
--- a/buildSrc/buildSrc/src/main/kotlin/Library.kt
+++ b/buildSrc/buildSrc/src/main/kotlin/Library.kt
@@ -1,135 +1,177 @@
+import Version.Airbnb.lottie as lottieVersion
+import Version.AndroidX.appCompat as appCompatVersion
+import Version.AndroidX.archTesting as archTestingVersion
+import Version.AndroidX.constraintLayout as constraintLayoutVersion
+import Version.AndroidX.dataStore as dataStoreVersion
+import Version.AndroidX.espresso as espressoVersion
+import Version.AndroidX.fragment as fragmentVersion
+import Version.AndroidX.hilt as hiltVersion
+import Version.AndroidX.lifecycle as lifecycleVersion
+import Version.AndroidX.navigation as navigationVersion
+import Version.AndroidX.recyclerView as recyclerViewVersion
+import Version.AndroidX.runner as runnerVersion
+import Version.AndroidX.startup as startupVersion
+import Version.AndroidX.swipeRefreshLayout as swipeRefreshLayoutVersion
+import Version.AndroidX.viewPager2 as viewPager2Version
+import Version.AndroidX.work as workVersion
+import Version.Apollo.apollo as apolloVersion
+import Version.Google.autoService as autoServiceVersion
+import Version.Google.dagger as daggerVersion
+import Version.Google.firebaseBom as firebaseBomVersion
+import Version.Google.material as materialVersion
+import Version.Google.truth as truthVersion
+import Version.JavaX.annotation as annotationVersion
+import Version.JavaX.inject as injectVersion
+import Version.KotlinX.coroutines as coroutinesVersion
+import Version.KotlinX.dateTime as dateTimeVersion
+import Version.KotlinX.serialization as serializationVersion
+import Version.Square.javaPoet as javaPoetVersion
+import Version.Square.leakCanary as leakCanaryVersion
+import Version.Square.sqlDelight as sqlDelightVersion
+
/**
* Created by ErickSumargo on 15/04/21.
*/
object Library {
- // AndroidX
- val appCompat: String
- get() = "androidx.appcompat:appcompat:${Version.appCompat}"
- val archTesting: String
- get() = "androidx.arch.core:core-testing:${Version.archTesting}"
+ object AndroidX {
+ val appCompat: String
+ get() = "androidx.appcompat:appcompat:$appCompatVersion"
+
+ val archTesting: String
+ get() = "androidx.arch.core:core-testing:$archTestingVersion"
+
+ val constraintLayout: String
+ get() = "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
- val constraintLayout: String
- get() = "androidx.constraintlayout:constraintlayout:${Version.constraintLayout}"
+ val dataStore: String
+ get() = "androidx.datastore:datastore-preferences:$dataStoreVersion"
- val dataStore: String
- get() = "androidx.datastore:datastore-preferences:${Version.dataStore}"
+ val espresso: String
+ get() = "androidx.test.espresso:espresso-core:$espressoVersion"
- val espresso: String
- get() = "androidx.test.espresso:espresso-core:${Version.espresso}"
+ val fragment: String
+ get() = "androidx.fragment:fragment-ktx:$fragmentVersion"
- val fragmentKtx: String
- get() = "androidx.fragment:fragment-ktx:${Version.fragment}"
+ val fragmentTesting: String
+ get() = "androidx.fragment:fragment-testing:$fragmentVersion"
- val fragmentTesting: String
- get() = "androidx.fragment:fragment-testing:${Version.fragment}"
+ val hiltCompiler: String
+ get() = "androidx.hilt:hilt-compiler:$hiltVersion"
- val hiltCompiler: String
- get() = "androidx.hilt:hilt-compiler:${Version.hilt}"
+ val hiltNavigation: String
+ get() = "androidx.hilt:hilt-navigation-fragment:$hiltVersion"
- val hiltNavigation: String
- get() = "androidx.hilt:hilt-navigation-fragment:${Version.hilt}"
+ val hiltWork: String
+ get() = "androidx.hilt:hilt-work:$hiltVersion"
- val hiltWork: String
- get() = "androidx.hilt:hilt-work:${Version.hilt}"
+ val lifecycle: String
+ get() = "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
- val lifecycle: String
- get() = "androidx.lifecycle:lifecycle-runtime-ktx:${Version.lifecycle}"
+ val navigationFragment: String
+ get() = "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
- val navigationFragment: String
- get() = "androidx.navigation:navigation-fragment-ktx:${Version.navigation}"
+ val navigationTesting: String
+ get() = "androidx.navigation:navigation-testing:$navigationVersion"
- val navigationTesting: String
- get() = "androidx.navigation:navigation-testing:${Version.navigation}"
+ val navigationUi: String
+ get() = "androidx.navigation:navigation-ui-ktx:$navigationVersion"
- val navigationUi: String
- get() = "androidx.navigation:navigation-ui-ktx:${Version.navigation}"
+ val recyclerView: String
+ get() = "androidx.recyclerview:recyclerview:$recyclerViewVersion"
- val recyclerView: String
- get() = "androidx.recyclerview:recyclerview:${Version.recyclerView}"
+ val runner: String
+ get() = "androidx.test:runner:$runnerVersion"
- val room: String
- get() = "androidx.room:room-runtime:${Version.room}"
+ val startup: String
+ get() = "androidx.startup:startup-runtime:$startupVersion"
- val roomCompiler: String
- get() = "androidx.room:room-compiler:${Version.room}"
+ val swipeRefreshLayout: String
+ get() = "androidx.swiperefreshlayout:swiperefreshlayout:$swipeRefreshLayoutVersion"
- val roomKtx: String
- get() = "androidx.room:room-ktx:${Version.room}"
+ val viewPager2: String
+ get() = "androidx.viewpager2:viewpager2:$viewPager2Version"
- val runner: String
- get() = "androidx.test:runner:${Version.runner}"
+ val work: String
+ get() = "androidx.work:work-runtime-ktx:$workVersion"
+ }
- val startup: String
- get() = "androidx.startup:startup-runtime:${Version.startup}"
+ object Airbnb {
+ val lottie: String
+ get() = "com.airbnb.android:lottie:$lottieVersion"
+ }
- val swipeRefreshLayout: String
- get() = "androidx.swiperefreshlayout:swiperefreshlayout:${Version.swipeRefreshLayout}"
+ object Apollo {
+ val apolloKotlin: String
+ get() = "com.apollographql.apollo:apollo-runtime-kotlin:$apolloVersion"
+ }
- val viewPager2: String
- get() = "androidx.viewpager2:viewpager2:${Version.viewPager2}"
+ object Google {
+ val autoService: String
+ get() = "com.google.auto.service:auto-service:$autoServiceVersion"
- val work: String
- get() = "androidx.work:work-runtime-ktx:${Version.work}"
+ val dagger: String
+ get() = "com.google.dagger:hilt-android:$daggerVersion"
- // Airbnb
- val lottie: String
- get() = "com.airbnb.android:lottie:${Version.lottie}"
+ val daggerCompiler: String
+ get() = "com.google.dagger:hilt-android-compiler:$daggerVersion"
- // Apollo
- val apollo: String
- get() = "com.apollographql.apollo:apollo-runtime:${Version.apollo}"
+ val daggerTesting: String
+ get() = "com.google.dagger:hilt-android-testing:$daggerVersion"
- val apolloCoroutines: String
- get() = "com.apollographql.apollo:apollo-coroutines-support:${Version.apollo}"
+ val firebaseAnalytics: String
+ get() = "com.google.firebase:firebase-analytics-ktx"
- // Google
- val autoService: String
- get() = "com.google.auto.service:auto-service:${Version.autoService}"
+ val firebaseBom: String
+ get() = "com.google.firebase:firebase-bom:$firebaseBomVersion"
- val analytics: String
- get() = "com.google.firebase:firebase-analytics-ktx"
+ val firebaseCrashlytics: String
+ get() = "com.google.firebase:firebase-crashlytics-ktx"
- val crashlytics: String
- get() = "com.google.firebase:firebase-crashlytics-ktx"
+ val material: String
+ get() = "com.google.android.material:material:$materialVersion"
- val dagger: String
- get() = "com.google.dagger:hilt-android:${Version.dagger}"
+ val truth: String
+ get() = "com.google.truth:truth:$truthVersion"
+ }
- val daggerCompiler: String
- get() = "com.google.dagger:hilt-android-compiler:${Version.dagger}"
+ object JavaX {
+ val annotation: String
+ get() = "javax.annotation:javax.annotation-api:$annotationVersion"
- val daggerTesting: String
- get() = "com.google.dagger:hilt-android-testing:${Version.dagger}"
+ val inject: String
+ get() = "javax.inject:javax.inject:$injectVersion"
+ }
- val firebaseBom: String
- get() = "com.google.firebase:firebase-bom:${Version.firebaseBom}"
+ object KotlinX {
+ val coroutines: String
+ get() = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
- val material: String
- get() = "com.google.android.material:material:${Version.material}"
+ val coroutinesAndroid: String
+ get() = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
- val truth: String
- get() = "com.google.truth:truth:${Version.truth}"
+ val coroutinesTest: String
+ get() = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
- // JavaX
- val inject: String
- get() = "javax.inject:javax.inject:${Version.inject}"
+ val dateTime: String
+ get() = "org.jetbrains.kotlinx:kotlinx-datetime:$dateTimeVersion"
- // KotlinX
- val coroutines: String
- get() = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Version.coroutines}"
+ val serialization: String
+ get() = "org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion"
+ }
- val coroutinesTest: String
- get() = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Version.coroutines}"
+ object Square {
+ val javaPoet: String
+ get() = "com.squareup:javapoet:$javaPoetVersion"
- // Square
- val javaPoet: String
- get() = "com.squareup:javapoet:${Version.javaPoet}"
+ val leakCanary: String
+ get() = "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
- val leakCanary: String
- get() = "com.squareup.leakcanary:leakcanary-android:${Version.leakCanary}"
+ val sqlDelightAndroidDriver: String
+ get() = "com.squareup.sqldelight:android-driver:$sqlDelightVersion"
- val okhttp3Logging: String
- get() = "com.squareup.okhttp3:logging-interceptor:${Version.okhttp3Logging}"
+ val sqlDelightCoroutines: String
+ get() = "com.squareup.sqldelight:coroutines-extensions:$sqlDelightVersion"
+ }
}
diff --git a/buildSrc/buildSrc/src/main/kotlin/Plugin.kt b/buildSrc/buildSrc/src/main/kotlin/Plugin.kt
index 44e69bd..d372045 100644
--- a/buildSrc/buildSrc/src/main/kotlin/Plugin.kt
+++ b/buildSrc/buildSrc/src/main/kotlin/Plugin.kt
@@ -1,26 +1,48 @@
+import Version.Android.gradle as androidGradleVersion
+import Version.Apollo.apollo as apolloVersion
+import Version.Google.dagger as daggerVersion
+import Version.Google.firebaseCrashlytics as firebaseCrashlyticsVersion
+import Version.Google.gms as gmsVersion
+import Version.KotlinX.kotlin as kotlinVersion
+import Version.Square.sqlDelight as sqlDelightVersion
+
/**
* Created by ErickSumargo on 15/04/21.
*/
object Plugin {
- // Apollo
- val apollo: String
- get() = "com.apollographql.apollo:apollo-gradle-plugin:${Version.apollo}"
- // Google
- val crashlytics: String
- get() = "com.google.firebase:firebase-crashlytics-gradle:${Version.crashlytics}"
+ object Android {
+ val gradle: String
+ get() = "com.android.tools.build:gradle:$androidGradleVersion"
+ }
+
+ object Apollo {
+ val apollo: String
+ get() = "com.apollographql.apollo:apollo-gradle-plugin:$apolloVersion"
+ }
+
+ object Google {
+ val firebaseCrashlytics: String
+ get() = "com.google.firebase:firebase-crashlytics-gradle:$firebaseCrashlyticsVersion"
+
+ val dagger: String
+ get() = "com.google.dagger:hilt-android-gradle-plugin:$daggerVersion"
- val dagger: String
- get() = "com.google.dagger:hilt-android-gradle-plugin:${Version.dagger}"
+ val gms: String
+ get() = "com.google.gms:google-services:$gmsVersion"
+ }
- val gms: String
- get() = "com.google.gms:google-services:${Version.gms}"
+ object KotlinX {
+ val kotlin: String
+ get() = "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
- val gradle: String
- get() = "com.android.tools.build:gradle:${Version.gradle}"
+ val serialization: String
+ get() = "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
+ }
- // KotlinX
- val kotlin: String
- get() = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Version.kotlin}"
+ object Square {
+ val sqlDelight: String
+ get() = "com.squareup.sqldelight:gradle-plugin:$sqlDelightVersion"
+ }
}
diff --git a/buildSrc/buildSrc/src/main/kotlin/Version.kt b/buildSrc/buildSrc/src/main/kotlin/Version.kt
index eaa6123..d168dd1 100644
--- a/buildSrc/buildSrc/src/main/kotlin/Version.kt
+++ b/buildSrc/buildSrc/src/main/kotlin/Version.kt
@@ -3,76 +3,90 @@
*/
object Version {
- // AndroidX
- const val appCompat: String = "1.1.0"
- const val archTesting: String = "2.1.0"
+ object Android {
+ const val gradle: String = "4.1.1"
+ }
- const val constraintLayout: String = "2.1.0-alpha2"
+ object AndroidX {
+ const val appCompat: String = "1.1.0"
- const val dataStore: String = "1.0.0-alpha08"
+ const val archTesting: String = "2.1.0"
- const val espresso: String = "3.1.0"
+ const val constraintLayout: String = "2.1.0-alpha2"
- const val fragment: String = "1.2.5"
+ const val dataStore: String = "1.0.0-alpha08"
- const val hilt: String = "1.0.0-alpha03"
+ const val espresso: String = "3.1.0"
- const val lifecycle: String = "2.4.0-alpha01"
+ const val fragment: String = "1.2.5"
- const val navigation: String = "2.3.0"
+ const val hilt: String = "1.0.0-alpha03"
- const val recyclerView: String = "1.2.0-beta01"
+ const val lifecycle: String = "2.4.0-alpha01"
- const val room: String = "2.2.5"
+ const val navigation: String = "2.3.0"
- const val runner: String = "1.1.0"
+ const val recyclerView: String = "1.2.0-beta01"
- const val startup: String = "1.0.0"
+ const val runner: String = "1.1.0"
- const val swipeRefreshLayout: String = "1.2.0-alpha01"
+ const val startup: String = "1.0.0"
- const val viewPager2: String = "1.1.0-alpha01"
+ const val swipeRefreshLayout: String = "1.2.0-alpha01"
- const val work: String = "2.5.0"
+ const val viewPager2: String = "1.1.0-alpha01"
- // Airbnb
- const val lottie: String = "3.6.0"
+ const val work: String = "2.5.0"
+ }
- // Apollo
- const val apollo: String = "2.4.5"
+ object Airbnb {
+ const val lottie: String = "3.6.0"
+ }
- // Google
- const val autoService: String = "1.0-rc7"
+ object Apollo {
+ const val apollo: String = "2.4.5"
+ }
- const val crashlytics: String = "2.5.0"
+ object Google {
+ const val autoService: String = "1.0-rc7"
- const val dagger: String = "2.31-alpha"
+ const val dagger: String = "2.31-alpha"
- const val firebaseBom: String = "26.5.0"
+ const val firebaseBom: String = "26.5.0"
- const val gms: String = "4.3.5"
+ const val firebaseCrashlytics: String = "2.5.0"
- const val gradle: String = "4.1.1"
+ const val gms: String = "4.3.5"
- const val material: String = "1.2.1"
+ const val material: String = "1.2.1"
- const val secrets: String = "0.6"
+ const val secrets: String = "0.6"
- const val truth: String = "1.1.2"
+ const val truth: String = "1.1.2"
+ }
- // JavaX
- const val inject: String = "1"
+ object JavaX {
+ const val annotation: String = "1.3.2"
- // KotlinX
- const val coroutines: String = "1.4.2"
+ const val inject: String = "1"
+ }
- const val kotlin: String = "1.4.0"
+ object KotlinX {
+ const val coroutines: String = "1.4.1"
- // Square
- const val javaPoet: String = "1.13.0"
+ const val dateTime: String = "0.2.0"
- const val leakCanary: String = "2.5"
+ const val kotlin: String = "1.4.20"
- const val okhttp3Logging: String = "4.9.0"
+ const val serialization: String = "1.0.1"
+ }
+
+ object Square {
+ const val javaPoet: String = "1.13.0"
+
+ const val leakCanary: String = "2.5"
+
+ const val sqlDelight: String = "1.4.4"
+ }
}
diff --git a/buildSrc/src/main/kotlin/plugin/LibraryPlugin.kt b/buildSrc/src/main/kotlin/plugin/LibraryPlugin.kt
deleted file mode 100644
index 960f193..0000000
--- a/buildSrc/src/main/kotlin/plugin/LibraryPlugin.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-package plugin
-
-import Application
-import Library
-import com.android.build.gradle.LibraryExtension
-import org.gradle.api.JavaVersion
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.kotlin.dsl.dependencies
-import org.gradle.kotlin.dsl.withType
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-
-/**
- * Created by ErickSumargo on 15/04/21.
- */
-
-class LibraryPlugin : Plugin {
-
- override fun apply(project: Project) {
- applyPlugins(project)
-
- applyLibraryExtension(project)
-
- importExternalLibs(project)
- }
-
- private fun applyPlugins(project: Project) {
- project.plugins.apply {
- apply("com.android.library")
- apply("dagger.hilt.android.plugin")
- apply("kotlin-android")
- apply("kotlin-kapt")
- }
- }
-
- private fun applyLibraryExtension(project: Project) {
- val extension = project.extensions.getByName("android")
- as? LibraryExtension ?: return
- extension.apply {
- compileSdkVersion(Application.compileSdk)
-
- defaultConfig {
- targetSdkVersion(Application.targetSdk)
- minSdkVersion(Application.minSdk)
-
- consumerProguardFiles("proguard-rules.pro")
- }
-
- buildTypes {
- named("debug") {
- isTestCoverageEnabled = true
- }
- }
-
- sourceSets {
- named("main") {
- java {
- srcDirs("src/main/kotlin")
- }
- }
- }
-
- compileOptions {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
- }
-
- project.tasks.withType().configureEach {
- kotlinOptions {
- freeCompilerArgs = listOf(
- "-Xallow-result-return-type",
- "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
- "-Xopt-in=kotlinx.coroutines.FlowPreview",
- "-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
- )
- jvmTarget = "${JavaVersion.VERSION_1_8}"
- }
- }
-
- lintOptions {
- error("VisibleForTests")
- }
- }
- }
-
- private fun importExternalLibs(project: Project) {
- project.dependencies {
- // Google
- add("implementation", Library.dagger)
-
- add("kapt", Library.daggerCompiler)
-
- // KotlinX
- add("implementation", Library.coroutines)
- }
- }
-}
diff --git a/buildSrc/src/main/kotlin/plugin/ApplicationPlugin.kt b/buildSrc/src/main/kotlin/plugin/android/AppModulePlugin.kt
similarity index 60%
rename from buildSrc/src/main/kotlin/plugin/ApplicationPlugin.kt
rename to buildSrc/src/main/kotlin/plugin/android/AppModulePlugin.kt
index afa98ba..1ee18f2 100644
--- a/buildSrc/src/main/kotlin/plugin/ApplicationPlugin.kt
+++ b/buildSrc/src/main/kotlin/plugin/android/AppModulePlugin.kt
@@ -1,29 +1,23 @@
@file:Suppress("UnstableApiUsage")
-package plugin
+package plugin.android
import Application
-import Library
import com.android.build.gradle.AppExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
-import org.gradle.kotlin.dsl.dependencies
-import org.gradle.kotlin.dsl.project
/**
* Created by ErickSumargo on 15/04/21.
*/
-class ApplicationPlugin : Plugin {
+class AppModulePlugin : Plugin {
override fun apply(project: Project) {
applyPlugins(project)
applyAppExtension(project)
-
- importExternalLibs(project)
- importInternalModules(project)
}
private fun applyPlugins(project: Project) {
@@ -34,6 +28,7 @@ class ApplicationPlugin : Plugin {
apply("dagger.hilt.android.plugin")
apply("kotlin-android")
apply("kotlin-kapt")
+ apply("kotlinx-serialization")
}
}
@@ -111,59 +106,8 @@ class ApplicationPlugin : Plugin {
packagingOptions {
exclude("META-INF/AL2.0")
exclude("META-INF/LGPL2.1")
+ exclude("META-INF/*.kotlin_module")
}
}
}
-
- private fun importExternalLibs(project: Project) {
- project.dependencies {
- // AndroidX
- add("implementation", Library.hiltNavigation)
- add("implementation", Library.hiltWork)
-
- add("kapt", Library.hiltCompiler)
-
- add("implementation", Library.navigationFragment)
- add("implementation", Library.navigationUi)
-
- add("implementation", Library.work)
-
- // Apollo
- add("implementation", Library.apollo)
- add("implementation", Library.apolloCoroutines)
-
- // Google
- add("implementation", Library.dagger)
-
- add("kapt", Library.daggerCompiler)
-
- add("implementation", platform(Library.firebaseBom))
- add("implementation", Library.analytics)
- add("implementation", Library.crashlytics)
-
- // Square
- add("debugImplementation", Library.leakCanary)
-
- add("implementation", Library.okhttp3Logging)
- }
- }
-
- private fun importInternalModules(project: Project) {
- project.dependencies {
- // Domains
- add("implementation", project(":domain_common"))
- add("implementation", project(":domain_home"))
-
- // Features
- add("implementation", project(":feature_home"))
-
- // Libs
- add("implementation", project(":lib_database"))
- add("implementation", project(":lib_preference"))
- add("implementation", project(":lib_presentation"))
- add("implementation", project(":lib_remote"))
- add("implementation", project(":lib_threading"))
- add("implementation", project(":lib_worker"))
- }
- }
}
diff --git a/buildSrc/src/main/kotlin/plugin/FeaturePlugin.kt b/buildSrc/src/main/kotlin/plugin/android/FeatureModulePlugin.kt
similarity index 61%
rename from buildSrc/src/main/kotlin/plugin/FeaturePlugin.kt
rename to buildSrc/src/main/kotlin/plugin/android/FeatureModulePlugin.kt
index 06ac5df..06ef46b 100644
--- a/buildSrc/src/main/kotlin/plugin/FeaturePlugin.kt
+++ b/buildSrc/src/main/kotlin/plugin/android/FeatureModulePlugin.kt
@@ -1,9 +1,19 @@
@file:Suppress("UnstableApiUsage")
-package plugin
+package plugin.android
import Application
-import Library
+import Library.AndroidX.fragment
+import Library.AndroidX.hiltCompiler
+import Library.AndroidX.hiltNavigation
+import Library.AndroidX.hiltWork
+import Library.AndroidX.navigationFragment
+import Library.AndroidX.navigationUi
+import Library.Google.dagger
+import Library.Google.daggerCompiler
+import Library.Google.daggerTesting
+import Library.Google.truth
+import Library.KotlinX.serialization
import com.android.build.gradle.LibraryExtension
import dagger.hilt.android.plugin.HiltExtension
import org.gradle.api.JavaVersion
@@ -15,12 +25,13 @@ import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.plugin.KaptExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+import plugin.test.JacocoTestReportPlugin
/**
* Created by ErickSumargo on 15/04/21.
*/
-class FeaturePlugin : Plugin {
+class FeatureModulePlugin : Plugin {
override fun apply(project: Project) {
applyPlugins(project)
@@ -29,6 +40,8 @@ class FeaturePlugin : Plugin {
applyHiltExtension(project)
applyKaptExtension(project)
+ configureKotlinCompiler(project)
+
importExternalLibs(project)
importInternalModules(project)
}
@@ -39,6 +52,7 @@ class FeaturePlugin : Plugin {
apply("dagger.hilt.android.plugin")
apply("kotlin-android")
apply("kotlin-kapt")
+ apply("kotlinx-serialization")
apply(JacocoTestReportPlugin::class)
}
@@ -57,7 +71,7 @@ class FeaturePlugin : Plugin {
consumerProguardFiles("proguard-rules.pro")
testInstrumentationRunner =
- "${Application.id}.lib.instrumentation.runner.HiltTestRunner"
+ "${Application.id}.library.instrumentation.runner.HiltTestRunner"
}
buildTypes {
@@ -89,18 +103,6 @@ class FeaturePlugin : Plugin {
targetCompatibility = JavaVersion.VERSION_1_8
}
- project.tasks.withType().configureEach {
- kotlinOptions {
- freeCompilerArgs = listOf(
- "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
- "-Xopt-in=kotlinx.coroutines.FlowPreview",
- "-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi",
- "-Xopt-in=kotlin.time.ExperimentalTime"
- )
- jvmTarget = "${JavaVersion.VERSION_1_8}"
- }
- }
-
lintOptions {
isCheckReleaseBuilds = false
@@ -131,42 +133,56 @@ class FeaturePlugin : Plugin {
}
}
+ private fun configureKotlinCompiler(project: Project) {
+ project.tasks.withType {
+ kotlinOptions {
+ freeCompilerArgs += listOf(
+ "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
+ "-Xopt-in=kotlinx.coroutines.FlowPreview",
+ "-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
+ )
+ jvmTarget = "${JavaVersion.VERSION_1_8}"
+ }
+ }
+ }
+
private fun importExternalLibs(project: Project) {
project.dependencies {
// AndroidX
- add("implementation", Library.fragmentKtx)
-
- add("implementation", Library.hiltNavigation)
- add("implementation", Library.hiltWork)
+ add("implementation", fragment)
- add("kapt", Library.hiltCompiler)
+ add("implementation", hiltNavigation)
+ add("implementation", hiltWork)
+ add("kapt", hiltCompiler)
- add("implementation", Library.navigationFragment)
- add("implementation", Library.navigationUi)
+ add("implementation", navigationFragment)
+ add("implementation", navigationUi)
// Google
- add("implementation", Library.dagger)
- add("androidTestImplementation", Library.daggerTesting)
+ add("implementation", dagger)
+ add("androidTestImplementation", daggerTesting)
+ add("kapt", daggerCompiler)
+ add("kaptAndroidTest", daggerCompiler)
- add("kapt", Library.daggerCompiler)
- add("kaptAndroidTest", Library.daggerCompiler)
+ add("androidTestImplementation", truth)
- add("androidTestImplementation", Library.truth)
+ // KotlinX
+ add("implementation", serialization)
}
}
private fun importInternalModules(project: Project) {
project.dependencies {
// Internal
- add("implementation", project(":annotation"))
- add("kapt", project(":processor"))
+ add("implementation", project(":android:annotation"))
+ add("kapt", project(":android:processor"))
- // Lib
- add("implementation", project(":lib_presentation"))
- add("implementation", project(":lib_threading"))
+ // Library
+ add("implementation", project(":android:library:presentation"))
+ add("implementation", project(":android:library:threading"))
- add("androidTestImplementation", project(":lib_instrumentation"))
- add("androidTestImplementation", project(":lib_threading_test"))
+ add("androidTestImplementation", project(":android:library:instrumentation"))
+ add("androidTestImplementation", project(":android:library:threading_test"))
}
}
}
diff --git a/buildSrc/src/main/kotlin/plugin/DomainPlugin.kt b/buildSrc/src/main/kotlin/plugin/android/LibraryModulePlugin.kt
similarity index 65%
rename from buildSrc/src/main/kotlin/plugin/DomainPlugin.kt
rename to buildSrc/src/main/kotlin/plugin/android/LibraryModulePlugin.kt
index 2c09e0e..ecc1c94 100644
--- a/buildSrc/src/main/kotlin/plugin/DomainPlugin.kt
+++ b/buildSrc/src/main/kotlin/plugin/android/LibraryModulePlugin.kt
@@ -1,7 +1,10 @@
-package plugin
+package plugin.android
import Application
-import Library
+import Library.Google.dagger
+import Library.Google.daggerCompiler
+import Library.KotlinX.coroutinesAndroid
+import Library.KotlinX.serialization
import com.android.build.gradle.LibraryExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
@@ -14,13 +17,15 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
* Created by ErickSumargo on 15/04/21.
*/
-class DomainPlugin : Plugin {
+class LibraryModulePlugin : Plugin {
override fun apply(project: Project) {
applyPlugins(project)
applyLibraryExtension(project)
+ configureKotlinCompiler(project)
+
importExternalLibs(project)
}
@@ -30,6 +35,7 @@ class DomainPlugin : Plugin {
apply("dagger.hilt.android.plugin")
apply("kotlin-android")
apply("kotlin-kapt")
+ apply("kotlinx-serialization")
}
}
@@ -65,33 +71,35 @@ class DomainPlugin : Plugin {
targetCompatibility = JavaVersion.VERSION_1_8
}
- project.tasks.withType().configureEach {
- kotlinOptions {
- freeCompilerArgs = listOf(
- "-Xallow-result-return-type",
- "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
- "-Xopt-in=kotlinx.coroutines.FlowPreview",
- "-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
- )
- jvmTarget = "${JavaVersion.VERSION_1_8}"
- }
- }
-
lintOptions {
error("VisibleForTests")
}
}
}
+ private fun configureKotlinCompiler(project: Project) {
+ project.tasks.withType().configureEach {
+ kotlinOptions {
+ freeCompilerArgs += listOf(
+ "-Xallow-result-return-type",
+ "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
+ "-Xopt-in=kotlinx.coroutines.FlowPreview",
+ "-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
+ )
+ jvmTarget = "${JavaVersion.VERSION_1_8}"
+ }
+ }
+ }
+
private fun importExternalLibs(project: Project) {
project.dependencies {
// Google
- add("implementation", Library.dagger)
-
- add("kapt", Library.daggerCompiler)
+ add("implementation", dagger)
+ add("kapt", daggerCompiler)
// KotlinX
- add("implementation", Library.coroutines)
+ add("implementation", coroutinesAndroid)
+ add("implementation", serialization)
}
}
}
diff --git a/buildSrc/src/main/kotlin/plugin/shared/DataModulePlugin.kt b/buildSrc/src/main/kotlin/plugin/shared/DataModulePlugin.kt
new file mode 100644
index 0000000..f68fad8
--- /dev/null
+++ b/buildSrc/src/main/kotlin/plugin/shared/DataModulePlugin.kt
@@ -0,0 +1,7 @@
+package plugin.shared
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+class DataModulePlugin : SharedModulePlugin()
diff --git a/buildSrc/src/main/kotlin/plugin/shared/DomainModulePlugin.kt b/buildSrc/src/main/kotlin/plugin/shared/DomainModulePlugin.kt
new file mode 100644
index 0000000..affe3aa
--- /dev/null
+++ b/buildSrc/src/main/kotlin/plugin/shared/DomainModulePlugin.kt
@@ -0,0 +1,7 @@
+package plugin.shared
+
+/**
+ * Created by ErickSumargo on 15/04/21.
+ */
+
+class DomainModulePlugin : SharedModulePlugin()
diff --git a/buildSrc/src/main/kotlin/plugin/shared/SharedModulePlugin.kt b/buildSrc/src/main/kotlin/plugin/shared/SharedModulePlugin.kt
new file mode 100644
index 0000000..77d4cfb
--- /dev/null
+++ b/buildSrc/src/main/kotlin/plugin/shared/SharedModulePlugin.kt
@@ -0,0 +1,144 @@
+package plugin.shared
+
+import Application
+import Library.Google.dagger
+import Library.Google.daggerCompiler
+import Library.JavaX.annotation
+import Library.KotlinX.coroutines
+import Library.KotlinX.dateTime
+import Library.KotlinX.serialization
+import com.android.build.gradle.LibraryExtension
+import org.gradle.api.JavaVersion
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.kotlin.dsl.get
+import org.gradle.kotlin.dsl.getValue
+import org.gradle.kotlin.dsl.getting
+import org.gradle.kotlin.dsl.invoke
+import org.gradle.kotlin.dsl.withType
+import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+open class SharedModulePlugin : Plugin {
+
+ override fun apply(project: Project) {
+ applyPlugins(project)
+
+ applyKotlinMultiplatformExtension(project)
+ applyAndroidLibraryExtension(project)
+
+ configureKotlinCompiler(project)
+ }
+
+ private fun applyPlugins(project: Project) {
+ project.plugins.apply {
+ apply("kotlin-multiplatform")
+ apply("kotlin-kapt")
+ apply("kotlinx-serialization")
+ apply("com.android.library")
+ apply("dagger.hilt.android.plugin")
+ }
+ }
+
+ private fun applyKotlinMultiplatformExtension(project: Project) {
+ val extension = project.extensions.getByName("kotlin")
+ as? KotlinMultiplatformExtension ?: return
+ extension.apply {
+ android()
+
+ sourceSets {
+ all {
+ languageSettings.apply {
+ enableLanguageFeature("InlineClasses")
+ enableLanguageFeature("AllowResultInReturnType")
+
+ useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
+ useExperimentalAnnotation("kotlinx.coroutines.FlowPreview")
+ useExperimentalAnnotation("kotlinx.coroutines.InternalCoroutinesApi")
+ }
+ }
+
+ val commonMain by getting {
+ dependencies {
+ // KotlinX
+ implementation(coroutines)
+ implementation(dateTime)
+ implementation(serialization)
+ }
+ }
+
+ val androidMain by getting {
+ dependencies {
+ // Google
+ implementation(dagger)
+
+ project.configurations["kapt"].dependencies.add(
+ project.dependencies.create(daggerCompiler)
+ )
+
+ // JavaX
+ compileOnly(annotation)
+ }
+ }
+ }
+ }
+ }
+
+ private fun applyAndroidLibraryExtension(project: Project) {
+ val extension = project.extensions.getByName("android")
+ as? LibraryExtension ?: return
+ extension.apply {
+ compileSdkVersion(Application.compileSdk)
+
+ defaultConfig {
+ targetSdkVersion(Application.targetSdk)
+ minSdkVersion(Application.minSdk)
+
+ consumerProguardFiles("proguard-rules.pro")
+ }
+
+ buildTypes {
+ named("debug") {
+ isTestCoverageEnabled = true
+ }
+ }
+
+ sourceSets {
+ named("main") {
+ manifest {
+ srcFile("src/androidMain/AndroidManifest.xml")
+ }
+
+ java {
+ srcDirs("src/androidMain/kotlin")
+ }
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+
+ lintOptions {
+ error("VisibleForTests")
+ }
+
+ packagingOptions {
+ exclude("DebugProbesKt.bin")
+ }
+ }
+ }
+
+ private fun configureKotlinCompiler(project: Project) {
+ project.tasks.withType {
+ kotlinOptions {
+ jvmTarget = "${JavaVersion.VERSION_1_8}"
+ }
+ }
+ }
+}
diff --git a/buildSrc/src/main/kotlin/plugin/JacocoTestReportPlugin.kt b/buildSrc/src/main/kotlin/plugin/test/JacocoTestReportPlugin.kt
similarity index 99%
rename from buildSrc/src/main/kotlin/plugin/JacocoTestReportPlugin.kt
rename to buildSrc/src/main/kotlin/plugin/test/JacocoTestReportPlugin.kt
index c86aa97..ceaec3d 100644
--- a/buildSrc/src/main/kotlin/plugin/JacocoTestReportPlugin.kt
+++ b/buildSrc/src/main/kotlin/plugin/test/JacocoTestReportPlugin.kt
@@ -1,4 +1,4 @@
-package plugin
+package plugin.test
import org.gradle.api.Plugin
import org.gradle.api.Project
diff --git a/libs/lib_database/.gitignore b/data/database/.gitignore
similarity index 100%
rename from libs/lib_database/.gitignore
rename to data/database/.gitignore
diff --git a/data/database/build.gradle.kts b/data/database/build.gradle.kts
new file mode 100644
index 0000000..72b5c56
--- /dev/null
+++ b/data/database/build.gradle.kts
@@ -0,0 +1,37 @@
+import Library.Square.sqlDelightAndroidDriver
+import Library.Square.sqlDelightCoroutines
+
+plugins {
+ id("data")
+ id("com.squareup.sqldelight")
+}
+
+kotlin {
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ // Square
+ implementation(sqlDelightCoroutines)
+ }
+
+ dependencies {
+ // Shared
+ implementation(project(":shared"))
+ }
+ }
+
+ val androidMain by getting {
+ dependencies {
+ // Square
+ implementation(sqlDelightAndroidDriver)
+ }
+ }
+ }
+}
+
+sqldelight {
+ database("DadsDatabase") {
+ packageName = "${Application.id}.data.database"
+ schemaOutputDirectory = file("schemas")
+ }
+}
diff --git a/libs/lib_presentation/consumer-rules.pro b/data/database/consumer-rules.pro
similarity index 100%
rename from libs/lib_presentation/consumer-rules.pro
rename to data/database/consumer-rules.pro
diff --git a/libs/lib_presentation/proguard-rules.pro b/data/database/proguard-rules.pro
similarity index 100%
rename from libs/lib_presentation/proguard-rules.pro
rename to data/database/proguard-rules.pro
diff --git a/data/database/src/androidMain/AndroidManifest.xml b/data/database/src/androidMain/AndroidManifest.xml
new file mode 100644
index 0000000..85b5b4f
--- /dev/null
+++ b/data/database/src/androidMain/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/data/database/src/androidMain/kotlin/com/bael/dads/data/database/di/module/DatabaseModule.kt b/data/database/src/androidMain/kotlin/com/bael/dads/data/database/di/module/DatabaseModule.kt
new file mode 100644
index 0000000..2748fc6
--- /dev/null
+++ b/data/database/src/androidMain/kotlin/com/bael/dads/data/database/di/module/DatabaseModule.kt
@@ -0,0 +1,29 @@
+package com.bael.dads.data.database.di.module
+
+import android.content.Context
+import com.bael.dads.data.database.DadsDatabase
+import com.bael.dads.data.database.constant.Database.name
+import com.bael.dads.data.database.constant.Database.schema
+import com.squareup.sqldelight.android.AndroidSqliteDriver
+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
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+object DatabaseModule {
+
+ @Provides
+ @Singleton
+ fun provideDadsDatabase(@ApplicationContext context: Context): DadsDatabase {
+ val driver = AndroidSqliteDriver(schema, context, name)
+ return DadsDatabase(driver)
+ }
+}
diff --git a/data/database/src/androidMain/kotlin/com/bael/dads/data/database/di/module/repository/RepositoryModule.kt b/data/database/src/androidMain/kotlin/com/bael/dads/data/database/di/module/repository/RepositoryModule.kt
new file mode 100644
index 0000000..082e87e
--- /dev/null
+++ b/data/database/src/androidMain/kotlin/com/bael/dads/data/database/di/module/repository/RepositoryModule.kt
@@ -0,0 +1,33 @@
+package com.bael.dads.data.database.di.module.repository
+
+import com.bael.dads.data.database.DadsDatabase
+import com.bael.dads.data.database.repository.DadJokeRepository
+import com.bael.dads.data.database.repository.DefaultDadJokeRepository
+import com.bael.dads.data.database.repository.DefaultRemoteMetaRepository
+import com.bael.dads.data.database.repository.RemoteMetaRepository
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+
+/**
+ * Created by ErickSumargo on 01/04/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object RepositoryModule {
+
+ @Provides
+ @Singleton
+ fun provideDadJokeRepository(database: DadsDatabase): DadJokeRepository {
+ return DefaultDadJokeRepository(database)
+ }
+
+ @Provides
+ @Singleton
+ fun provideRemoteMetaRepository(database: DadsDatabase): RemoteMetaRepository {
+ return DefaultRemoteMetaRepository(database)
+ }
+}
diff --git a/data/database/src/commonMain/kotlin/com/bael/dads/data/database/constant/Database.kt b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/constant/Database.kt
new file mode 100644
index 0000000..e546d74
--- /dev/null
+++ b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/constant/Database.kt
@@ -0,0 +1,15 @@
+package com.bael.dads.data.database.constant
+
+import com.squareup.sqldelight.db.SqlDriver.Schema
+import com.bael.dads.data.database.DadsDatabase.Companion.Schema as DadsDatabaseSchema
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+internal object Database {
+ const val name: String = "dads.db"
+
+ val schema: Schema
+ get() = DadsDatabaseSchema
+}
diff --git a/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DadJokeRepository.kt b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DadJokeRepository.kt
new file mode 100644
index 0000000..fd3ccb5
--- /dev/null
+++ b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DadJokeRepository.kt
@@ -0,0 +1,31 @@
+package com.bael.dads.data.database.repository
+
+import com.bael.dads.data.database.entity.DadJoke
+import kotlinx.coroutines.flow.Flow
+
+/**
+ * Created by ErickSumargo on 01/04/21.
+ */
+
+interface DadJokeRepository {
+
+ suspend fun insertDadJokes(dadJokes: List)
+
+ suspend fun loadDadJokeFeed(id: Int, limit: Int): List
+
+ suspend fun loadSeenDadJoke(term: String, cursor: Int, limit: Int): List
+
+ suspend fun loadFavoredDadJoke(term: String, cursor: Long, limit: Int): List
+
+ suspend fun loadDadJoke(id: Int): DadJoke?
+
+ suspend fun loadLatestDadJoke(): DadJoke?
+
+ suspend fun observeDadJoke(id: Int): Flow
+
+ suspend fun setDadJokeSeen(id: Int): Int
+
+ suspend fun favorDadJoke(id: Int, favored: Boolean): Int
+
+ suspend fun deleteAllDadJokes(): Int
+}
diff --git a/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DefaultDadJokeRepository.kt b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DefaultDadJokeRepository.kt
new file mode 100644
index 0000000..097bdee
--- /dev/null
+++ b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DefaultDadJokeRepository.kt
@@ -0,0 +1,81 @@
+package com.bael.dads.data.database.repository
+
+import com.bael.dads.data.database.DadsDatabase
+import com.bael.dads.data.database.entity.DadJoke
+import com.bael.dads.shared.time.DateTime.now
+import com.squareup.sqldelight.runtime.coroutines.asFlow
+import com.squareup.sqldelight.runtime.coroutines.mapToOneOrNull
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.filterNotNull
+
+/**
+ * Created by ErickSumargo on 01/04/21.
+ */
+
+internal class DefaultDadJokeRepository(database: DadsDatabase) :
+ DadJokeRepository,
+ DadsDatabase by database {
+
+ override suspend fun insertDadJokes(dadJokes: List) {
+ dadJokeQueries.transaction {
+ dadJokes.forEach { dadJoke ->
+ dadJokeQueries.insertDadJoke(
+ jokeId = dadJoke.jokeId,
+ setup = dadJoke.setup,
+ punchline = dadJoke.punchline,
+ favored = dadJoke.favored,
+ seen = dadJoke.seen,
+ createdAt = now,
+ updatedAt = now
+ )
+ }
+ }
+ }
+
+ override suspend fun loadDadJokeFeed(id: Int, limit: Int): List {
+ return dadJokeQueries.loadDadJokeFeed(id, limit.toLong())
+ .executeAsList()
+ }
+
+ override suspend fun loadSeenDadJoke(term: String, cursor: Int, limit: Int): List {
+ return dadJokeQueries.loadSeenDadJoke(cursor, term, limit.toLong())
+ .executeAsList()
+ }
+
+ override suspend fun loadFavoredDadJoke(term: String, cursor: Long, limit: Int): List {
+ return dadJokeQueries.loadFavoredDadJoke(updatedAt = now, term, limit.toLong())
+ .executeAsList()
+ }
+
+ override suspend fun loadDadJoke(id: Int): DadJoke? {
+ return dadJokeQueries.loadDadJoke(id)
+ .executeAsOneOrNull()
+ }
+
+ override suspend fun loadLatestDadJoke(): DadJoke? {
+ return dadJokeQueries.loadLatestDadJoke()
+ .executeAsOneOrNull()
+ }
+
+ override suspend fun observeDadJoke(id: Int): Flow {
+ return dadJokeQueries.observeDadJoke(id)
+ .asFlow()
+ .mapToOneOrNull()
+ .filterNotNull()
+ }
+
+ override suspend fun setDadJokeSeen(id: Int): Int {
+ dadJokeQueries.setDadJokeSeen(updatedAt = now, id)
+ return 1
+ }
+
+ override suspend fun favorDadJoke(id: Int, favored: Boolean): Int {
+ dadJokeQueries.favorDadJoke(favored, updatedAt = now, id)
+ return 1
+ }
+
+ override suspend fun deleteAllDadJokes(): Int {
+ dadJokeQueries.deleteAllDadJokes()
+ return 1
+ }
+}
diff --git a/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DefaultRemoteMetaRepository.kt b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DefaultRemoteMetaRepository.kt
new file mode 100644
index 0000000..e644f2e
--- /dev/null
+++ b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/DefaultRemoteMetaRepository.kt
@@ -0,0 +1,23 @@
+package com.bael.dads.data.database.repository
+
+import com.bael.dads.data.database.DadsDatabase
+import com.bael.dads.data.database.entity.RemoteMeta
+
+/**
+ * Created by ErickSumargo on 01/04/21.
+ */
+
+internal class DefaultRemoteMetaRepository(database: DadsDatabase) :
+ RemoteMetaRepository,
+ DadsDatabase by database {
+
+ override suspend fun loadRemoteMeta(): RemoteMeta? {
+ return remoteMetaQueries.loadRemoteMeta()
+ .executeAsOneOrNull()
+ }
+
+ override suspend fun insertRemoteMeta(remoteMeta: RemoteMeta): Int {
+ remoteMetaQueries.insertRemoteMeta(cursor = remoteMeta.cursor)
+ return 1
+ }
+}
diff --git a/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/RemoteMetaRepository.kt b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/RemoteMetaRepository.kt
new file mode 100644
index 0000000..ba76752
--- /dev/null
+++ b/data/database/src/commonMain/kotlin/com/bael/dads/data/database/repository/RemoteMetaRepository.kt
@@ -0,0 +1,14 @@
+package com.bael.dads.data.database.repository
+
+import com.bael.dads.data.database.entity.RemoteMeta
+
+/**
+ * Created by ErickSumargo on 01/04/21.
+ */
+
+interface RemoteMetaRepository {
+
+ suspend fun loadRemoteMeta(): RemoteMeta?
+
+ suspend fun insertRemoteMeta(remoteMeta: RemoteMeta): Int
+}
diff --git a/data/database/src/commonMain/sqldelight/com/bael/dads/data/database/entity/DadJoke.sq b/data/database/src/commonMain/sqldelight/com/bael/dads/data/database/entity/DadJoke.sq
new file mode 100644
index 0000000..91fde80
--- /dev/null
+++ b/data/database/src/commonMain/sqldelight/com/bael/dads/data/database/entity/DadJoke.sq
@@ -0,0 +1,41 @@
+CREATE TABLE dadJoke (
+ id INTEGER AS Int PRIMARY KEY AUTOINCREMENT,
+ jokeId TEXT NOT NULL,
+ setup TEXT NOT NULL,
+ punchline TEXT NOT NULL,
+ favored INTEGER AS Boolean NOT NULL,
+ seen INTEGER AS Boolean NOT NULL,
+ createdAt INTEGER NOT NULL,
+ updatedAt INTEGER NOT NULL
+);
+
+insertDadJoke:
+INSERT INTO dadJoke (jokeId, setup, punchline, favored, seen, createdAt, updatedAt)
+VALUES (?, ?, ?, ?, ?, ?, ?);
+
+loadDadJokeFeed:
+SELECT * FROM dadJoke WHERE id > :id AND seen == 0 LIMIT :limit;
+
+loadSeenDadJoke:
+SELECT * FROM dadJoke WHERE id < :cursor AND setup LIKE '%' || :term || '%' AND seen ORDER BY id DESC LIMIT :limit;
+
+loadFavoredDadJoke:
+SELECT * FROM dadJoke WHERE updatedAt < :updatedAt AND setup LIKE '%' || :term || '%' AND favored ORDER BY updatedAt DESC LIMIT :limit;
+
+loadDadJoke:
+SELECT * FROM dadJoke WHERE id = :id;
+
+loadLatestDadJoke:
+SELECT * FROM dadJoke ORDER BY id DESC LIMIT 1;
+
+observeDadJoke:
+SELECT * FROM dadJoke WHERE id = :id;
+
+setDadJokeSeen:
+UPDATE dadJoke SET seen = 1, updatedAt = :updatedAt WHERE id = :id;
+
+favorDadJoke:
+UPDATE dadJoke SET favored = :favored, updatedAt = :updatedAt WHERE id = :id;
+
+deleteAllDadJokes:
+DELETE FROM dadJoke;
diff --git a/data/database/src/commonMain/sqldelight/com/bael/dads/data/database/entity/RemoteMeta.sq b/data/database/src/commonMain/sqldelight/com/bael/dads/data/database/entity/RemoteMeta.sq
new file mode 100644
index 0000000..24e8fe7
--- /dev/null
+++ b/data/database/src/commonMain/sqldelight/com/bael/dads/data/database/entity/RemoteMeta.sq
@@ -0,0 +1,11 @@
+CREATE TABLE remoteMeta (
+ id INTEGER AS Int PRIMARY KEY AUTOINCREMENT,
+ cursor TEXT
+);
+
+loadRemoteMeta:
+SELECT * FROM remoteMeta ORDER BY id DESC LIMIT 1;
+
+insertRemoteMeta:
+INSERT INTO remoteMeta (cursor)
+VALUES (?);
diff --git a/libs/lib_threading/.gitignore b/data/database_test/.gitignore
similarity index 100%
rename from libs/lib_threading/.gitignore
rename to data/database_test/.gitignore
diff --git a/data/database_test/build.gradle.kts b/data/database_test/build.gradle.kts
new file mode 100644
index 0000000..04e4339
--- /dev/null
+++ b/data/database_test/build.gradle.kts
@@ -0,0 +1,27 @@
+import Library.Google.daggerTesting
+import Library.Square.sqlDelightAndroidDriver
+
+plugins {
+ id("data")
+}
+
+kotlin {
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ // Data
+ implementation(project(":data:database"))
+ }
+ }
+
+ val androidMain by getting {
+ dependencies {
+ // Google
+ implementation(daggerTesting)
+
+ // Square
+ implementation(sqlDelightAndroidDriver)
+ }
+ }
+ }
+}
diff --git a/libs/lib_remote/consumer-rules.pro b/data/database_test/consumer-rules.pro
similarity index 100%
rename from libs/lib_remote/consumer-rules.pro
rename to data/database_test/consumer-rules.pro
diff --git a/libs/lib_remote/proguard-rules.pro b/data/database_test/proguard-rules.pro
similarity index 100%
rename from libs/lib_remote/proguard-rules.pro
rename to data/database_test/proguard-rules.pro
diff --git a/data/database_test/src/androidMain/AndroidManifest.xml b/data/database_test/src/androidMain/AndroidManifest.xml
new file mode 100644
index 0000000..cfe0d0e
--- /dev/null
+++ b/data/database_test/src/androidMain/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/data/database_test/src/androidMain/kotlin/com/bael/dads/data/database/test/di/module/DatabaseTestModule.kt b/data/database_test/src/androidMain/kotlin/com/bael/dads/data/database/test/di/module/DatabaseTestModule.kt
new file mode 100644
index 0000000..f700319
--- /dev/null
+++ b/data/database_test/src/androidMain/kotlin/com/bael/dads/data/database/test/di/module/DatabaseTestModule.kt
@@ -0,0 +1,38 @@
+package com.bael.dads.data.database.test.di.module
+
+import android.content.Context
+import com.bael.dads.data.database.DadsDatabase
+import com.bael.dads.data.database.di.module.DatabaseModule
+import com.squareup.sqldelight.android.AndroidSqliteDriver
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.android.qualifiers.ApplicationContext
+import dagger.hilt.components.SingletonComponent
+import dagger.hilt.testing.TestInstallIn
+import javax.inject.Singleton
+import com.bael.dads.data.database.DadsDatabase.Companion.Schema as DadsTestSchema
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+@Module
+@TestInstallIn(
+ components = [SingletonComponent::class],
+ replaces = [DatabaseModule::class]
+)
+internal object DatabaseTestModule {
+
+ /**
+ * SqlDelight current version doesn't support in-memory database for
+ * Android's instrumentation testing requirement.
+ *
+ * Workaround is to create persistent database as production one.
+ */
+ @Provides
+ @Singleton
+ fun provideDadsDatabase(@ApplicationContext context: Context): DadsDatabase {
+ val driver = AndroidSqliteDriver(schema = DadsTestSchema, context, name = "dads_test.db")
+ return DadsDatabase(driver)
+ }
+}
diff --git a/libs/lib_remote/.gitignore b/data/remote/.gitignore
similarity index 100%
rename from libs/lib_remote/.gitignore
rename to data/remote/.gitignore
diff --git a/data/remote/build.gradle.kts b/data/remote/build.gradle.kts
new file mode 100644
index 0000000..107526a
--- /dev/null
+++ b/data/remote/build.gradle.kts
@@ -0,0 +1,39 @@
+import Library.Apollo.apolloKotlin
+
+plugins {
+ id("data")
+ id("com.apollographql.apollo")
+ id("com.google.secrets_gradle_plugin") version Version.Google.secrets
+}
+
+kotlin {
+ sourceSets {
+ all {
+ languageSettings.apply {
+ useExperimentalAnnotation("com.apollographql.apollo.api.ApolloExperimental")
+ }
+ }
+
+ val commonMain by getting {
+ dependencies {
+ // Apollo
+ implementation(apolloKotlin)
+ }
+
+ dependencies {
+ // Shared
+ implementation(project(":shared"))
+ }
+ }
+
+ val androidMain by getting
+ }
+}
+
+apollo {
+ generateKotlinModels.set(true)
+}
+
+secrets {
+ propertiesFileName = "keys.properties"
+}
diff --git a/libs/lib_remote_test/consumer-rules.pro b/data/remote/consumer-rules.pro
similarity index 100%
rename from libs/lib_remote_test/consumer-rules.pro
rename to data/remote/consumer-rules.pro
diff --git a/libs/lib_remote_test/proguard-rules.pro b/data/remote/proguard-rules.pro
similarity index 100%
rename from libs/lib_remote_test/proguard-rules.pro
rename to data/remote/proguard-rules.pro
diff --git a/libs/lib_remote/src/main/AndroidManifest.xml b/data/remote/src/androidMain/AndroidManifest.xml
similarity index 86%
rename from libs/lib_remote/src/main/AndroidManifest.xml
rename to data/remote/src/androidMain/AndroidManifest.xml
index 0ddc159..547ee41 100644
--- a/libs/lib_remote/src/main/AndroidManifest.xml
+++ b/data/remote/src/androidMain/AndroidManifest.xml
@@ -1,6 +1,6 @@
+ package="com.bael.dads.data.remote">
diff --git a/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/client/ApolloClientModule.kt b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/client/ApolloClientModule.kt
new file mode 100644
index 0000000..bb1ab19
--- /dev/null
+++ b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/client/ApolloClientModule.kt
@@ -0,0 +1,38 @@
+package com.bael.dads.data.remote.di.module.client
+
+import com.apollographql.apollo.ApolloClient
+import com.apollographql.apollo.network.http.ApolloHttpNetworkTransport
+import com.bael.dads.data.remote.BuildConfig.JWT
+import com.bael.dads.data.remote.constant.Server.url
+import com.bael.dads.data.remote.interceptor.NetworkInterceptor
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object ApolloClientModule {
+
+ @Provides
+ @Singleton
+ fun provideApolloClient(networkInterceptor: NetworkInterceptor): ApolloClient {
+ return ApolloClient(
+ networkTransport = ApolloHttpNetworkTransport(
+ serverUrl = url,
+ headers = mapOf(
+ "Accept" to "application/json",
+ "Authorization" to "Bearer $JWT"
+ )
+ ),
+ interceptors = listOf(
+ networkInterceptor
+ )
+ )
+ }
+}
diff --git a/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/interceptor/InterceptorModule.kt b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/interceptor/InterceptorModule.kt
new file mode 100644
index 0000000..c6466fb
--- /dev/null
+++ b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/interceptor/InterceptorModule.kt
@@ -0,0 +1,24 @@
+package com.bael.dads.data.remote.di.module.interceptor
+
+import com.bael.dads.data.remote.interceptor.NetworkInterceptor
+import com.bael.dads.data.remote.network.Network
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object InterceptorModule {
+
+ @Provides
+ @Singleton
+ fun provideNetworkInterceptor(network: Network): NetworkInterceptor {
+ return NetworkInterceptor(network)
+ }
+}
diff --git a/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/ListMapperModule.kt b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/ListMapperModule.kt
new file mode 100644
index 0000000..4d8f224
--- /dev/null
+++ b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/ListMapperModule.kt
@@ -0,0 +1,28 @@
+package com.bael.dads.data.remote.di.module.mapper
+
+import com.bael.dads.data.remote.model.DadJoke
+import com.bael.dads.shared.mapper.ListMapper
+import com.bael.dads.shared.mapper.Mapper
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+import com.bael.dads.data.remote.query.DadJokesQuery.Joke as DadJokeQL
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object ListMapperModule {
+
+ @Provides
+ @Singleton
+ fun provideDadJokeListMapper(
+ mapper: Mapper
+ ): ListMapper {
+ return ListMapper(mapper)
+ }
+}
diff --git a/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/MapperModule.kt b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/MapperModule.kt
new file mode 100644
index 0000000..1a9f5f0
--- /dev/null
+++ b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/MapperModule.kt
@@ -0,0 +1,38 @@
+package com.bael.dads.data.remote.di.module.mapper
+
+import com.bael.dads.data.remote.mapper.DadJokeMapper
+import com.bael.dads.data.remote.mapper.DadJokesResponseMapper
+import com.bael.dads.data.remote.model.DadJoke
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.shared.mapper.ListMapper
+import com.bael.dads.shared.mapper.Mapper
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+import com.bael.dads.data.remote.query.DadJokesQuery.Data as DadJokesQueryData
+import com.bael.dads.data.remote.query.DadJokesQuery.Joke as DadJokeQL
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object MapperModule {
+
+ @Provides
+ @Singleton
+ fun provideDadJokeMapper(): Mapper {
+ return DadJokeMapper()
+ }
+
+ @Provides
+ @Singleton
+ fun provideDadJokesResponseMapper(
+ listMapper: ListMapper
+ ): Mapper {
+ return DadJokesResponseMapper(listMapper)
+ }
+}
diff --git a/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/ResultMapperModule.kt b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/ResultMapperModule.kt
new file mode 100644
index 0000000..81353fd
--- /dev/null
+++ b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/mapper/ResultMapperModule.kt
@@ -0,0 +1,38 @@
+package com.bael.dads.data.remote.di.module.mapper
+
+import com.bael.dads.data.remote.model.DadJoke
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.shared.mapper.ResultMapper
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+import com.bael.dads.data.remote.query.DadJokesQuery.Data as DadJokesQueryData
+import com.bael.dads.data.remote.query.DadJokesQuery.Joke as DadJokeQL
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object ResultMapperModule {
+
+ @Provides
+ @Singleton
+ fun provideDadJokeResultMapper(
+ mapper: Mapper
+ ): ResultMapper {
+ return ResultMapper(mapper)
+ }
+
+ @Provides
+ @Singleton
+ fun provideDadJokeResponseResultMapper(
+ mapper: Mapper
+ ): ResultMapper {
+ return ResultMapper(mapper)
+ }
+}
diff --git a/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/service/ServiceModule.kt b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/service/ServiceModule.kt
new file mode 100644
index 0000000..9ee8ad6
--- /dev/null
+++ b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/di/module/service/ServiceModule.kt
@@ -0,0 +1,31 @@
+package com.bael.dads.data.remote.di.module.service
+
+import com.apollographql.apollo.ApolloClient
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.data.remote.service.DadsApolloService
+import com.bael.dads.data.remote.service.DadsService
+import com.bael.dads.shared.mapper.ResultMapper
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+import com.bael.dads.data.remote.query.DadJokesQuery.Data as DadJokesQueryData
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+object ServiceModule {
+
+ @Provides
+ @Singleton
+ fun provideDadsService(
+ client: ApolloClient,
+ mapper: ResultMapper
+ ): DadsService {
+ return DadsApolloService(client, mapper)
+ }
+}
\ No newline at end of file
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/network/DefaultNetwork.kt b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/network/Network.kt
similarity index 85%
rename from libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/network/DefaultNetwork.kt
rename to data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/network/Network.kt
index c01abe1..49bf62c 100644
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/network/DefaultNetwork.kt
+++ b/data/remote/src/androidMain/kotlin/com/bael/dads/data/remote/network/Network.kt
@@ -1,6 +1,6 @@
@file:Suppress("DEPRECATION", "RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
-package com.bael.dads.lib.remote.network
+package com.bael.dads.data.remote.network
import android.content.Context
import android.content.Context.CONNECTIVITY_SERVICE
@@ -16,8 +16,8 @@ import javax.inject.Inject
* Created by ErickSumargo on 01/01/21.
*/
-internal class DefaultNetwork @Inject constructor(@ApplicationContext context: Context) : Network {
- override val isConnected: Boolean
+actual class Network @Inject constructor(@ApplicationContext context: Context) {
+ actual val isConnected: Boolean
get() = isNetworkConnected(TYPE_MOBILE) || isNetworkConnected(TYPE_WIFI)
private val connectivityManager: ConnectivityManager by lazy {
diff --git a/libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote/fragment/DadJokeFragment.graphql b/data/remote/src/commonMain/graphql/com/bael/dads/data/remote/fragment/DadJokeFragment.graphql
similarity index 100%
rename from libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote/fragment/DadJokeFragment.graphql
rename to data/remote/src/commonMain/graphql/com/bael/dads/data/remote/fragment/DadJokeFragment.graphql
diff --git a/libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote/query/DadJokesQuery.graphql b/data/remote/src/commonMain/graphql/com/bael/dads/data/remote/query/DadJokesQuery.graphql
similarity index 100%
rename from libs/lib_remote/src/main/graphql/com/bael/dads/lib/remote/query/DadJokesQuery.graphql
rename to data/remote/src/commonMain/graphql/com/bael/dads/data/remote/query/DadJokesQuery.graphql
diff --git a/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/constant/Server.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/constant/Server.kt
new file mode 100644
index 0000000..f9f0506
--- /dev/null
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/constant/Server.kt
@@ -0,0 +1,9 @@
+package com.bael.dads.data.remote.constant
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+internal object Server {
+ const val url: String = "https://dads-engine.herokuapp.com/"
+}
diff --git a/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/interceptor/NetworkInterceptor.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/interceptor/NetworkInterceptor.kt
new file mode 100644
index 0000000..f3a27f8
--- /dev/null
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/interceptor/NetworkInterceptor.kt
@@ -0,0 +1,25 @@
+package com.bael.dads.data.remote.interceptor
+
+import com.apollographql.apollo.api.Operation
+import com.apollographql.apollo.interceptor.ApolloInterceptorChain
+import com.apollographql.apollo.interceptor.ApolloRequest
+import com.apollographql.apollo.interceptor.ApolloRequestInterceptor
+import com.apollographql.apollo.interceptor.ApolloResponse
+import com.bael.dads.data.remote.network.Network
+import com.bael.dads.shared.exception.NoNetworkException
+import kotlinx.coroutines.flow.Flow
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+internal class NetworkInterceptor(private val network: Network) : ApolloRequestInterceptor {
+
+ override fun intercept(
+ request: ApolloRequest,
+ chain: ApolloInterceptorChain
+ ): Flow> {
+ if (!network.isConnected) throw NoNetworkException()
+ return chain.proceed(request)
+ }
+}
diff --git a/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/mapper/DadJokeMapper.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/mapper/DadJokeMapper.kt
new file mode 100644
index 0000000..92f17e9
--- /dev/null
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/mapper/DadJokeMapper.kt
@@ -0,0 +1,22 @@
+package com.bael.dads.data.remote.mapper
+
+import com.bael.dads.data.remote.model.DadJoke
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.data.remote.query.DadJokesQuery.Joke as DadJokeQL
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+internal class DadJokeMapper : Mapper {
+
+ override fun map(data: DadJokeQL): DadJoke {
+ return data.fragments.dadJokeFragment.let { fragment ->
+ DadJoke(
+ id = fragment.id,
+ setup = fragment.setup,
+ punchline = fragment.punchline
+ )
+ }
+ }
+}
diff --git a/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/mapper/DadJokesResponseMapper.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/mapper/DadJokesResponseMapper.kt
new file mode 100644
index 0000000..8590baf
--- /dev/null
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/mapper/DadJokesResponseMapper.kt
@@ -0,0 +1,24 @@
+package com.bael.dads.data.remote.mapper
+
+import com.bael.dads.data.remote.model.DadJoke
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.shared.mapper.ListMapper
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.data.remote.query.DadJokesQuery.Data as DadJokesQueryData
+import com.bael.dads.data.remote.query.DadJokesQuery.Joke as DadJokeQL
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+internal class DadJokesResponseMapper(
+ private val dadJokesMapper: ListMapper,
+) : Mapper {
+
+ override fun map(data: DadJokesQueryData): DadJokesResponse {
+ return DadJokesResponse(
+ dadJokes = dadJokesMapper.map(data.dadJokes.jokes),
+ cursor = data.dadJokes.cursor
+ )
+ }
+}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/model/DadJoke.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/model/DadJoke.kt
similarity index 77%
rename from libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/model/DadJoke.kt
rename to data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/model/DadJoke.kt
index da5f357..c7fdcfd 100644
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/model/DadJoke.kt
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/model/DadJoke.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.lib.remote.model
+package com.bael.dads.data.remote.model
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/network/Network.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/network/Network.kt
similarity index 55%
rename from libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/network/Network.kt
rename to data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/network/Network.kt
index bcb401e..e296d5f 100644
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/network/Network.kt
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/network/Network.kt
@@ -1,9 +1,9 @@
-package com.bael.dads.lib.remote.network
+package com.bael.dads.data.remote.network
/**
* Created by ErickSumargo on 01/01/21.
*/
-interface Network {
+expect class Network {
val isConnected: Boolean
}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/response/DadJokesResponse.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/response/DadJokesResponse.kt
similarity index 60%
rename from libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/response/DadJokesResponse.kt
rename to data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/response/DadJokesResponse.kt
index 0c58582..199ba6c 100644
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/response/DadJokesResponse.kt
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/response/DadJokesResponse.kt
@@ -1,6 +1,6 @@
-package com.bael.dads.lib.remote.response
+package com.bael.dads.data.remote.response
-import com.bael.dads.lib.remote.model.DadJoke
+import com.bael.dads.data.remote.model.DadJoke
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/BaseApolloService.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/BaseApolloService.kt
new file mode 100644
index 0000000..ae44a3c
--- /dev/null
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/BaseApolloService.kt
@@ -0,0 +1,24 @@
+package com.bael.dads.data.remote.service
+
+import com.apollographql.apollo.ApolloClient
+import com.apollographql.apollo.api.Operation.Data
+import com.apollographql.apollo.api.Operation.Variables
+import com.apollographql.apollo.api.Query
+import kotlinx.coroutines.flow.first
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+internal abstract class BaseApolloService(private val client: ApolloClient) {
+
+ protected suspend fun query(script: Query): Result {
+ return runCatching {
+ val response = client.query(script).execute().first()
+ if (response.hasErrors()) {
+ throw Exception(response.errors!![0].message)
+ }
+ response.data!!
+ }
+ }
+}
diff --git a/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/DadsApolloService.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/DadsApolloService.kt
new file mode 100644
index 0000000..a19edea
--- /dev/null
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/DadsApolloService.kt
@@ -0,0 +1,28 @@
+package com.bael.dads.data.remote.service
+
+import com.apollographql.apollo.ApolloClient
+import com.apollographql.apollo.api.Input.Companion.fromNullable
+import com.bael.dads.data.remote.query.DadJokesQuery
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.shared.mapper.ResultMapper
+import com.bael.dads.data.remote.query.DadJokesQuery.Data as DadJokesQueryData
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+internal class DadsApolloService(
+ client: ApolloClient,
+ private val mapper: ResultMapper
+) : BaseApolloService(client),
+ DadsService {
+
+ override suspend fun fetchDadJokes(cursor: String?, limit: Int): Result {
+ return query(
+ script = DadJokesQuery(
+ cursor = fromNullable(cursor),
+ limit = fromNullable(limit)
+ )
+ ).let(mapper::map)
+ }
+}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/DadsService.kt b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/DadsService.kt
similarity index 61%
rename from libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/DadsService.kt
rename to data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/DadsService.kt
index 8cb283b..3de61e1 100644
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/DadsService.kt
+++ b/data/remote/src/commonMain/kotlin/com/bael/dads/data/remote/service/DadsService.kt
@@ -1,6 +1,6 @@
-package com.bael.dads.lib.remote.service
+package com.bael.dads.data.remote.service
-import com.bael.dads.lib.remote.response.DadJokesResponse
+import com.bael.dads.data.remote.response.DadJokesResponse
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_threading_test/.gitignore b/data/remote_test/.gitignore
similarity index 100%
rename from libs/lib_threading_test/.gitignore
rename to data/remote_test/.gitignore
diff --git a/data/remote_test/build.gradle.kts b/data/remote_test/build.gradle.kts
new file mode 100644
index 0000000..b8ec740
--- /dev/null
+++ b/data/remote_test/build.gradle.kts
@@ -0,0 +1,26 @@
+import Library.Google.daggerTesting
+
+plugins {
+ id("data")
+}
+
+kotlin {
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ // Shared
+ implementation(project(":shared"))
+
+ // Data
+ implementation(project(":data:remote"))
+ }
+ }
+
+ val androidMain by getting {
+ dependencies {
+ // Google
+ implementation(daggerTesting)
+ }
+ }
+ }
+}
diff --git a/libs/lib_threading/consumer-rules.pro b/data/remote_test/consumer-rules.pro
similarity index 100%
rename from libs/lib_threading/consumer-rules.pro
rename to data/remote_test/consumer-rules.pro
diff --git a/libs/lib_threading/proguard-rules.pro b/data/remote_test/proguard-rules.pro
similarity index 100%
rename from libs/lib_threading/proguard-rules.pro
rename to data/remote_test/proguard-rules.pro
diff --git a/data/remote_test/src/androidMain/AndroidManifest.xml b/data/remote_test/src/androidMain/AndroidManifest.xml
new file mode 100644
index 0000000..59b3b85
--- /dev/null
+++ b/data/remote_test/src/androidMain/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/data/remote_test/src/androidMain/kotlin/com/bael/dads/data/remote/test/di/module/service/ServiceTestModule.kt b/data/remote_test/src/androidMain/kotlin/com/bael/dads/data/remote/test/di/module/service/ServiceTestModule.kt
new file mode 100644
index 0000000..1b04c4a
--- /dev/null
+++ b/data/remote_test/src/androidMain/kotlin/com/bael/dads/data/remote/test/di/module/service/ServiceTestModule.kt
@@ -0,0 +1,38 @@
+@file:Suppress("UNCHECKED_CAST")
+
+package com.bael.dads.data.remote.test.di.module.service
+
+import com.bael.dads.data.remote.di.module.service.ServiceModule
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.data.remote.service.DadsService
+import com.bael.dads.data.remote.test.service.FakeDadsService
+import com.bael.dads.data.remote.test.service.RemoteService
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.components.SingletonComponent
+import dagger.hilt.testing.TestInstallIn
+import javax.inject.Singleton
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+@Module
+@TestInstallIn(
+ components = [SingletonComponent::class],
+ replaces = [ServiceModule::class]
+)
+internal object ServiceTestModule {
+
+ @Provides
+ @Singleton
+ fun provideDadsService(): DadsService {
+ return FakeDadsService()
+ }
+
+ @Provides
+ @Singleton
+ fun provideFakeDadsService(service: DadsService): RemoteService {
+ return service as RemoteService
+ }
+}
diff --git a/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/FakeBaseService.kt b/data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/FakeBaseService.kt
similarity index 67%
rename from libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/FakeBaseService.kt
rename to data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/FakeBaseService.kt
index 9a67f94..49570af 100644
--- a/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/FakeBaseService.kt
+++ b/data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/FakeBaseService.kt
@@ -1,9 +1,8 @@
-package com.bael.dads.lib.remote.test.service
+package com.bael.dads.data.remote.test.service
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Error
-import com.bael.dads.domain.common.response.Response.Success
-import java.io.IOException
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Error
+import com.bael.dads.shared.response.Response.Success
import kotlin.Result.Companion.failure
import kotlin.Result.Companion.success
@@ -21,7 +20,7 @@ internal abstract class FakeBaseService : RemoteService {
return when (val response = responses[count++]) {
is Error -> failure(response.error as Throwable)
is Success -> success(response.data)
- else -> failure(IOException("Connection error"))
+ else -> failure(Exception("Connection error"))
}
}
diff --git a/data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/FakeDadsService.kt b/data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/FakeDadsService.kt
new file mode 100644
index 0000000..bdc3092
--- /dev/null
+++ b/data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/FakeDadsService.kt
@@ -0,0 +1,17 @@
+package com.bael.dads.data.remote.test.service
+
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.data.remote.service.DadsService
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+internal class FakeDadsService :
+ FakeBaseService(),
+ DadsService {
+
+ override suspend fun fetchDadJokes(cursor: String?, limit: Int): Result {
+ return result
+ }
+}
diff --git a/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/RemoteService.kt b/data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/RemoteService.kt
similarity index 58%
rename from libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/RemoteService.kt
rename to data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/RemoteService.kt
index 4d51997..84d2e7a 100644
--- a/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/RemoteService.kt
+++ b/data/remote_test/src/commonMain/kotlin/com/bael/dads/data/remote/test/service/RemoteService.kt
@@ -1,6 +1,6 @@
-package com.bael.dads.lib.remote.test.service
+package com.bael.dads.data.remote.test.service
-import com.bael.dads.domain.common.response.Response
+import com.bael.dads.shared.response.Response
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/libs/lib_worker/.gitignore b/domain/home/.gitignore
similarity index 100%
rename from libs/lib_worker/.gitignore
rename to domain/home/.gitignore
diff --git a/domain/home/build.gradle.kts b/domain/home/build.gradle.kts
new file mode 100644
index 0000000..3cad87e
--- /dev/null
+++ b/domain/home/build.gradle.kts
@@ -0,0 +1,20 @@
+plugins {
+ id("domain")
+}
+
+kotlin {
+ sourceSets {
+ val commonMain by getting {
+ dependencies {
+ // Shared
+ implementation(project(":shared"))
+
+ // Data
+ implementation(project(":data:database"))
+ implementation(project(":data:remote"))
+ }
+ }
+
+ val androidMain by getting
+ }
+}
diff --git a/libs/lib_threading_test/consumer-rules.pro b/domain/home/consumer-rules.pro
similarity index 100%
rename from libs/lib_threading_test/consumer-rules.pro
rename to domain/home/consumer-rules.pro
diff --git a/libs/lib_threading_test/proguard-rules.pro b/domain/home/proguard-rules.pro
similarity index 100%
rename from libs/lib_threading_test/proguard-rules.pro
rename to domain/home/proguard-rules.pro
diff --git a/domains/domain_home/src/main/AndroidManifest.xml b/domain/home/src/androidMain/AndroidManifest.xml
similarity index 100%
rename from domains/domain_home/src/main/AndroidManifest.xml
rename to domain/home/src/androidMain/AndroidManifest.xml
diff --git a/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/mapper/ListMapperModule.kt b/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/mapper/ListMapperModule.kt
new file mode 100644
index 0000000..b85bd4e
--- /dev/null
+++ b/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/mapper/ListMapperModule.kt
@@ -0,0 +1,28 @@
+package com.bael.dads.domain.home.di.module.mapper
+
+import com.bael.dads.shared.mapper.ListMapper
+import com.bael.dads.shared.mapper.Mapper
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.remote.model.DadJoke as DadJokeRemote
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object ListMapperModule {
+
+ @Provides
+ @Singleton
+ fun provideDadJokesRemoteMapper(
+ mapper: Mapper
+ ): ListMapper {
+ return ListMapper(mapper)
+ }
+}
diff --git a/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/mapper/MapperModule.kt b/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/mapper/MapperModule.kt
new file mode 100644
index 0000000..eb8ebdf
--- /dev/null
+++ b/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/mapper/MapperModule.kt
@@ -0,0 +1,43 @@
+package com.bael.dads.domain.home.di.module.mapper
+
+import com.bael.dads.data.database.entity.RemoteMeta
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.domain.home.mapper.DadJokeDBMapper
+import com.bael.dads.domain.home.mapper.DadJokeRemoteMapper
+import com.bael.dads.domain.home.mapper.RemoteMetaMapper
+import com.bael.dads.domain.home.model.DadJoke
+import com.bael.dads.shared.mapper.Mapper
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.remote.model.DadJoke as DadJokeRemote
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object MapperModule {
+
+ @Provides
+ @Singleton
+ fun provideDadJokeRemoteMapper(): Mapper {
+ return DadJokeRemoteMapper()
+ }
+
+ @Provides
+ @Singleton
+ fun provideDadJokeDBMapper(): Mapper {
+ return DadJokeDBMapper()
+ }
+
+ @Provides
+ @Singleton
+ fun provideRemoteMetaMapper(): Mapper {
+ return RemoteMetaMapper()
+ }
+}
diff --git a/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/usecase/UseCaseModule.kt b/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/usecase/UseCaseModule.kt
new file mode 100644
index 0000000..2489078
--- /dev/null
+++ b/domain/home/src/androidMain/kotlin/com/bael/dads/domain/home/di/module/usecase/UseCaseModule.kt
@@ -0,0 +1,108 @@
+package com.bael.dads.domain.home.di.module.usecase
+
+import com.bael.dads.data.database.entity.RemoteMeta
+import com.bael.dads.data.database.repository.DadJokeRepository
+import com.bael.dads.data.database.repository.RemoteMetaRepository
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.data.remote.service.DadsService
+import com.bael.dads.domain.home.interactor.FavorDadJokeInteractor
+import com.bael.dads.domain.home.interactor.LoadDadJokeFeedInteractor
+import com.bael.dads.domain.home.interactor.LoadDadJokeInteractor
+import com.bael.dads.domain.home.interactor.LoadFavoredDadJokeInteractor
+import com.bael.dads.domain.home.interactor.LoadSeenDadJokeInteractor
+import com.bael.dads.domain.home.interactor.ObserveDadJokeInteractor
+import com.bael.dads.domain.home.interactor.SetDadJokeSeenInteractor
+import com.bael.dads.domain.home.model.DadJoke
+import com.bael.dads.domain.home.usecase.FavorDadJokeUseCase
+import com.bael.dads.domain.home.usecase.LoadDadJokeFeedUseCase
+import com.bael.dads.domain.home.usecase.LoadDadJokeUseCase
+import com.bael.dads.domain.home.usecase.LoadFavoredDadJokeUseCase
+import com.bael.dads.domain.home.usecase.LoadSeenDadJokeUseCase
+import com.bael.dads.domain.home.usecase.ObserveDadJokeUseCase
+import com.bael.dads.domain.home.usecase.SetDadJokeSeenUseCase
+import com.bael.dads.shared.mapper.ListMapper
+import com.bael.dads.shared.mapper.Mapper
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.remote.model.DadJoke as DadJokeRemote
+
+/**
+ * Created by ErickSumargo on 01/04/21.
+ */
+
+@Module
+@InstallIn(SingletonComponent::class)
+internal object UseCaseModule {
+
+ @Provides
+ @Singleton
+ fun provideFavorDadJokeUseCase(repository: DadJokeRepository): FavorDadJokeUseCase {
+ return FavorDadJokeInteractor(repository)
+ }
+
+ @Provides
+ @Singleton
+ fun provideLoadDadJokeFeedUseCase(
+ dadJokeRepository: DadJokeRepository,
+ remoteMetaRepository: RemoteMetaRepository,
+ service: DadsService,
+ dadJokeDBMapper: Mapper,
+ dadJokesRemoteMapper: ListMapper,
+ remoteMetaMapper: Mapper
+ ): LoadDadJokeFeedUseCase {
+ return LoadDadJokeFeedInteractor(
+ dadJokeRepository,
+ remoteMetaRepository,
+ service,
+ dadJokeDBMapper,
+ dadJokesRemoteMapper,
+ remoteMetaMapper
+ )
+ }
+
+ @Provides
+ @Singleton
+ fun provideLoadDadJokeUseCase(
+ repository: DadJokeRepository,
+ mapper: Mapper
+ ): LoadDadJokeUseCase {
+ return LoadDadJokeInteractor(repository, mapper)
+ }
+
+ @Provides
+ @Singleton
+ fun provideLoadFavoredDadJokeUseCase(
+ repository: DadJokeRepository,
+ mapper: Mapper
+ ): LoadFavoredDadJokeUseCase {
+ return LoadFavoredDadJokeInteractor(repository, mapper)
+ }
+
+ @Provides
+ @Singleton
+ fun provideLoadSeenDadJokeUseCase(
+ repository: DadJokeRepository,
+ mapper: Mapper
+ ): LoadSeenDadJokeUseCase {
+ return LoadSeenDadJokeInteractor(repository, mapper)
+ }
+
+ @Provides
+ @Singleton
+ fun provideObserveDadJokeUseCase(
+ repository: DadJokeRepository,
+ mapper: Mapper
+ ): ObserveDadJokeUseCase {
+ return ObserveDadJokeInteractor(repository, mapper)
+ }
+
+ @Provides
+ @Singleton
+ fun provideSetDadJokeSeenUseCase(repository: DadJokeRepository): SetDadJokeSeenUseCase {
+ return SetDadJokeSeenInteractor(repository)
+ }
+}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/FavorDadJokeInteractor.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/FavorDadJokeInteractor.kt
similarity index 63%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/FavorDadJokeInteractor.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/FavorDadJokeInteractor.kt
index 1fd664f..2378f40 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/FavorDadJokeInteractor.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/FavorDadJokeInteractor.kt
@@ -1,27 +1,24 @@
package com.bael.dads.domain.home.interactor
+import com.bael.dads.data.database.repository.DadJokeRepository
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.FavorDadJokeUseCase
-import com.bael.dads.lib.database.repository.DadsRepository
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
-import java.lang.System.currentTimeMillis
-import javax.inject.Inject
/**
* Created by ErickSumargo on 01/04/21.
*/
-internal class FavorDadJokeInteractor @Inject constructor(
- private val repository: DadsRepository
+internal class FavorDadJokeInteractor(
+ private val repository: DadJokeRepository
) : FavorDadJokeUseCase {
override fun invoke(dadJoke: DadJoke, favored: Boolean): Flow {
return flow {
val updates = repository.favorDadJoke(
id = dadJoke.id,
- favored = favored,
- updatedAt = currentTimeMillis()
+ favored = favored
)
emit(updates > 0)
}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeFeedInteractor.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeFeedInteractor.kt
similarity index 68%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeFeedInteractor.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeFeedInteractor.kt
index 0e32d53..3100712 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeFeedInteractor.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeFeedInteractor.kt
@@ -1,34 +1,33 @@
package com.bael.dads.domain.home.interactor
-import com.bael.dads.domain.common.mapper.ListMapper
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Empty
-import com.bael.dads.domain.common.response.Response.Error
-import com.bael.dads.domain.common.response.Response.Loading
-import com.bael.dads.domain.common.response.Response.Success
+import com.bael.dads.data.database.entity.RemoteMeta
+import com.bael.dads.data.database.repository.DadJokeRepository
+import com.bael.dads.data.database.repository.RemoteMetaRepository
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.data.remote.service.DadsService
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.LoadDadJokeFeedUseCase
-import com.bael.dads.lib.database.entity.RemoteMeta
-import com.bael.dads.lib.database.repository.DadsRepository
-import com.bael.dads.lib.database.repository.RemoteMetaRepository
-import com.bael.dads.lib.remote.response.DadJokesResponse
-import com.bael.dads.lib.remote.service.DadsService
+import com.bael.dads.shared.mapper.ListMapper
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Empty
+import com.bael.dads.shared.response.Response.Error
+import com.bael.dads.shared.response.Response.Loading
+import com.bael.dads.shared.response.Response.Success
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOf
-import javax.inject.Inject
-import com.bael.dads.lib.database.entity.DadJoke as DadJokeDB
-import com.bael.dads.lib.remote.model.DadJoke as DadJokeRemote
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.remote.model.DadJoke as DadJokeRemote
/**
* Created by ErickSumargo on 01/04/21.
*/
-internal class LoadDadJokeFeedInteractor @Inject constructor(
- private val dadsRepository: DadsRepository,
+internal class LoadDadJokeFeedInteractor(
+ private val dadJokeRepository: DadJokeRepository,
private val remoteMetaRepository: RemoteMetaRepository,
private val service: DadsService,
private val dadJokeDBMapper: Mapper,
@@ -56,7 +55,7 @@ internal class LoadDadJokeFeedInteractor @Inject constructor(
}
private suspend fun loadDadJokeFeedDB(cursor: DadJoke?, limit: Int): List {
- return dadsRepository.loadDadJokeFeed(id = cursor?.id ?: 0, limit)
+ return dadJokeRepository.loadDadJokeFeed(id = cursor?.id ?: 0, limit)
.map(dadJokeDBMapper::map)
}
@@ -69,12 +68,12 @@ internal class LoadDadJokeFeedInteractor @Inject constructor(
limit = 20
).fold(
onSuccess = { response ->
- dadsRepository.insertDadJokes(
+ dadJokeRepository.insertDadJokes(
dadJokes = dadJokesRemoteMapper.map(response.dadJokes)
)
remoteMetaRepository.insertRemoteMeta(
- meta = remoteMetaMapper.map(response)
+ remoteMeta = remoteMetaMapper.map(response)
)
val dadJokes = loadDadJokeFeedDB(cursor, limit)
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeInteractor.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeInteractor.kt
similarity index 58%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeInteractor.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeInteractor.kt
index 8743911..eeb0e37 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeInteractor.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadDadJokeInteractor.kt
@@ -1,23 +1,22 @@
package com.bael.dads.domain.home.interactor
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Loading
-import com.bael.dads.domain.common.response.Response.Success
+import com.bael.dads.data.database.repository.DadJokeRepository
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.LoadDadJokeUseCase
-import com.bael.dads.lib.database.repository.DadsRepository
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Loading
+import com.bael.dads.shared.response.Response.Success
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
-import javax.inject.Inject
-import com.bael.dads.lib.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
/**
* Created by ErickSumargo on 01/04/21.
*/
-internal class LoadDadJokeInteractor @Inject constructor(
- private val repository: DadsRepository,
+internal class LoadDadJokeInteractor(
+ private val repository: DadJokeRepository,
private val mapper: Mapper
) : LoadDadJokeUseCase {
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadFavoredDadJokeInteractor.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadFavoredDadJokeInteractor.kt
similarity index 54%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadFavoredDadJokeInteractor.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadFavoredDadJokeInteractor.kt
index 5fc6305..bd9338a 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadFavoredDadJokeInteractor.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadFavoredDadJokeInteractor.kt
@@ -1,24 +1,24 @@
package com.bael.dads.domain.home.interactor
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Empty
-import com.bael.dads.domain.common.response.Response.Loading
-import com.bael.dads.domain.common.response.Response.Success
+import com.bael.dads.data.database.repository.DadJokeRepository
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.LoadFavoredDadJokeUseCase
-import com.bael.dads.lib.database.repository.DadsRepository
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Empty
+import com.bael.dads.shared.response.Response.Loading
+import com.bael.dads.shared.response.Response.Success
+import com.bael.dads.shared.time.DateTime.now
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
-import javax.inject.Inject
-import com.bael.dads.lib.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
/**
* Created by ErickSumargo on 01/04/21.
*/
-internal class LoadFavoredDadJokeInteractor @Inject constructor(
- private val repository: DadsRepository,
+internal class LoadFavoredDadJokeInteractor(
+ private val repository: DadJokeRepository,
private val mapper: Mapper
) : LoadFavoredDadJokeUseCase {
@@ -40,10 +40,7 @@ internal class LoadFavoredDadJokeInteractor @Inject constructor(
cursor: DadJoke?,
limit: Int
): List {
- return repository.loadFavoredDadJoke(
- term = term,
- updatedAt = cursor?.updatedAt ?: System.currentTimeMillis(),
- limit = limit
- ).map(mapper::map)
+ return repository.loadFavoredDadJoke(term, cursor = cursor?.updatedAt ?: now, limit)
+ .map(mapper::map)
}
}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadSeenDadJokeInteractor.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadSeenDadJokeInteractor.kt
similarity index 66%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadSeenDadJokeInteractor.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadSeenDadJokeInteractor.kt
index 80be7c0..d805fab 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/LoadSeenDadJokeInteractor.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/LoadSeenDadJokeInteractor.kt
@@ -1,24 +1,23 @@
package com.bael.dads.domain.home.interactor
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Empty
-import com.bael.dads.domain.common.response.Response.Loading
-import com.bael.dads.domain.common.response.Response.Success
+import com.bael.dads.data.database.repository.DadJokeRepository
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.LoadSeenDadJokeUseCase
-import com.bael.dads.lib.database.repository.DadsRepository
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Empty
+import com.bael.dads.shared.response.Response.Loading
+import com.bael.dads.shared.response.Response.Success
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
-import javax.inject.Inject
-import com.bael.dads.lib.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
/**
* Created by ErickSumargo on 01/04/21.
*/
-internal class LoadSeenDadJokeInteractor @Inject constructor(
- private val repository: DadsRepository,
+internal class LoadSeenDadJokeInteractor(
+ private val repository: DadJokeRepository,
private val mapper: Mapper
) : LoadSeenDadJokeUseCase {
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/ObserveDadJokeInteractor.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/ObserveDadJokeInteractor.kt
similarity index 51%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/ObserveDadJokeInteractor.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/ObserveDadJokeInteractor.kt
index d2428c2..4992085 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/ObserveDadJokeInteractor.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/ObserveDadJokeInteractor.kt
@@ -1,30 +1,28 @@
package com.bael.dads.domain.home.interactor
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Success
+import com.bael.dads.data.database.repository.DadJokeRepository
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.ObserveDadJokeUseCase
-import com.bael.dads.lib.database.repository.DadsRepository
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Success
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.map
-import javax.inject.Inject
-import com.bael.dads.lib.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
/**
* Created by ErickSumargo on 01/04/21.
*/
-internal class ObserveDadJokeInteractor @Inject constructor(
- private val repository: DadsRepository,
+internal class ObserveDadJokeInteractor(
+ private val repository: DadJokeRepository,
private val mapper: Mapper
) : ObserveDadJokeUseCase {
- override fun invoke(dadJoke: DadJoke): Flow> {
- return repository
- .observeDadJoke(id = dadJoke.id)
+ override suspend fun invoke(dadJoke: DadJoke): Flow> {
+ return repository.observeDadJoke(id = dadJoke.id)
.filterNotNull()
.map(mapper::map)
.distinctUntilChanged()
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/SetDadJokeSeenInteractor.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/SetDadJokeSeenInteractor.kt
similarity index 55%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/SetDadJokeSeenInteractor.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/SetDadJokeSeenInteractor.kt
index 0af0eaf..8358c91 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/interactor/SetDadJokeSeenInteractor.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/interactor/SetDadJokeSeenInteractor.kt
@@ -1,26 +1,22 @@
package com.bael.dads.domain.home.interactor
+import com.bael.dads.data.database.repository.DadJokeRepository
import com.bael.dads.domain.home.model.DadJoke
import com.bael.dads.domain.home.usecase.SetDadJokeSeenUseCase
-import com.bael.dads.lib.database.repository.DadsRepository
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
-import javax.inject.Inject
/**
* Created by ErickSumargo on 01/04/21.
*/
-internal class SetDadJokeSeenInteractor @Inject constructor(
- private val repository: DadsRepository
+internal class SetDadJokeSeenInteractor(
+ private val repository: DadJokeRepository
) : SetDadJokeSeenUseCase {
override fun invoke(dadJoke: DadJoke): Flow {
return flow {
- val updates = repository.setDadJokeSeen(
- id = dadJoke.id,
- updatedAt = System.currentTimeMillis()
- )
+ val updates = repository.setDadJokeSeen(id = dadJoke.id)
emit(updates > 0)
}
}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/DadJokeDBMapper.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/DadJokeDBMapper.kt
similarity index 66%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/DadJokeDBMapper.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/DadJokeDBMapper.kt
index 8de69ef..b68eda9 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/DadJokeDBMapper.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/DadJokeDBMapper.kt
@@ -1,15 +1,14 @@
package com.bael.dads.domain.home.mapper
-import com.bael.dads.domain.common.mapper.Mapper
import com.bael.dads.domain.home.model.DadJoke
-import javax.inject.Inject
-import com.bael.dads.lib.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
/**
* Created by ErickSumargo on 01/01/21.
*/
-internal class DadJokeDBMapper @Inject constructor() : Mapper {
+internal class DadJokeDBMapper : Mapper {
override fun map(data: DadJokeDB): DadJoke {
return DadJoke(
diff --git a/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/DadJokeRemoteMapper.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/DadJokeRemoteMapper.kt
new file mode 100644
index 0000000..e792357
--- /dev/null
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/DadJokeRemoteMapper.kt
@@ -0,0 +1,26 @@
+package com.bael.dads.domain.home.mapper
+
+import com.bael.dads.shared.mapper.Mapper
+import com.bael.dads.shared.time.DateTime.now
+import com.bael.dads.data.database.entity.DadJoke as DadJokeDB
+import com.bael.dads.data.remote.model.DadJoke as DadJokeRemote
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+internal class DadJokeRemoteMapper : Mapper {
+
+ override fun map(data: DadJokeRemote): DadJokeDB {
+ return DadJokeDB(
+ id = 0,
+ jokeId = data.id,
+ setup = data.setup,
+ punchline = data.punchline,
+ favored = false,
+ seen = false,
+ createdAt = now,
+ updatedAt = now
+ )
+ }
+}
diff --git a/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/RemoteMetaMapper.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/RemoteMetaMapper.kt
new file mode 100644
index 0000000..9ea2311
--- /dev/null
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/mapper/RemoteMetaMapper.kt
@@ -0,0 +1,19 @@
+package com.bael.dads.domain.home.mapper
+
+import com.bael.dads.data.database.entity.RemoteMeta
+import com.bael.dads.data.remote.response.DadJokesResponse
+import com.bael.dads.shared.mapper.Mapper
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+internal class RemoteMetaMapper : Mapper {
+
+ override fun map(data: DadJokesResponse): RemoteMeta {
+ return RemoteMeta(
+ id = 0,
+ cursor = data.cursor
+ )
+ }
+}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/model/DadJoke.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/model/DadJoke.kt
similarity index 81%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/model/DadJoke.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/model/DadJoke.kt
index ed92144..7afc2e0 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/model/DadJoke.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/model/DadJoke.kt
@@ -1,11 +1,12 @@
package com.bael.dads.domain.home.model
-import java.io.Serializable
+import kotlinx.serialization.Serializable
/**
* Created by ErickSumargo on 01/01/21.
*/
+@Serializable
data class DadJoke(
val id: Int,
val setup: String,
@@ -13,4 +14,4 @@ data class DadJoke(
val favored: Boolean,
val seen: Boolean,
val updatedAt: Long
-) : Serializable
+)
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/FavorDadJokeUseCase.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/FavorDadJokeUseCase.kt
similarity index 100%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/FavorDadJokeUseCase.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/FavorDadJokeUseCase.kt
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeFeedUseCase.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeFeedUseCase.kt
similarity index 84%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeFeedUseCase.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeFeedUseCase.kt
index 6eeb369..c2be68e 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeFeedUseCase.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeFeedUseCase.kt
@@ -1,7 +1,7 @@
package com.bael.dads.domain.home.usecase
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
+import com.bael.dads.shared.response.Response
import kotlinx.coroutines.flow.Flow
/**
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeUseCase.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeUseCase.kt
similarity index 83%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeUseCase.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeUseCase.kt
index b41f097..be2bc90 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeUseCase.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadDadJokeUseCase.kt
@@ -1,7 +1,7 @@
package com.bael.dads.domain.home.usecase
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
+import com.bael.dads.shared.response.Response
import kotlinx.coroutines.flow.Flow
/**
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadFavoredDadJokeUseCase.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadFavoredDadJokeUseCase.kt
similarity index 85%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadFavoredDadJokeUseCase.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadFavoredDadJokeUseCase.kt
index 78c2615..2038090 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadFavoredDadJokeUseCase.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadFavoredDadJokeUseCase.kt
@@ -1,7 +1,7 @@
package com.bael.dads.domain.home.usecase
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
+import com.bael.dads.shared.response.Response
import kotlinx.coroutines.flow.Flow
/**
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadSeenDadJokeUseCase.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadSeenDadJokeUseCase.kt
similarity index 85%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadSeenDadJokeUseCase.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadSeenDadJokeUseCase.kt
index d1cb47a..ecce9d3 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/LoadSeenDadJokeUseCase.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/LoadSeenDadJokeUseCase.kt
@@ -1,7 +1,7 @@
package com.bael.dads.domain.home.usecase
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
+import com.bael.dads.shared.response.Response
import kotlinx.coroutines.flow.Flow
/**
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/ObserveDadJokeUseCase.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/ObserveDadJokeUseCase.kt
similarity index 63%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/ObserveDadJokeUseCase.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/ObserveDadJokeUseCase.kt
index 1573c55..b10dcee 100644
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/ObserveDadJokeUseCase.kt
+++ b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/ObserveDadJokeUseCase.kt
@@ -1,7 +1,7 @@
package com.bael.dads.domain.home.usecase
-import com.bael.dads.domain.common.response.Response
import com.bael.dads.domain.home.model.DadJoke
+import com.bael.dads.shared.response.Response
import kotlinx.coroutines.flow.Flow
/**
@@ -10,5 +10,5 @@ import kotlinx.coroutines.flow.Flow
interface ObserveDadJokeUseCase {
- operator fun invoke(dadJoke: DadJoke): Flow>
+ suspend operator fun invoke(dadJoke: DadJoke): Flow>
}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/SetDadJokeSeenUseCase.kt b/domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/SetDadJokeSeenUseCase.kt
similarity index 100%
rename from domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/usecase/SetDadJokeSeenUseCase.kt
rename to domain/home/src/commonMain/kotlin/com/bael/dads/domain/home/usecase/SetDadJokeSeenUseCase.kt
diff --git a/domains/domain_common/build.gradle.kts b/domains/domain_common/build.gradle.kts
deleted file mode 100644
index f063787..0000000
--- a/domains/domain_common/build.gradle.kts
+++ /dev/null
@@ -1,3 +0,0 @@
-plugins {
- id("domain")
-}
diff --git a/domains/domain_common/src/main/AndroidManifest.xml b/domains/domain_common/src/main/AndroidManifest.xml
deleted file mode 100644
index 293c256..0000000
--- a/domains/domain_common/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/exception/NoNetworkException.kt b/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/exception/NoNetworkException.kt
deleted file mode 100644
index 7def2f4..0000000
--- a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/exception/NoNetworkException.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.bael.dads.domain.common.exception
-
-import java.io.IOException
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-class NoNetworkException : IOException()
diff --git a/domains/domain_home/build.gradle.kts b/domains/domain_home/build.gradle.kts
deleted file mode 100644
index 08f0192..0000000
--- a/domains/domain_home/build.gradle.kts
+++ /dev/null
@@ -1,12 +0,0 @@
-plugins {
- id("domain")
-}
-
-dependencies {
- // Domain
- implementation(project(":domain_common"))
-
- // Lib
- implementation(project(":lib_database"))
- implementation(project(":lib_remote"))
-}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/di/module/mapper/MapperModule.kt b/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/di/module/mapper/MapperModule.kt
deleted file mode 100644
index 17ccfe8..0000000
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/di/module/mapper/MapperModule.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.bael.dads.domain.home.di.module.mapper
-
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.domain.home.mapper.DadJokeDBMapper
-import com.bael.dads.domain.home.mapper.DadJokeRemoteMapper
-import com.bael.dads.domain.home.mapper.RemoteMetaMapper
-import com.bael.dads.domain.home.model.DadJoke
-import com.bael.dads.lib.database.entity.RemoteMeta
-import com.bael.dads.lib.remote.response.DadJokesResponse
-import dagger.Binds
-import dagger.Module
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Singleton
-import com.bael.dads.lib.database.entity.DadJoke as DadJokeDB
-import com.bael.dads.lib.remote.model.DadJoke as DadJokeRemote
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-internal interface MapperModule {
-
- @Binds
- @Singleton
- fun bindDadJokeRemoteMapper(mapper: DadJokeRemoteMapper): Mapper
-
- @Binds
- @Singleton
- fun bindDadJokeDBMapper(mapper: DadJokeDBMapper): Mapper
-
- @Binds
- @Singleton
- fun bindRemoteMetaMapper(mapper: RemoteMetaMapper): Mapper
-}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/di/module/usecase/UseCaseModule.kt b/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/di/module/usecase/UseCaseModule.kt
deleted file mode 100644
index 3551d19..0000000
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/di/module/usecase/UseCaseModule.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.bael.dads.domain.home.di.module.usecase
-
-import com.bael.dads.domain.home.interactor.FavorDadJokeInteractor
-import com.bael.dads.domain.home.interactor.LoadDadJokeFeedInteractor
-import com.bael.dads.domain.home.interactor.LoadDadJokeInteractor
-import com.bael.dads.domain.home.interactor.LoadFavoredDadJokeInteractor
-import com.bael.dads.domain.home.interactor.LoadSeenDadJokeInteractor
-import com.bael.dads.domain.home.interactor.ObserveDadJokeInteractor
-import com.bael.dads.domain.home.interactor.SetDadJokeSeenInteractor
-import com.bael.dads.domain.home.usecase.FavorDadJokeUseCase
-import com.bael.dads.domain.home.usecase.LoadDadJokeFeedUseCase
-import com.bael.dads.domain.home.usecase.LoadDadJokeUseCase
-import com.bael.dads.domain.home.usecase.LoadFavoredDadJokeUseCase
-import com.bael.dads.domain.home.usecase.LoadSeenDadJokeUseCase
-import com.bael.dads.domain.home.usecase.ObserveDadJokeUseCase
-import com.bael.dads.domain.home.usecase.SetDadJokeSeenUseCase
-import dagger.Binds
-import dagger.Module
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/04/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-internal interface UseCaseModule {
-
- @Binds
- @Singleton
- fun bindFavorDadJokeUseCase(
- interactor: FavorDadJokeInteractor
- ): FavorDadJokeUseCase
-
- @Binds
- @Singleton
- fun bindLoadDadJokeFeedUseCase(
- interactor: LoadDadJokeFeedInteractor
- ): LoadDadJokeFeedUseCase
-
- @Binds
- @Singleton
- fun bindLoadDadJokeUseCase(
- interactor: LoadDadJokeInteractor
- ): LoadDadJokeUseCase
-
- @Binds
- @Singleton
- fun bindLoadFavoredDadJokeUseCase(
- interactor: LoadFavoredDadJokeInteractor
- ): LoadFavoredDadJokeUseCase
-
- @Binds
- @Singleton
- fun bindLoadSeenDadJokeUseCase(
- interactor: LoadSeenDadJokeInteractor
- ): LoadSeenDadJokeUseCase
-
- @Binds
- @Singleton
- fun bindObserveDadJokeUseCase(
- interactor: ObserveDadJokeInteractor
- ): ObserveDadJokeUseCase
-
- @Binds
- @Singleton
- fun bindSetDadJokeSeenUseCase(
- interactor: SetDadJokeSeenInteractor
- ): SetDadJokeSeenUseCase
-}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/DadJokeRemoteMapper.kt b/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/DadJokeRemoteMapper.kt
deleted file mode 100644
index 3212503..0000000
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/DadJokeRemoteMapper.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.bael.dads.domain.home.mapper
-
-import com.bael.dads.domain.common.mapper.Mapper
-import java.lang.System.currentTimeMillis
-import javax.inject.Inject
-import com.bael.dads.lib.database.entity.DadJoke as DadJokeDB
-import com.bael.dads.lib.remote.model.DadJoke as DadJokeRemote
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-internal class DadJokeRemoteMapper @Inject constructor() : Mapper {
-
- override fun map(data: DadJokeRemote): DadJokeDB {
- return DadJokeDB(
- jokeId = data.id,
- setup = data.setup,
- punchline = data.punchline,
- favored = false,
- seen = false,
- createdAt = currentTimeMillis(),
- updatedAt = currentTimeMillis()
- )
- }
-}
diff --git a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/RemoteMetaMapper.kt b/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/RemoteMetaMapper.kt
deleted file mode 100644
index 35b3ab3..0000000
--- a/domains/domain_home/src/main/kotlin/com/bael/dads/domain/home/mapper/RemoteMetaMapper.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.bael.dads.domain.home.mapper
-
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.lib.database.entity.RemoteMeta
-import com.bael.dads.lib.remote.response.DadJokesResponse
-import javax.inject.Inject
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-internal class RemoteMetaMapper @Inject constructor() : Mapper {
-
- override fun map(data: DadJokesResponse): RemoteMeta {
- return RemoteMeta(cursor = data.cursor)
- }
-}
diff --git a/features/feature_home/build.gradle.kts b/features/feature_home/build.gradle.kts
deleted file mode 100644
index 5ab86d7..0000000
--- a/features/feature_home/build.gradle.kts
+++ /dev/null
@@ -1,30 +0,0 @@
-plugins {
- id("feature")
-}
-
-dependencies {
- // AndroidX
- implementation(Library.constraintLayout)
- implementation(Library.swipeRefreshLayout)
- implementation(Library.viewPager2)
- implementation(Library.work)
-
- // Airbnb
- implementation(Library.lottie)
-}
-
-dependencies {
- // Domain
- implementation(project(":domain_common"))
- implementation(project(":domain_home"))
-
- // Lib
- implementation(project(":lib_preference"))
- implementation(project(":lib_worker"))
-
- androidTestImplementation(project(":lib_database"))
- androidTestImplementation(project(":lib_database_test"))
-
- androidTestImplementation(project(":lib_remote"))
- androidTestImplementation(project(":lib_remote_test"))
-}
diff --git a/libs/lib_database/build.gradle.kts b/libs/lib_database/build.gradle.kts
deleted file mode 100644
index 5d221c7..0000000
--- a/libs/lib_database/build.gradle.kts
+++ /dev/null
@@ -1,25 +0,0 @@
-plugins {
- id("library")
-}
-
-android {
- defaultConfig {
- javaCompileOptions {
- annotationProcessorOptions {
- arguments += mapOf(
- "room.schemaLocation" to "${project.projectDir}/schemas",
- "room.incremental" to "true",
- "room.expandProjection" to "true"
- )
- }
- }
- }
-}
-
-dependencies {
- // AndroidX
- implementation(Library.room)
- implementation(Library.roomKtx)
-
- kapt(Library.roomCompiler)
-}
diff --git a/libs/lib_database/schemas/com.bael.dads.lib.database.DadsRoomDatabase/1.json b/libs/lib_database/schemas/com.bael.dads.lib.database.DadsRoomDatabase/1.json
deleted file mode 100644
index 028435d..0000000
--- a/libs/lib_database/schemas/com.bael.dads.lib.database.DadsRoomDatabase/1.json
+++ /dev/null
@@ -1,102 +0,0 @@
-{
- "formatVersion": 1,
- "database": {
- "version": 1,
- "identityHash": "325b7e06ec9e4a2a88420aac5b841151",
- "entities": [
- {
- "tableName": "dad_joke",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `joke_id` TEXT NOT NULL, `setup` TEXT NOT NULL, `punchline` TEXT NOT NULL, `favored` INTEGER NOT NULL, `seen` INTEGER NOT NULL, `created_at` INTEGER NOT NULL, `updated_at` INTEGER NOT NULL)",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "jokeId",
- "columnName": "joke_id",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "setup",
- "columnName": "setup",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "punchline",
- "columnName": "punchline",
- "affinity": "TEXT",
- "notNull": true
- },
- {
- "fieldPath": "favored",
- "columnName": "favored",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "seen",
- "columnName": "seen",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "createdAt",
- "columnName": "created_at",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "updatedAt",
- "columnName": "updated_at",
- "affinity": "INTEGER",
- "notNull": true
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": true
- },
- "indices": [],
- "foreignKeys": []
- },
- {
- "tableName": "remote_meta",
- "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `cursor` TEXT, PRIMARY KEY(`id`))",
- "fields": [
- {
- "fieldPath": "id",
- "columnName": "id",
- "affinity": "INTEGER",
- "notNull": true
- },
- {
- "fieldPath": "cursor",
- "columnName": "cursor",
- "affinity": "TEXT",
- "notNull": false
- }
- ],
- "primaryKey": {
- "columnNames": [
- "id"
- ],
- "autoGenerate": false
- },
- "indices": [],
- "foreignKeys": []
- }
- ],
- "views": [],
- "setupQueries": [
- "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
- "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '325b7e06ec9e4a2a88420aac5b841151')"
- ]
- }
-}
\ No newline at end of file
diff --git a/libs/lib_database/src/main/AndroidManifest.xml b/libs/lib_database/src/main/AndroidManifest.xml
deleted file mode 100644
index dbd20a3..0000000
--- a/libs/lib_database/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/DadsDatabase.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/DadsDatabase.kt
deleted file mode 100644
index 0636b4f..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/DadsDatabase.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.bael.dads.lib.database
-
-import com.bael.dads.lib.database.dao.DadJokeDao
-import com.bael.dads.lib.database.dao.RemoteMetaDao
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-interface DadsDatabase {
- val dadJoke: DadJokeDao
-
- val remoteMeta: RemoteMetaDao
-
- fun closeConnection()
-}
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/DadsRoomDatabase.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/DadsRoomDatabase.kt
deleted file mode 100644
index f1e36e7..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/DadsRoomDatabase.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.bael.dads.lib.database
-
-import androidx.room.Database
-import androidx.room.RoomDatabase
-import com.bael.dads.lib.database.entity.DadJoke
-import com.bael.dads.lib.database.entity.RemoteMeta
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Database(entities = [DadJoke::class, RemoteMeta::class], version = 1)
-abstract class DadsRoomDatabase : RoomDatabase(), DadsDatabase {
-
- override fun closeConnection() {
- close()
- }
-}
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/dao/DadJokeDao.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/dao/DadJokeDao.kt
deleted file mode 100644
index d40e53c..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/dao/DadJokeDao.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.bael.dads.lib.database.dao
-
-import androidx.room.Dao
-import androidx.room.Insert
-import androidx.room.OnConflictStrategy.REPLACE
-import androidx.room.Query
-import com.bael.dads.lib.database.entity.DadJoke
-import kotlinx.coroutines.flow.Flow
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Dao
-interface DadJokeDao {
-
- @Insert(onConflict = REPLACE)
- suspend fun insertDadJokes(dadJokes: List)
-
- @Query("SELECT * FROM dad_joke WHERE id > :id AND NOT seen LIMIT :limit")
- suspend fun loadDadJokeFeed(id: Int, limit: Int): List
-
- @Query("SELECT * FROM dad_joke WHERE id < :cursor AND setup LIKE '%' || :term || '%' AND seen ORDER BY id DESC LIMIT :limit")
- suspend fun loadSeenDadJoke(term: String, cursor: Int, limit: Int): List
-
- @Query("SELECT * FROM dad_joke WHERE updated_at < :updatedAt AND setup LIKE '%' || :term || '%' AND favored ORDER BY updated_at DESC LIMIT :limit")
- suspend fun loadFavoredDadJoke(term: String, updatedAt: Long, limit: Int): List
-
- @Query("SELECT * FROM dad_joke WHERE id = :id")
- suspend fun loadDadJoke(id: Int): DadJoke?
-
- @Query("SELECT * FROM dad_joke ORDER BY id DESC limit 1")
- suspend fun loadLatestDadJoke(): DadJoke?
-
- @Query("SELECT * FROM dad_joke WHERE id = :id")
- fun observeDadJoke(id: Int): Flow
-
- @Query("UPDATE dad_joke SET seen = 1, updated_at = :updatedAt WHERE id = :id")
- suspend fun setDadJokeSeen(id: Int, updatedAt: Long): Int
-
- @Query("UPDATE dad_joke SET favored = :favored, updated_at = :updatedAt WHERE id = :id")
- suspend fun favorDadJoke(id: Int, favored: Boolean, updatedAt: Long): Int
-}
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/dao/RemoteMetaDao.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/dao/RemoteMetaDao.kt
deleted file mode 100644
index d05a602..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/dao/RemoteMetaDao.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.bael.dads.lib.database.dao
-
-import androidx.room.Dao
-import androidx.room.Insert
-import androidx.room.OnConflictStrategy.REPLACE
-import androidx.room.Query
-import com.bael.dads.lib.database.entity.RemoteMeta
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Dao
-interface RemoteMetaDao {
-
- @Query("SELECT * FROM remote_meta ORDER BY id DESC LIMIT 1")
- suspend fun loadRemoteMeta(): RemoteMeta?
-
- @Insert(onConflict = REPLACE)
- suspend fun insertRemoteMeta(meta: RemoteMeta)
-}
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/module/DatabaseModule.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/module/DatabaseModule.kt
deleted file mode 100644
index 55774b0..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/module/DatabaseModule.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.bael.dads.lib.database.di.module
-
-import android.content.Context
-import androidx.room.Room.databaseBuilder
-import com.bael.dads.lib.database.DadsDatabase
-import com.bael.dads.lib.database.DadsRoomDatabase
-import com.bael.dads.lib.database.di.qualifier.DatabaseNameQualifier
-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
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-object DatabaseModule {
-
- @Provides
- @Singleton
- @DatabaseNameQualifier
- fun provideDatabaseName(): String {
- return "dads.db"
- }
-
- @Provides
- @Singleton
- fun provideDatabase(
- @ApplicationContext context: Context,
- @DatabaseNameQualifier databaseName: String
- ): DadsDatabase {
- return databaseBuilder(context, DadsRoomDatabase::class.java, databaseName)
- .build()
- }
-}
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/module/repository/RepositoryModule.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/module/repository/RepositoryModule.kt
deleted file mode 100644
index 06c825b..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/module/repository/RepositoryModule.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.bael.dads.lib.database.di.module.repository
-
-import com.bael.dads.lib.database.repository.DadsRepository
-import com.bael.dads.lib.database.repository.DefaultDadsRepository
-import com.bael.dads.lib.database.repository.DefaultRemoteMetaRepository
-import com.bael.dads.lib.database.repository.RemoteMetaRepository
-import dagger.Binds
-import dagger.Module
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/04/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-internal interface RepositoryModule {
-
- @Binds
- @Singleton
- fun bindDadsRepository(repository: DefaultDadsRepository): DadsRepository
-
- @Binds
- @Singleton
- fun bindRemoteMetaRepository(repository: DefaultRemoteMetaRepository): RemoteMetaRepository
-}
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/qualifier/DatabaseNameQualifier.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/qualifier/DatabaseNameQualifier.kt
deleted file mode 100644
index e00871b..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/di/qualifier/DatabaseNameQualifier.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.bael.dads.lib.database.di.qualifier
-
-import javax.inject.Qualifier
-import kotlin.annotation.AnnotationRetention.BINARY
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Qualifier
-@Retention(BINARY)
-internal annotation class DatabaseNameQualifier
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/entity/DadJoke.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/entity/DadJoke.kt
deleted file mode 100644
index 604460b..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/entity/DadJoke.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.bael.dads.lib.database.entity
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import java.util.Date
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Entity(tableName = "dad_joke")
-data class DadJoke(
- @PrimaryKey(autoGenerate = true)
- @ColumnInfo(name = "id")
- val id: Int = 0,
- @ColumnInfo(name = "joke_id")
- val jokeId: String,
- @ColumnInfo(name = "setup")
- val setup: String,
- @ColumnInfo(name = "punchline")
- val punchline: String,
- @ColumnInfo(name = "favored")
- val favored: Boolean,
- @ColumnInfo(name = "seen")
- val seen: Boolean,
- @ColumnInfo(name = "created_at")
- val createdAt: Long,
- @ColumnInfo(name = "updated_at")
- val updatedAt: Long
-)
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/entity/RemoteMeta.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/entity/RemoteMeta.kt
deleted file mode 100644
index 011778f..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/entity/RemoteMeta.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.bael.dads.lib.database.entity
-
-import androidx.room.ColumnInfo
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Entity(tableName = "remote_meta")
-data class RemoteMeta(
- @PrimaryKey
- @ColumnInfo(name = "id")
- val id: Int = 1,
- @ColumnInfo(name = "cursor")
- val cursor: String?
-)
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DadsRepository.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DadsRepository.kt
deleted file mode 100644
index 6ba762b..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DadsRepository.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.bael.dads.lib.database.repository
-
-import com.bael.dads.lib.database.entity.DadJoke
-import kotlinx.coroutines.flow.Flow
-
-/**
- * Created by ErickSumargo on 01/04/21.
- */
-
-interface DadsRepository {
-
- suspend fun insertDadJokes(dadJokes: List)
-
- suspend fun loadDadJokeFeed(id: Int, limit: Int): List
-
- suspend fun loadSeenDadJoke(term: String, cursor: Int, limit: Int): List
-
- suspend fun loadFavoredDadJoke(term: String, updatedAt: Long, limit: Int): List
-
- suspend fun loadDadJoke(id: Int): DadJoke?
-
- suspend fun loadLatestDadJoke(): DadJoke?
-
- fun observeDadJoke(id: Int): Flow
-
- suspend fun setDadJokeSeen(id: Int, updatedAt: Long): Int
-
- suspend fun favorDadJoke(id: Int, favored: Boolean, updatedAt: Long): Int
-}
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DefaultDadsRepository.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DefaultDadsRepository.kt
deleted file mode 100644
index b73abfb..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DefaultDadsRepository.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.bael.dads.lib.database.repository
-
-import com.bael.dads.lib.database.DadsDatabase
-import com.bael.dads.lib.database.dao.DadJokeDao
-import javax.inject.Inject
-
-/**
- * Created by ErickSumargo on 01/04/21.
- */
-
-internal class DefaultDadsRepository @Inject constructor(database: DadsDatabase) :
- DadsRepository,
- DadJokeDao by database.dadJoke
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DefaultRemoteMetaRepository.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DefaultRemoteMetaRepository.kt
deleted file mode 100644
index a8839a7..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/DefaultRemoteMetaRepository.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.bael.dads.lib.database.repository
-
-import com.bael.dads.lib.database.DadsDatabase
-import com.bael.dads.lib.database.dao.RemoteMetaDao
-import javax.inject.Inject
-
-/**
- * Created by ErickSumargo on 01/04/21.
- */
-
-internal class DefaultRemoteMetaRepository @Inject constructor(database: DadsDatabase) :
- RemoteMetaRepository,
- RemoteMetaDao by database.remoteMeta
diff --git a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/RemoteMetaRepository.kt b/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/RemoteMetaRepository.kt
deleted file mode 100644
index 8732cff..0000000
--- a/libs/lib_database/src/main/kotlin/com/bael/dads/lib/database/repository/RemoteMetaRepository.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.bael.dads.lib.database.repository
-
-import com.bael.dads.lib.database.entity.RemoteMeta
-
-/**
- * Created by ErickSumargo on 01/04/21.
- */
-
-interface RemoteMetaRepository {
-
- suspend fun loadRemoteMeta(): RemoteMeta?
-
- suspend fun insertRemoteMeta(meta: RemoteMeta)
-}
diff --git a/libs/lib_database_test/build.gradle.kts b/libs/lib_database_test/build.gradle.kts
deleted file mode 100644
index 7d9ca65..0000000
--- a/libs/lib_database_test/build.gradle.kts
+++ /dev/null
@@ -1,16 +0,0 @@
-plugins {
- id("library")
-}
-
-dependencies {
- // AndroidX
- implementation(Library.roomKtx)
-
- // Google
- implementation(Library.daggerTesting)
-}
-
-dependencies {
- // Lib
- implementation(project(":lib_database"))
-}
diff --git a/libs/lib_database_test/src/main/AndroidManifest.xml b/libs/lib_database_test/src/main/AndroidManifest.xml
deleted file mode 100644
index ba1f35f..0000000
--- a/libs/lib_database_test/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/libs/lib_database_test/src/main/kotlin/com/bael/dads/lib/database/test/FakeDadsDatabase.kt b/libs/lib_database_test/src/main/kotlin/com/bael/dads/lib/database/test/FakeDadsDatabase.kt
deleted file mode 100644
index e32a3c9..0000000
--- a/libs/lib_database_test/src/main/kotlin/com/bael/dads/lib/database/test/FakeDadsDatabase.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.bael.dads.lib.database.test
-
-import android.content.Context
-import androidx.room.Room.inMemoryDatabaseBuilder
-import com.bael.dads.lib.database.DadsDatabase
-import com.bael.dads.lib.database.DadsRoomDatabase
-import com.bael.dads.lib.database.dao.DadJokeDao
-import com.bael.dads.lib.database.dao.RemoteMetaDao
-import dagger.hilt.android.qualifiers.ApplicationContext
-import javax.inject.Inject
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-internal class FakeDadsDatabase @Inject constructor(
- @ApplicationContext context: Context
-) : DadsDatabase {
- private val database: DadsRoomDatabase by lazy {
- inMemoryDatabaseBuilder(context, DadsRoomDatabase::class.java)
- .allowMainThreadQueries()
- .build()
- }
-
- override val dadJoke: DadJokeDao
- get() = database.dadJoke
-
- override val remoteMeta: RemoteMetaDao
- get() = database.remoteMeta
-
- override fun closeConnection() {
- database.close()
- }
-}
diff --git a/libs/lib_database_test/src/main/kotlin/com/bael/dads/lib/database/test/di/module/DatabaseTestModule.kt b/libs/lib_database_test/src/main/kotlin/com/bael/dads/lib/database/test/di/module/DatabaseTestModule.kt
deleted file mode 100644
index de11e7c..0000000
--- a/libs/lib_database_test/src/main/kotlin/com/bael/dads/lib/database/test/di/module/DatabaseTestModule.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.bael.dads.lib.database.test.di.module
-
-import com.bael.dads.lib.database.DadsDatabase
-import com.bael.dads.lib.database.di.module.DatabaseModule
-import com.bael.dads.lib.database.test.FakeDadsDatabase
-import dagger.Binds
-import dagger.Module
-import dagger.hilt.components.SingletonComponent
-import dagger.hilt.testing.TestInstallIn
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@TestInstallIn(
- components = [SingletonComponent::class],
- replaces = [DatabaseModule::class]
-)
-internal interface DatabaseTestModule {
-
- @Binds
- @Singleton
- fun bindDatabase(database: FakeDadsDatabase): DadsDatabase
-}
diff --git a/libs/lib_instrumentation/build.gradle.kts b/libs/lib_instrumentation/build.gradle.kts
deleted file mode 100644
index a38036b..0000000
--- a/libs/lib_instrumentation/build.gradle.kts
+++ /dev/null
@@ -1,25 +0,0 @@
-plugins {
- id("library")
-}
-
-dependencies {
- // AndroidX
- implementation(Library.appCompat)
- implementation(Library.archTesting)
- implementation(Library.coroutinesTest)
- implementation(Library.espresso)
- implementation(Library.fragmentKtx)
- implementation(Library.fragmentTesting)
- implementation(Library.runner)
- implementation(Library.material)
- implementation(Library.navigationTesting)
-
- // Google
- implementation(Library.daggerTesting)
-}
-
-dependencies {
- // Lib
- implementation(project(":lib_presentation"))
- implementation(project(":lib_threading"))
-}
diff --git a/libs/lib_preference/build.gradle.kts b/libs/lib_preference/build.gradle.kts
deleted file mode 100644
index 8bf255e..0000000
--- a/libs/lib_preference/build.gradle.kts
+++ /dev/null
@@ -1,13 +0,0 @@
-plugins {
- id("library")
-}
-
-dependencies {
- // AndroidX
- implementation(Library.dataStore)
-}
-
-dependencies {
- // Lib
- implementation(project(":lib_threading"))
-}
diff --git a/libs/lib_preference/src/main/AndroidManifest.xml b/libs/lib_preference/src/main/AndroidManifest.xml
deleted file mode 100644
index be91a52..0000000
--- a/libs/lib_preference/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/libs/lib_preference_test/build.gradle.kts b/libs/lib_preference_test/build.gradle.kts
deleted file mode 100644
index b18486c..0000000
--- a/libs/lib_preference_test/build.gradle.kts
+++ /dev/null
@@ -1,13 +0,0 @@
-plugins {
- id("library")
-}
-
-dependencies {
- // Google
- implementation(Library.daggerTesting)
-}
-
-dependencies {
- // Lib
- implementation(project(":lib_preference"))
-}
diff --git a/libs/lib_preference_test/src/main/AndroidManifest.xml b/libs/lib_preference_test/src/main/AndroidManifest.xml
deleted file mode 100644
index b2bdccd..0000000
--- a/libs/lib_preference_test/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/libs/lib_presentation/build.gradle.kts b/libs/lib_presentation/build.gradle.kts
deleted file mode 100644
index b7cf261..0000000
--- a/libs/lib_presentation/build.gradle.kts
+++ /dev/null
@@ -1,32 +0,0 @@
-plugins {
- id("library")
-}
-
-android {
- buildFeatures.apply {
- viewBinding = true
- }
-}
-
-dependencies {
- // AndroidX
- implementation(Library.constraintLayout)
- implementation(Library.fragmentKtx)
- implementation(Library.lifecycle)
- implementation(Library.material)
- implementation(Library.navigationFragment)
- implementation(Library.navigationUi)
- implementation(Library.recyclerView)
- implementation(Library.viewPager2)
-
- // Airbnb
- implementation(Library.lottie)
-}
-
-dependencies {
- // Domain
- implementation(project(":domain_common"))
-
- // Lib
- implementation(project(":lib_threading"))
-}
diff --git a/libs/lib_presentation/src/main/AndroidManifest.xml b/libs/lib_presentation/src/main/AndroidManifest.xml
deleted file mode 100644
index d54e8c4..0000000
--- a/libs/lib_presentation/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/libs/lib_remote/build.gradle.kts b/libs/lib_remote/build.gradle.kts
deleted file mode 100644
index 688ee71..0000000
--- a/libs/lib_remote/build.gradle.kts
+++ /dev/null
@@ -1,27 +0,0 @@
-plugins {
- id("library")
- id("com.apollographql.apollo")
- id("com.google.secrets_gradle_plugin") version Version.secrets
-}
-
-apollo {
- generateKotlinModels.set(true)
-}
-
-secrets {
- propertiesFileName = "keys.properties"
-}
-
-dependencies {
- // Apollo
- implementation(Library.apollo)
- implementation(Library.apolloCoroutines)
-
- // Square
- implementation(Library.okhttp3Logging)
-}
-
-dependencies {
- // Domain
- implementation(project(":domain_common"))
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/client/ApolloModule.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/client/ApolloModule.kt
deleted file mode 100644
index d224498..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/client/ApolloModule.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.bael.dads.lib.remote.di.module.client
-
-import com.apollographql.apollo.ApolloClient
-import com.bael.dads.lib.remote.di.qualifier.BaseUrlQualifier
-import dagger.Module
-import dagger.Provides
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import okhttp3.OkHttpClient
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-internal object ApolloModule {
-
- @Provides
- @Singleton
- @BaseUrlQualifier
- fun provideBaseUrl(): String {
- return "https://dads-engine.herokuapp.com/"
- }
-
- @Provides
- @Singleton
- fun provideApollo(
- @BaseUrlQualifier url: String,
- okHttpClient: OkHttpClient,
- ): ApolloClient {
- return ApolloClient.builder()
- .serverUrl(url)
- .okHttpClient(okHttpClient)
- .build()
- }
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/mapper/MapperModule.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/mapper/MapperModule.kt
deleted file mode 100644
index f630d3e..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/mapper/MapperModule.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.bael.dads.lib.remote.di.module.mapper
-
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.lib.remote.mapper.data.DadJokeClientMapper
-import com.bael.dads.lib.remote.mapper.data.DadJokesResponseClientMapper
-import com.bael.dads.lib.remote.model.DadJoke
-import com.bael.dads.lib.remote.response.DadJokesResponse
-import dagger.Binds
-import dagger.Module
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Singleton
-import com.bael.dads.lib.remote.query.DadJokesQuery.Data as DadJokesQueryData
-import com.bael.dads.lib.remote.query.DadJokesQuery.Joke as DadJokeClient
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-internal interface MapperModule {
-
- @Binds
- @Singleton
- fun bindDadJokeClientMapper(mapper: DadJokeClientMapper): Mapper
-
- @Binds
- @Singleton
- fun bindDadJokesResponseClientMapper(
- mapper: DadJokesResponseClientMapper
- ): Mapper
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/network/NetworkModule.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/network/NetworkModule.kt
deleted file mode 100644
index be33f7d..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/network/NetworkModule.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.bael.dads.lib.remote.di.module.network
-
-import com.bael.dads.lib.remote.network.DefaultNetwork
-import com.bael.dads.lib.remote.network.Network
-import dagger.Binds
-import dagger.Module
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-internal interface NetworkModule {
-
- @Binds
- @Singleton
- fun bindNetwork(network: DefaultNetwork): Network
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/okhttp/OkHttpClientModule.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/okhttp/OkHttpClientModule.kt
deleted file mode 100644
index c6b1ae6..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/okhttp/OkHttpClientModule.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.bael.dads.lib.remote.di.module.okhttp
-
-import com.bael.dads.lib.remote.BuildConfig.DEBUG
-import com.bael.dads.lib.remote.interceptor.AuthInterceptor
-import com.bael.dads.lib.remote.interceptor.ContentTypeInterceptor
-import dagger.Module
-import dagger.Provides
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import okhttp3.OkHttpClient
-import okhttp3.logging.HttpLoggingInterceptor
-import okhttp3.logging.HttpLoggingInterceptor.Level.BODY
-import okhttp3.logging.HttpLoggingInterceptor.Level.NONE
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-internal object OkHttpClientModule {
-
- @Provides
- @Singleton
- fun provideLoggingInterceptor(): HttpLoggingInterceptor {
- return HttpLoggingInterceptor().apply {
- level = BODY.takeIf { DEBUG } ?: NONE
- }
- }
-
- @Provides
- @Singleton
- fun provideOkHttpClient(
- authInterceptor: AuthInterceptor,
- contentTypeInterceptor: ContentTypeInterceptor,
- loggingInterceptor: HttpLoggingInterceptor
- ): OkHttpClient {
- return OkHttpClient.Builder()
- .addInterceptor(authInterceptor)
- .addInterceptor(contentTypeInterceptor)
- .addInterceptor(loggingInterceptor)
- .build()
- }
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/service/ServiceModule.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/service/ServiceModule.kt
deleted file mode 100644
index f5e6500..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/module/service/ServiceModule.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.bael.dads.lib.remote.di.module.service
-
-import com.bael.dads.lib.remote.service.DadsApolloService
-import com.bael.dads.lib.remote.service.DadsService
-import dagger.Binds
-import dagger.Module
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@InstallIn(SingletonComponent::class)
-interface ServiceModule {
-
- @Binds
- @Singleton
- fun bindDadsService(service: DadsApolloService): DadsService
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/qualifier/BaseUrlQualifier.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/qualifier/BaseUrlQualifier.kt
deleted file mode 100644
index ee6211f..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/di/qualifier/BaseUrlQualifier.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.bael.dads.lib.remote.di.qualifier
-
-import javax.inject.Qualifier
-import kotlin.annotation.AnnotationRetention.BINARY
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Qualifier
-@Retention(BINARY)
-internal annotation class BaseUrlQualifier
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/interceptor/AuthInterceptor.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/interceptor/AuthInterceptor.kt
deleted file mode 100644
index 1e87fb4..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/interceptor/AuthInterceptor.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.bael.dads.lib.remote.interceptor
-
-import com.bael.dads.lib.remote.BuildConfig.JWT
-import okhttp3.Interceptor
-import okhttp3.Interceptor.Chain
-import okhttp3.Response
-import javax.inject.Inject
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Singleton
-internal class AuthInterceptor @Inject constructor() : Interceptor {
-
- override fun intercept(chain: Chain): Response {
- val request = chain.request()
- .newBuilder()
- .header("Authorization", "Bearer $JWT")
- return chain.proceed(request.build())
- }
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/interceptor/ContentTypeInterceptor.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/interceptor/ContentTypeInterceptor.kt
deleted file mode 100644
index 4d3f804..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/interceptor/ContentTypeInterceptor.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.bael.dads.lib.remote.interceptor
-
-import okhttp3.Interceptor
-import okhttp3.Interceptor.Chain
-import okhttp3.Response
-import javax.inject.Inject
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Singleton
-internal class ContentTypeInterceptor @Inject constructor() : Interceptor {
-
- override fun intercept(chain: Chain): Response {
- val request = chain.request()
- .newBuilder()
- .header("Accept", "application/json")
- return chain.proceed(request.build())
- }
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/mapper/data/DadJokeClientMapper.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/mapper/data/DadJokeClientMapper.kt
deleted file mode 100644
index 713a574..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/mapper/data/DadJokeClientMapper.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.bael.dads.lib.remote.mapper.data
-
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.lib.remote.model.DadJoke
-import javax.inject.Inject
-import com.bael.dads.lib.remote.query.DadJokesQuery.Joke as DadJokeClient
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-internal class DadJokeClientMapper @Inject constructor() : Mapper {
-
- override fun map(data: DadJokeClient): DadJoke {
- return data.fragments.dadJokeFragment.let { fragment ->
- DadJoke(
- id = fragment.id,
- setup = fragment.setup,
- punchline = fragment.punchline
- )
- }
- }
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/mapper/data/DadJokesResponseClientMapper.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/mapper/data/DadJokesResponseClientMapper.kt
deleted file mode 100644
index 31c60bd..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/mapper/data/DadJokesResponseClientMapper.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.bael.dads.lib.remote.mapper.data
-
-import com.bael.dads.domain.common.mapper.ListMapper
-import com.bael.dads.domain.common.mapper.Mapper
-import com.bael.dads.lib.remote.model.DadJoke
-import com.bael.dads.lib.remote.response.DadJokesResponse
-import javax.inject.Inject
-import com.bael.dads.lib.remote.query.DadJokesQuery.Data as DadJokesQueryData
-import com.bael.dads.lib.remote.query.DadJokesQuery.Joke as DadJokeClient
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-internal class DadJokesResponseClientMapper @Inject constructor(
- private val dadJokesMapper: ListMapper,
-) : Mapper {
-
- override fun map(data: DadJokesQueryData): DadJokesResponse {
- return DadJokesResponse(
- dadJokes = dadJokesMapper.map(data.dadJokes.jokes),
- cursor = data.dadJokes.cursor
- )
- }
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/BaseApolloService.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/BaseApolloService.kt
deleted file mode 100644
index 69e6e00..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/BaseApolloService.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.bael.dads.lib.remote.service
-
-import com.apollographql.apollo.ApolloClient
-import com.apollographql.apollo.api.Operation.Data
-import com.apollographql.apollo.api.Operation.Variables
-import com.apollographql.apollo.api.Query
-import com.apollographql.apollo.coroutines.await
-import com.bael.dads.domain.common.exception.NoNetworkException
-import com.bael.dads.lib.remote.network.Network
-import java.io.IOException
-import javax.inject.Inject
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-abstract class BaseApolloService(private val client: ApolloClient) {
- @Inject
- internal lateinit var network: Network
-
- protected suspend fun query(script: Query): Result {
- return runCatching {
- if (!network.isConnected) throw NoNetworkException()
-
- val response = client.query(script).await()
- if (response.hasErrors()) {
- throw IOException(response.errors!![0].message)
- }
- response.data!!
- }
- }
-}
diff --git a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/DadsApolloService.kt b/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/DadsApolloService.kt
deleted file mode 100644
index 027cd5a..0000000
--- a/libs/lib_remote/src/main/kotlin/com/bael/dads/lib/remote/service/DadsApolloService.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.bael.dads.lib.remote.service
-
-import com.apollographql.apollo.ApolloClient
-import com.apollographql.apollo.api.Input.Companion.fromNullable
-import com.bael.dads.domain.common.mapper.ResultMapper
-import com.bael.dads.lib.remote.query.DadJokesQuery
-import com.bael.dads.lib.remote.response.DadJokesResponse
-import javax.inject.Inject
-import com.bael.dads.lib.remote.query.DadJokesQuery.Data as DadJokesQueryData
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-class DadsApolloService @Inject constructor(
- apollo: ApolloClient,
- private val mapper: ResultMapper
-) : BaseApolloService(apollo),
- DadsService {
-
- override suspend fun fetchDadJokes(
- cursor: String?,
- limit: Int
- ): Result {
- return query(
- script = DadJokesQuery(
- cursor = fromNullable(cursor),
- limit = fromNullable(limit)
- )
- ).let(mapper::map)
- }
-}
diff --git a/libs/lib_remote_test/build.gradle.kts b/libs/lib_remote_test/build.gradle.kts
deleted file mode 100644
index 0d662ab..0000000
--- a/libs/lib_remote_test/build.gradle.kts
+++ /dev/null
@@ -1,16 +0,0 @@
-plugins {
- id("library")
-}
-
-dependencies {
- // Google
- implementation(Library.daggerTesting)
-}
-
-dependencies {
- // Domain
- implementation(project(":domain_common"))
-
- // Lib
- implementation(project(":lib_remote"))
-}
diff --git a/libs/lib_remote_test/src/main/AndroidManifest.xml b/libs/lib_remote_test/src/main/AndroidManifest.xml
deleted file mode 100644
index b43ff51..0000000
--- a/libs/lib_remote_test/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/di/module/service/ServiceTestModule.kt b/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/di/module/service/ServiceTestModule.kt
deleted file mode 100644
index 709a32f..0000000
--- a/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/di/module/service/ServiceTestModule.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-@file:Suppress("UNCHECKED_CAST")
-
-package com.bael.dads.lib.remote.test.di.module.service
-
-import com.bael.dads.lib.remote.di.module.service.ServiceModule
-import com.bael.dads.lib.remote.response.DadJokesResponse
-import com.bael.dads.lib.remote.service.DadsService
-import com.bael.dads.lib.remote.test.service.FakeDadsService
-import com.bael.dads.lib.remote.test.service.RemoteService
-import dagger.Binds
-import dagger.Module
-import dagger.Provides
-import dagger.hilt.components.SingletonComponent
-import dagger.hilt.testing.TestInstallIn
-import javax.inject.Singleton
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-@Module
-@TestInstallIn(
- components = [SingletonComponent::class],
- replaces = [ServiceModule::class]
-)
-internal interface ServiceTestModule {
-
- @Binds
- @Singleton
- fun bindDadsService(service: FakeDadsService): DadsService
-
- companion object {
-
- @Provides
- fun provideDadsService(service: DadsService): RemoteService {
- return service as RemoteService
- }
- }
-}
diff --git a/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/FakeDadsService.kt b/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/FakeDadsService.kt
deleted file mode 100644
index 5fe4e37..0000000
--- a/libs/lib_remote_test/src/main/kotlin/com/bael/dads/lib/remote/test/service/FakeDadsService.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.bael.dads.lib.remote.test.service
-
-import com.bael.dads.lib.remote.response.DadJokesResponse
-import com.bael.dads.lib.remote.service.DadsService
-import javax.inject.Inject
-
-/**
- * Created by ErickSumargo on 01/01/21.
- */
-
-internal class FakeDadsService @Inject constructor() :
- FakeBaseService(),
- DadsService {
-
- override suspend fun fetchDadJokes(cursor: String?, limit: Int): Result {
- return result
- }
-}
diff --git a/libs/lib_threading/build.gradle.kts b/libs/lib_threading/build.gradle.kts
deleted file mode 100644
index a1534cb..0000000
--- a/libs/lib_threading/build.gradle.kts
+++ /dev/null
@@ -1,3 +0,0 @@
-plugins {
- id("library")
-}
diff --git a/libs/lib_threading/src/main/AndroidManifest.xml b/libs/lib_threading/src/main/AndroidManifest.xml
deleted file mode 100644
index 3f920a9..0000000
--- a/libs/lib_threading/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/libs/lib_threading_test/build.gradle.kts b/libs/lib_threading_test/build.gradle.kts
deleted file mode 100644
index c1d1ff6..0000000
--- a/libs/lib_threading_test/build.gradle.kts
+++ /dev/null
@@ -1,16 +0,0 @@
-plugins {
- id("library")
-}
-
-dependencies {
- // Google
- implementation(Library.daggerTesting)
-
- // KotlinX
- implementation(Library.coroutinesTest)
-}
-
-dependencies {
- // Lib
- implementation(project(":lib_threading"))
-}
diff --git a/libs/lib_threading_test/src/main/AndroidManifest.xml b/libs/lib_threading_test/src/main/AndroidManifest.xml
deleted file mode 100644
index 22fb6eb..0000000
--- a/libs/lib_threading_test/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/libs/lib_worker/build.gradle.kts b/libs/lib_worker/build.gradle.kts
deleted file mode 100644
index 2585fd8..0000000
--- a/libs/lib_worker/build.gradle.kts
+++ /dev/null
@@ -1,10 +0,0 @@
-plugins {
- id("library")
-}
-
-dependencies {
- // AndroidX
- implementation(Library.hiltWork)
- implementation(Library.startup)
- implementation(Library.work)
-}
diff --git a/processor/build.gradle.kts b/processor/build.gradle.kts
deleted file mode 100644
index 1de3a50..0000000
--- a/processor/build.gradle.kts
+++ /dev/null
@@ -1,22 +0,0 @@
-plugins {
- id("kotlin")
- kotlin("kapt")
-}
-
-dependencies {
- // Google
- implementation(Library.autoService)
-
- kapt(Library.autoService)
-
- // JavaX
- implementation(Library.inject)
-
- // Square
- implementation(Library.javaPoet)
-}
-
-dependencies {
- // Internal
- implementation(project(":annotation"))
-}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 7165092..84f23cf 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,50 +1,74 @@
rootProject.name = "Dads"
-val domains = listOf(
- "domain_common",
- "domain_home"
-)
+SharedProject(settings).also { project ->
+ project.importModules()
+}
-val features = listOf(
- "feature_home"
-)
+DataProject(settings).also { project ->
+ project.importModules()
+}
-val libs = listOf(
- "lib_database",
- "lib_database_test",
- "lib_instrumentation",
- "lib_preference",
- "lib_preference_test",
- "lib_presentation",
- "lib_remote",
- "lib_remote_test",
- "lib_threading",
- "lib_threading_test",
- "lib_worker"
-)
+DomainProject(settings).also { project ->
+ project.importModules()
+}
-val internals = listOf(
- "annotation",
- "processor"
-)
+AndroidPlatformProject(settings).also { project ->
+ project.importModules()
+}
-include(":app")
+class SharedProject(settings: Settings) : Settings by settings {
-domains.forEach { domain ->
- include(":$domain")
- project(":$domain").projectDir = File("domains/$domain")
+ fun importModules() {
+ include(":shared")
+ }
}
-features.forEach { feature ->
- include(":$feature")
- project(":$feature").projectDir = File("features/$feature")
+class DataProject(settings: Settings) : Settings by settings {
+
+ fun importModules() {
+ include(":data:database")
+ include(":data:database_test")
+ include(":data:remote")
+ include(":data:remote_test")
+ }
}
-libs.forEach { lib ->
- include(":$lib")
- project(":$lib").projectDir = File("libs/$lib")
+class DomainProject(settings: Settings) : Settings by settings {
+
+ fun importModules() {
+ include(":domain:home")
+ }
}
-internals.forEach { internal ->
- include(":$internal")
+class AndroidPlatformProject(settings: Settings) : Settings by settings {
+
+ fun importModules() {
+ importAppModules()
+ importInternalModules()
+ importFeatureModules()
+ importLibraryModules()
+ }
+
+ private fun importAppModules() {
+ include(":android:app")
+ }
+
+ private fun importInternalModules() {
+ include(":android:annotation")
+ include(":android:processor")
+ }
+
+ private fun importFeatureModules() {
+ include(":android:feature:home")
+ }
+
+ private fun importLibraryModules() {
+ include(":android:library:instrumentation")
+ include(":android:library:preference")
+ include(":android:library:preference_test")
+ include(":android:library:presentation")
+ include(":android:library:threading")
+ include(":android:library:threading_test")
+ include(":android:library:worker")
+ }
}
diff --git a/processor/.gitignore b/shared/.gitignore
similarity index 100%
rename from processor/.gitignore
rename to shared/.gitignore
diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts
new file mode 100644
index 0000000..459c461
--- /dev/null
+++ b/shared/build.gradle.kts
@@ -0,0 +1,3 @@
+plugins {
+ id("shared")
+}
diff --git a/libs/lib_worker/consumer-rules.pro b/shared/consumer-rules.pro
similarity index 100%
rename from libs/lib_worker/consumer-rules.pro
rename to shared/consumer-rules.pro
diff --git a/libs/lib_worker/proguard-rules.pro b/shared/proguard-rules.pro
similarity index 100%
rename from libs/lib_worker/proguard-rules.pro
rename to shared/proguard-rules.pro
diff --git a/shared/src/androidMain/AndroidManifest.xml b/shared/src/androidMain/AndroidManifest.xml
new file mode 100644
index 0000000..33727b4
--- /dev/null
+++ b/shared/src/androidMain/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/shared/src/commonMain/kotlin/com/bael/dads/shared/exception/NoNetworkException.kt b/shared/src/commonMain/kotlin/com/bael/dads/shared/exception/NoNetworkException.kt
new file mode 100644
index 0000000..0c4c9cf
--- /dev/null
+++ b/shared/src/commonMain/kotlin/com/bael/dads/shared/exception/NoNetworkException.kt
@@ -0,0 +1,7 @@
+package com.bael.dads.shared.exception
+
+/**
+ * Created by ErickSumargo on 01/01/21.
+ */
+
+class NoNetworkException : Exception()
diff --git a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/ext/ListExt.kt b/shared/src/commonMain/kotlin/com/bael/dads/shared/ext/ListExt.kt
similarity index 51%
rename from domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/ext/ListExt.kt
rename to shared/src/commonMain/kotlin/com/bael/dads/shared/ext/ListExt.kt
index 0269dd6..61121a6 100644
--- a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/ext/ListExt.kt
+++ b/shared/src/commonMain/kotlin/com/bael/dads/shared/ext/ListExt.kt
@@ -1,7 +1,7 @@
-package com.bael.dads.domain.common.ext
+package com.bael.dads.shared.ext
-import com.bael.dads.domain.common.response.Response
-import com.bael.dads.domain.common.response.Response.Success
+import com.bael.dads.shared.response.Response
+import com.bael.dads.shared.response.Response.Success
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/shared/src/commonMain/kotlin/com/bael/dads/shared/extension/SerializerExtension.kt b/shared/src/commonMain/kotlin/com/bael/dads/shared/extension/SerializerExtension.kt
new file mode 100644
index 0000000..6e76c44
--- /dev/null
+++ b/shared/src/commonMain/kotlin/com/bael/dads/shared/extension/SerializerExtension.kt
@@ -0,0 +1,17 @@
+package com.bael.dads.shared.extension
+
+import kotlinx.serialization.decodeFromString
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+inline fun T.serialize(): String {
+ return Json.encodeToString(value = this)
+}
+
+inline fun String.deserialize(): T {
+ return Json.decodeFromString(string = this)
+}
diff --git a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/ListMapper.kt b/shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/ListMapper.kt
similarity index 64%
rename from domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/ListMapper.kt
rename to shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/ListMapper.kt
index 8f68d4c..384429b 100644
--- a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/ListMapper.kt
+++ b/shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/ListMapper.kt
@@ -1,12 +1,10 @@
-package com.bael.dads.domain.common.mapper
-
-import javax.inject.Inject
+package com.bael.dads.shared.mapper
/**
* Created by ErickSumargo on 01/01/21.
*/
-class ListMapper @Inject constructor(
+class ListMapper(
private val mapper: Mapper
) : Mapper, List> {
diff --git a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/Mapper.kt b/shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/Mapper.kt
similarity index 70%
rename from domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/Mapper.kt
rename to shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/Mapper.kt
index 9affa0c..18c3d70 100644
--- a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/Mapper.kt
+++ b/shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/Mapper.kt
@@ -1,4 +1,4 @@
-package com.bael.dads.domain.common.mapper
+package com.bael.dads.shared.mapper
/**
* Created by ErickSumargo on 01/01/21.
diff --git a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/ResultMapper.kt b/shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/ResultMapper.kt
similarity index 65%
rename from domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/ResultMapper.kt
rename to shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/ResultMapper.kt
index 79424a3..cd5288d 100644
--- a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/mapper/ResultMapper.kt
+++ b/shared/src/commonMain/kotlin/com/bael/dads/shared/mapper/ResultMapper.kt
@@ -1,12 +1,10 @@
-package com.bael.dads.domain.common.mapper
-
-import javax.inject.Inject
+package com.bael.dads.shared.mapper
/**
* Created by ErickSumargo on 01/01/21.
*/
-class ResultMapper @Inject constructor(
+class ResultMapper(
private val mapper: Mapper
) : Mapper, Result> {
diff --git a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/response/Response.kt b/shared/src/commonMain/kotlin/com/bael/dads/shared/response/Response.kt
similarity index 68%
rename from domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/response/Response.kt
rename to shared/src/commonMain/kotlin/com/bael/dads/shared/response/Response.kt
index 29f58ba..4a1e662 100644
--- a/domains/domain_common/src/main/kotlin/com/bael/dads/domain/common/response/Response.kt
+++ b/shared/src/commonMain/kotlin/com/bael/dads/shared/response/Response.kt
@@ -1,12 +1,10 @@
-package com.bael.dads.domain.common.response
-
-import java.io.Serializable
+package com.bael.dads.shared.response
/**
* Created by ErickSumargo on 01/01/21.
*/
-sealed class Response : Serializable {
+sealed class Response {
object Loading : Response()
diff --git a/shared/src/commonMain/kotlin/com/bael/dads/shared/time/DateTime.kt b/shared/src/commonMain/kotlin/com/bael/dads/shared/time/DateTime.kt
new file mode 100644
index 0000000..0477c06
--- /dev/null
+++ b/shared/src/commonMain/kotlin/com/bael/dads/shared/time/DateTime.kt
@@ -0,0 +1,12 @@
+package com.bael.dads.shared.time
+
+import kotlinx.datetime.Clock.System.now
+
+/**
+ * Created by ErickSumargo on 01/05/21.
+ */
+
+object DateTime {
+ val now: Long
+ get() = now().toEpochMilliseconds()
+}