File tree Expand file tree Collapse file tree 11 files changed +69
-22
lines changed
app/src/main/java/com/omega_r/base/simple
src/main/java/com/omega_r/base
src/main/java/com/omegar/mvp_processor Expand file tree Collapse file tree 11 files changed +69
-22
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,13 @@ import android.os.SystemClock
44import com.omega_r.base.annotations.AutoPresenterLauncher
55import com.omega_r.base.mvp.presenters.OmegaPresenter
66import com.omega_r.libs.omegatypes.Text
7- import com.omegar.mvp.InjectViewState
87import java.io.Serializable
98
109/* *
1110 * Created by Anton Knyazev on 06.05.19.
1211 */
1312typealias TestEntity2 = TestEntity
1413@AutoPresenterLauncher(MainActivity ::class , TestFragment ::class )
15- @InjectViewState
1614class MainPresenter (testEntity : TestEntity ? , t2 : TestEntity2 ? ): OmegaPresenter<MainView>() {
1715
1816 companion object {
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import com.omega_r.base.components.OmegaDialogFragment
66import com.omega_r.base.simple.R
77import com.omega_r.libs.omegatypes.Text
88import com.omegar.libs.omegalaunchers.createDialogFragmentLauncher
9- import com.omegar.mvp.ktx.providePresenter
109
1110/* *
1211 * Created by Anton Knyazev on 10.03.2020.
Original file line number Diff line number Diff line change 11package com.omega_r.base.simple.dialog_fragment
22
33import com.omega_r.base.mvp.presenters.OmegaPresenter
4- import com.omegar.mvp.InjectViewState
54
65/* *
76 * Created by Anton Knyazev on 10.03.2020.
87 */
9- @InjectViewState
108class DialogPresenter : OmegaPresenter <DialogView >() {
119
1210}
Original file line number Diff line number Diff line change 11buildscript {
22 ext {
33 omegaRecyclerView = ' 1.10.1'
4- omegaMoxy_version = ' 3.0.0 '
4+ omegaMoxy_version = ' b5e0b08d88 '
55 kotlinCorutines_version = ' 1.5.0'
66
77 }// Top-level build file where you can add configuration options common to all sub-projects/modules.
Original file line number Diff line number Diff line change @@ -56,15 +56,6 @@ android {
5656 }
5757
5858 kotlinOptions. jvmTarget = " 1.8"
59-
60- kapt {
61- arguments {
62- arg(" moxyReflectorPackage" , ' com.omega_r.base' )
63- }
64- }
65- ksp {
66- arg(" moxyReflectorPackage" , ' com.omega_r.base' )
67- }
6859}
6960
7061
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ open class OmegaBaseRepository<SOURCE : Source>(
2727
2828 protected val coroutineScope = CoroutineScope (Dispatchers .Background + job)
2929
30+ override var mockMode: Boolean = false
31+
3032 protected val remoteSource: SOURCE ? = sources.firstOrNull { it.type == Source .Type .REMOTE }
3133
3234 protected val memorySource: SOURCE ?
@@ -49,6 +51,9 @@ open class OmegaBaseRepository<SOURCE : Source>(
4951 return result
5052 }
5153
54+ private val generalSource: SOURCE ?
55+ get() = if (mockMode) mockSource else remoteSource
56+
5257 protected fun <R > createChannel (strategy : Strategy , block : suspend SOURCE .() -> R ): ReceiveChannel <R > {
5358 return coroutineScope.produce {
5459 try {
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ package com.omega_r.base.data
22
33interface OmegaRepository {
44
5+ var mockMode: Boolean
6+
57 fun clearCache ()
68
79 enum class Strategy {
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ import com.omegar.libs.omegalaunchers.ActivityLauncher
1414import com.omegar.libs.omegalaunchers.BaseIntentLauncher
1515import com.omegar.libs.omegalaunchers.DialogFragmentLauncher
1616import com.omegar.libs.omegalaunchers.Launcher
17- import com.omegar.mvp.InjectViewState
1817import com.omegar.mvp.MvpPresenter
1918import kotlinx.coroutines.*
2019import java.io.PrintWriter
@@ -30,7 +29,6 @@ import kotlin.coroutines.EmptyCoroutineContext
3029private const val REQUEST_PERMISSION_BASE = 10000
3130private const val REQUEST_CODE_MAX : Int = Int .MAX_VALUE - 1
3231
33- @InjectViewState
3432open class OmegaPresenter <View : OmegaView > : MvpPresenter <View >(), CoroutineScope {
3533
3634 companion object {
Original file line number Diff line number Diff line change 11package com.omega_r.base.mvp.views
22
3+ import com.omegar.mvp.viewstate.strategy.MoxyViewCommand
34import com.omegar.mvp.viewstate.strategy.StateStrategyType
45import com.omegar.mvp.viewstate.strategy.StrategyType
56
67interface OmegaBindView <M >: OmegaView {
78
8- @StateStrategyType (StrategyType .ADD_TO_END_SINGLE )
9+ @MoxyViewCommand (StrategyType .ADD_TO_END_SINGLE )
910 fun bind (item : M )
1011
1112}
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ dependencies {
3737 implementation project(path : ' :annotations' )
3838
3939 implementation ' com.google.devtools.ksp:symbol-processing-api:1.9.0-1.0.11'
40+ implementation " com.github.Omega-R.OmegaMoxy:moxy:${ omegaMoxy_version} "
4041
4142 implementation(" com.squareup:kotlinpoet:1.14.2" )
4243 implementation(" com.squareup:kotlinpoet-ksp:1.14.2" )
You can’t perform that action at this time.
0 commit comments