Skip to content

Commit 66b3173

Browse files
committed
Upgrade OmegaMoxy, fix MvpProcessor
1 parent e161083 commit 66b3173

File tree

11 files changed

+69
-22
lines changed

11 files changed

+69
-22
lines changed

app/src/main/java/com/omega_r/base/simple/MainPresenter.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import android.os.SystemClock
44
import com.omega_r.base.annotations.AutoPresenterLauncher
55
import com.omega_r.base.mvp.presenters.OmegaPresenter
66
import com.omega_r.libs.omegatypes.Text
7-
import com.omegar.mvp.InjectViewState
87
import java.io.Serializable
98

109
/**
1110
* Created by Anton Knyazev on 06.05.19.
1211
*/
1312
typealias TestEntity2 = TestEntity
1413
@AutoPresenterLauncher(MainActivity::class, TestFragment::class)
15-
@InjectViewState
1614
class MainPresenter(testEntity: TestEntity?, t2: TestEntity2?): OmegaPresenter<MainView>() {
1715

1816
companion object {

app/src/main/java/com/omega_r/base/simple/dialog_fragment/DialogDialogFragment.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import com.omega_r.base.components.OmegaDialogFragment
66
import com.omega_r.base.simple.R
77
import com.omega_r.libs.omegatypes.Text
88
import com.omegar.libs.omegalaunchers.createDialogFragmentLauncher
9-
import com.omegar.mvp.ktx.providePresenter
109

1110
/**
1211
* Created by Anton Knyazev on 10.03.2020.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.omega_r.base.simple.dialog_fragment
22

33
import 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
108
class DialogPresenter : OmegaPresenter<DialogView>() {
119

1210
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
buildscript {
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.

core/build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff 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

core/src/main/java/com/omega_r/base/data/OmegaBaseRepository.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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 {

core/src/main/java/com/omega_r/base/data/OmegaRepository.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package com.omega_r.base.data
22

33
interface OmegaRepository {
44

5+
var mockMode: Boolean
6+
57
fun clearCache()
68

79
enum class Strategy {

core/src/main/java/com/omega_r/base/mvp/presenters/OmegaPresenter.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import com.omegar.libs.omegalaunchers.ActivityLauncher
1414
import com.omegar.libs.omegalaunchers.BaseIntentLauncher
1515
import com.omegar.libs.omegalaunchers.DialogFragmentLauncher
1616
import com.omegar.libs.omegalaunchers.Launcher
17-
import com.omegar.mvp.InjectViewState
1817
import com.omegar.mvp.MvpPresenter
1918
import kotlinx.coroutines.*
2019
import java.io.PrintWriter
@@ -30,7 +29,6 @@ import kotlin.coroutines.EmptyCoroutineContext
3029
private const val REQUEST_PERMISSION_BASE = 10000
3130
private const val REQUEST_CODE_MAX: Int = Int.MAX_VALUE - 1
3231

33-
@InjectViewState
3432
open class OmegaPresenter<View : OmegaView> : MvpPresenter<View>(), CoroutineScope {
3533

3634
companion object {
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package com.omega_r.base.mvp.views
22

3+
import com.omegar.mvp.viewstate.strategy.MoxyViewCommand
34
import com.omegar.mvp.viewstate.strategy.StateStrategyType
45
import com.omegar.mvp.viewstate.strategy.StrategyType
56

67
interface 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
}

mvp-processor/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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")

0 commit comments

Comments
 (0)