Skip to content

Feat/search #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ dependencies {
implementation(core)
implementation(featureMain)
implementation(featureAdd)
implementation(featureSearch)

implementation(deps.coroutines.android)
implementation(deps.koin.android)

debugImplementation(deps.squareup.leakCanary)

testImplementation(deps.test.junit)
androidTestImplementation(deps.test.androidxJunit)
androidTestImplementation(deps.test.androidXSspresso)
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/hoc/flowmvi/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.hoc.flowmvi.data.dataModule
import com.hoc.flowmvi.domain.domainModule
import com.hoc.flowmvi.ui.add.addModule
import com.hoc.flowmvi.ui.main.mainModule
import com.hoc.flowmvi.ui.search.searchModule
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import org.koin.android.ext.koin.androidContext
Expand All @@ -25,15 +26,15 @@ class App : Application() {
startKoin {
androidContext(this@App)

// TODO: Koin
androidLogger(level = Level.NONE)
androidLogger(if (BuildConfig.DEBUG) Level.DEBUG else Level.NONE)

modules(
coreModule,
dataModule,
domainModule,
mainModule,
addModule,
searchModule,
)
}
}
Expand Down
6 changes: 1 addition & 5 deletions app/src/main/java/com/hoc/flowmvi/core/CoreModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ package com.hoc.flowmvi.core

import com.hoc.flowmvi.core.dispatchers.CoroutineDispatchers
import com.hoc.flowmvi.core.navigator.Navigator
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import org.koin.dsl.module

@FlowPreview
@ExperimentalCoroutinesApi
val coreModule = module {
single<CoroutineDispatchers> { CoroutineDispatchersImpl() }

single<Navigator> { NavigatorImpl(add = get()) }
single<Navigator> { NavigatorImpl(add = get(), search = get()) }
}
11 changes: 6 additions & 5 deletions app/src/main/java/com/hoc/flowmvi/core/NavigatorImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package com.hoc.flowmvi.core
import android.content.Context
import com.hoc.flowmvi.core.navigator.IntentProviders
import com.hoc.flowmvi.core.navigator.Navigator
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview

@ExperimentalCoroutinesApi
@FlowPreview
class NavigatorImpl(
private val add: IntentProviders.Add
private val add: IntentProviders.Add,
private val search: IntentProviders.Search,
) : Navigator {
override fun Context.navigateToAdd() =
startActivity(add.makeIntent(this))

override fun Context.navigateToSearch() {
startActivity(search.makeIntent(this))
}
}
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ buildscript {
gradlePluginPortal()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.0")
classpath("com.android.tools.build:gradle:4.2.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.diffplug.spotless:spotless-plugin-gradle:5.12.4")
classpath("dev.ahmedmourad.nocopy:nocopy-gradle-plugin:1.4.0")
}
}

Expand Down Expand Up @@ -63,8 +64,6 @@ subprojects {
allprojects {
tasks.withType<KotlinCompile> {
kotlinOptions {
useIR = true

val version = JavaVersion.VERSION_1_8.toString()
jvmTarget = version
sourceCompatibility = version
Expand All @@ -75,6 +74,7 @@ allprojects {
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
}
}

Expand Down
9 changes: 6 additions & 3 deletions buildSrc/src/main/kotlin/deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.gradle.plugin.use.PluginDependenciesSpec
import org.gradle.plugin.use.PluginDependencySpec

const val ktlintVersion = "0.41.0"
const val kotlinVersion = "1.5.0"
const val kotlinVersion = "1.5.10"

object appConfig {
const val applicationId = "com.hoc.flowmvi"
Expand Down Expand Up @@ -43,23 +43,25 @@ object deps {
const val converterMoshi = "com.squareup.retrofit2:converter-moshi:2.9.0"
const val loggingInterceptor = "com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2"
const val moshiKotlin = "com.squareup.moshi:moshi-kotlin:1.11.0"
const val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.7"
}

object coroutines {
private const val version = "1.5.0-RC"
private const val version = "1.5.0"

const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"
}

object koin {
private const val version = "3.0.1"
private const val version = "3.0.2"

const val core = "io.insert-koin:koin-core:$version"
const val android = "io.insert-koin:koin-android:$version"
}

const val coil = "io.coil-kt:coil:1.2.1"
const val viewBindingDelegate = "com.github.hoc081098:ViewBindingDelegate:1.0.0"

object test {
const val junit = "junit:junit:4.13"
Expand All @@ -81,3 +83,4 @@ inline val DependencyHandler.core get() = project(":core")
inline val DependencyHandler.data get() = project(":data")
inline val DependencyHandler.featureMain get() = project(":feature-main")
inline val DependencyHandler.featureAdd get() = project(":feature-add")
inline val DependencyHandler.featureSearch get() = project(":feature-search")
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
package com.hoc.flowmvi.core

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.hoc081098.flowmvi.core.test", appContext.packageName)
}
}
Loading