Skip to content

Commit cffe24e

Browse files
committed
Merge branch 'develop'
2 parents 3065afe + 95fad7c commit cffe24e

File tree

269 files changed

+1746
-1290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+1746
-1290
lines changed

app/build.gradle.kts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
2-
import org.gradle.configurationcache.extensions.capitalized
1+
import org.gradle.internal.extensions.stdlib.capitalized
2+
import java.util.Properties
33

44
plugins {
55
id("com.android.application")
@@ -14,13 +14,15 @@ android {
1414
namespace = "ru.rznnike.eyehealthmanager"
1515

1616
compileSdk = rootProject.extra["TARGET_SDK"] as Int
17-
buildToolsVersion = "34.0.0"
17+
buildToolsVersion = "35.0.0"
1818

1919
signingConfigs {
2020
create("config") {
2121
storeFile = file("../eyehealthmanager.jks")
2222
keyAlias = "eyehealthmanager"
23-
val localProperties = gradleLocalProperties(rootDir)
23+
val localProperties = Properties().apply {
24+
rootProject.file("local.properties").reader().use(::load)
25+
}
2426
val keyPass = localProperties.getProperty("PROJECT_KEY_PASSWORD")
2527
val storePass = localProperties.getProperty("PROJECT_KEYSTORE_PASSWORD")
2628
if (keyPass.isNullOrBlank() || storePass.isNullOrBlank()) {
@@ -106,7 +108,6 @@ android {
106108
viewBinding = true
107109
buildConfig = true
108110
}
109-
@Suppress("UnstableApiUsage")
110111
bundle {
111112
abi.enableSplit = false
112113
language.enableSplit = false
@@ -120,37 +121,38 @@ android {
120121
}
121122

122123
dependencies {
123-
implementation(project(":data"))
124124
implementation(project(":domain"))
125-
implementation(project(":device"))
125+
implementation(project(":data"))
126126
implementation(project(":resources"))
127127

128128
// Desugaring
129-
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
129+
// https://mvnrepository.com/artifact/com.android.tools/desugar_jdk_libs
130+
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:" + rootProject.extra["desugaringVersion"])
130131

131132
// AndroidX
132-
implementation("androidx.appcompat:appcompat:1.6.1")
133+
implementation("androidx.appcompat:appcompat:1.7.0")
133134
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
134135
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
135-
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
136-
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
136+
val lifecycleVersion = "2.8.6"
137+
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
138+
implementation("androidx.lifecycle:lifecycle-process:$lifecycleVersion")
137139
implementation("androidx.preference:preference-ktx:1.2.1")
138-
implementation("androidx.viewpager2:viewpager2:1.1.0-beta02")
139-
implementation("androidx.annotation:annotation:1.7.1")
140-
implementation("androidx.fragment:fragment-ktx:1.6.2")
141-
implementation("androidx.window:window:1.2.0")
140+
implementation("androidx.viewpager2:viewpager2:1.1.0")
141+
implementation("androidx.annotation:annotation:1.9.0")
142+
implementation("androidx.fragment:fragment-ktx:1.8.4")
143+
implementation("androidx.window:window:1.3.0")
142144

143145
// Coroutines
144146
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:" + rootProject.extra["coroutinesVersion"])
145147
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:" + rootProject.extra["coroutinesVersion"])
146148
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:" + rootProject.extra["coroutinesVersion"])
147149

148150
// Material
149-
implementation("com.google.android.material:material:1.11.0")
151+
implementation("com.google.android.material:material:1.12.0")
150152

151153
// Firebase
152-
implementation("com.google.firebase:firebase-crashlytics-ktx:18.6.1")
153-
implementation("com.google.firebase:firebase-messaging:23.4.0")
154+
implementation("com.google.firebase:firebase-crashlytics-ktx:19.2.0")
155+
implementation("com.google.firebase:firebase-messaging:24.0.2")
154156

155157
// Koin
156158
// https://github.com/InsertKoinIO/koin
@@ -181,7 +183,7 @@ dependencies {
181183

182184
// Image loader
183185
// https://github.com/coil-kt/coil
184-
implementation("io.coil-kt:coil:2.5.0")
186+
implementation("io.coil-kt:coil:2.7.0")
185187

186188
// MPAndroidChart
187189
// https://github.com/PhilJay/MPAndroidChart
@@ -204,9 +206,9 @@ dependencies {
204206

205207
// Mocks for testing
206208
// https://github.com/mockito/mockito
207-
val mockitoVersion = "5.9.0"
209+
val mockitoVersion = "5.14.2"
208210
testImplementation("org.mockito:mockito-core:$mockitoVersion")
209211
testImplementation("org.mockito:mockito-junit-jupiter:$mockitoVersion")
210212
// https://github.com/mockito/mockito-kotlin
211-
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
213+
testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0")
212214
}

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333

3434

3535
<service
36-
android:name=".device.service.NotificationService"
36+
android:name=".app.service.NotificationService"
3737
android:permission="android.permission.BIND_JOB_SERVICE"
3838
android:exported="false" />
3939

4040
<service
41-
android:name=".device.service.AppFirebaseMessagingService"
41+
android:name=".app.service.AppFirebaseMessagingService"
4242
android:exported="false">
4343
<intent-filter>
4444
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />

app/src/main/java/ru/rznnike/eyehealthmanager/app/App.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ import org.koin.core.logger.Level
1414
import ru.rznnike.eyehealthmanager.BuildConfig
1515
import ru.rznnike.eyehealthmanager.app.di.appComponent
1616
import ru.rznnike.eyehealthmanager.app.observer.AppLifeCycleObserver
17-
import ru.rznnike.eyehealthmanager.data.preference.PreferencesWrapper
1817

1918
class App : Application() {
2019
private val appLifecycleObserver: AppLifeCycleObserver by inject()
21-
private val preferences: PreferencesWrapper by inject()
2220
private val boxStore: BoxStore by inject()
2321

2422
override fun onCreate() {

app/src/main/java/ru/rznnike/eyehealthmanager/app/Screens.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ import ru.rznnike.eyehealthmanager.app.ui.fragment.nearfar.test.NearFarTestFragm
4444
import ru.rznnike.eyehealthmanager.app.ui.fragment.settings.testing.TestingSettingsFragment
4545
import ru.rznnike.eyehealthmanager.app.ui.fragment.splash.SplashFlowFragment
4646
import ru.rznnike.eyehealthmanager.app.ui.fragment.splash.SplashFragment
47-
import ru.rznnike.eyehealthmanager.domain.model.AcuityTestResult
48-
import ru.rznnike.eyehealthmanager.domain.model.AnalysisResult
49-
import ru.rznnike.eyehealthmanager.domain.model.enums.AstigmatismAnswerType
50-
import ru.rznnike.eyehealthmanager.domain.model.enums.DaltonismAnomalyType
51-
import ru.rznnike.eyehealthmanager.domain.model.enums.DayPart
52-
import ru.rznnike.eyehealthmanager.domain.model.enums.NearFarAnswerType
47+
import ru.rznnike.eyehealthmanager.domain.model.test.acuity.AcuityTestResult
48+
import ru.rznnike.eyehealthmanager.domain.model.analysis.AnalysisResult
49+
import ru.rznnike.eyehealthmanager.domain.model.test.astigmatism.AstigmatismAnswerType
50+
import ru.rznnike.eyehealthmanager.domain.model.test.daltonism.DaltonismAnomalyType
51+
import ru.rznnike.eyehealthmanager.domain.model.common.DayPart
52+
import ru.rznnike.eyehealthmanager.domain.model.test.nearfar.NearFarAnswerType
5353

5454
object Screens {
5555
object Flow {

app/src/main/java/ru/rznnike/eyehealthmanager/app/di/AppModule.kt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package ru.rznnike.eyehealthmanager.app.di
33
import kotlinx.coroutines.CoroutineScope
44
import kotlinx.coroutines.Dispatchers
55
import kotlinx.coroutines.MainScope
6-
import org.koin.android.ext.koin.androidContext
6+
import org.koin.android.ext.koin.androidApplication
77
import org.koin.dsl.module
88
import ru.rznnike.eyehealthmanager.app.crash.CrashlyticsProvider
99
import ru.rznnike.eyehealthmanager.app.crash.CrashlyticsProviderImpl
@@ -12,29 +12,32 @@ import ru.rznnike.eyehealthmanager.app.dispatcher.external.ExternalIntentDispatc
1212
import ru.rznnike.eyehealthmanager.app.dispatcher.notifier.Notifier
1313
import ru.rznnike.eyehealthmanager.app.global.presentation.ErrorHandler
1414
import ru.rznnike.eyehealthmanager.app.observer.AppLifeCycleObserver
15-
import ru.rznnike.eyehealthmanager.device.notification.Notificator
16-
import ru.rznnike.eyehealthmanager.domain.global.CoroutineProvider
15+
import ru.rznnike.eyehealthmanager.app.notification.Notificator
16+
import ru.rznnike.eyehealthmanager.app.utils.JournalBackupManagerAndroid
17+
import ru.rznnike.eyehealthmanager.app.utils.JournalBackupManagerAndroidImpl
18+
import ru.rznnike.eyehealthmanager.domain.global.CoroutineScopeProvider
1719
import ru.rznnike.eyehealthmanager.domain.global.DispatcherProvider
1820
import java.time.Clock
1921

2022
val appModule = module {
21-
factory { androidContext().resources }
23+
factory { androidApplication().resources }
2224

2325
factory { AppLifeCycleObserver() }
2426
single { Notifier(get()) }
2527
single { ErrorHandler(get(), get()) }
2628
single { EventDispatcher(get()) }
2729
single { ExternalIntentDispatcher(get()) }
28-
single { Notificator(androidContext()) }
30+
single { Notificator() }
2931
single<CrashlyticsProvider> { CrashlyticsProviderImpl() }
3032
single { Clock.systemUTC() }
33+
factory<JournalBackupManagerAndroid> { JournalBackupManagerAndroidImpl() }
3134

32-
single<CoroutineProvider> {
33-
object : CoroutineProvider {
34-
override val scopeIo = CoroutineScope(Dispatchers.IO)
35-
override val scopeMain = MainScope()
36-
override val scopeMainImmediate = CoroutineScope(Dispatchers.Main.immediate)
37-
override val scopeUnconfined = CoroutineScope(Dispatchers.Unconfined)
35+
single<CoroutineScopeProvider> {
36+
object : CoroutineScopeProvider {
37+
override val ui = MainScope()
38+
override val default = CoroutineScope(Dispatchers.Default)
39+
override val io = CoroutineScope(Dispatchers.IO)
40+
override val unconfined = CoroutineScope(Dispatchers.Unconfined)
3841
}
3942
}
4043

app/src/main/java/ru/rznnike/eyehealthmanager/app/di/GatewayModule.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import ru.rznnike.eyehealthmanager.domain.gateway.TestGateway
1313
import ru.rznnike.eyehealthmanager.domain.gateway.UserGateway
1414

1515
val gatewayModule = module {
16-
single<UserGateway> { UserGatewayImpl(get()) }
17-
single<NotificationGateway> { NotificationGatewayImpl() }
16+
single<UserGateway> { UserGatewayImpl(get(), get()) }
17+
single<NotificationGateway> { NotificationGatewayImpl(get()) }
1818
single<TestGateway> { TestGatewayImpl(get(), get(), get()) }
19-
single<AnalysisGateway> { AnalysisGatewayImpl(get(), get()) }
20-
single<DevGateway> { DevGatewayImpl(get(), get()) }
19+
single<AnalysisGateway> { AnalysisGatewayImpl(get(), get(), get()) }
20+
single<DevGateway> { DevGatewayImpl(get(), get(), get()) }
2121
}

app/src/main/java/ru/rznnike/eyehealthmanager/app/di/InteractorModule.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ val interactorModule = module {
4040
single { DeleteAllTestResultsUseCase(get(), get()) }
4141
single { DeleteDuplicatesUseCase(get(), get()) }
4242
single { ExportJournalUseCase(get(), get()) }
43-
single { GetAvailableImportTypesUseCase(get(), get()) }
4443
single { ImportJournalUseCase(get(), get()) }
4544

4645
single { GetAnalysisResultUseCase(get(), get()) }

app/src/main/java/ru/rznnike/eyehealthmanager/app/dispatcher/event/EventDispatcher.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package ru.rznnike.eyehealthmanager.app.dispatcher.event
22

33
import kotlinx.coroutines.launch
4-
import ru.rznnike.eyehealthmanager.domain.global.CoroutineProvider
4+
import ru.rznnike.eyehealthmanager.domain.global.CoroutineScopeProvider
55
import java.util.*
66
import kotlin.reflect.KClass
77

88
class EventDispatcher(
9-
private val coroutineProvider: CoroutineProvider
9+
private val coroutineScopeProvider: CoroutineScopeProvider
1010
) {
1111
private val eventListeners = HashMap<String, MutableList<EventListener>>()
1212

@@ -36,16 +36,16 @@ class EventDispatcher(
3636
}
3737

3838
fun removeEventListener(listener: EventListener) = eventListeners
39-
.filter { it.value.size > 0 }
39+
.filter { it.value.isNotEmpty() }
4040
.forEach { it.value.remove(listener) }
4141

4242
fun sendEvent(appEvent: AppEvent) {
4343
val key = appEvent::class.java.name
4444
eventListeners
45-
.filter { it.key == key && it.value.size > 0 }
45+
.filter { it.key == key && it.value.isNotEmpty() }
4646
.forEach {
4747
it.value.forEach { listener ->
48-
coroutineProvider.scopeMain.launch {
48+
coroutineScopeProvider.ui.launch {
4949
listener.onEvent(appEvent)
5050
}
5151
}

app/src/main/java/ru/rznnike/eyehealthmanager/app/dispatcher/external/ExternalIntentDispatcher.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package ru.rznnike.eyehealthmanager.app.dispatcher.external
33
import kotlinx.coroutines.flow.MutableStateFlow
44
import kotlinx.coroutines.flow.asStateFlow
55
import kotlinx.coroutines.launch
6-
import ru.rznnike.eyehealthmanager.domain.global.CoroutineProvider
7-
import ru.rznnike.eyehealthmanager.domain.model.ExternalIntentData
6+
import ru.rznnike.eyehealthmanager.domain.global.CoroutineScopeProvider
7+
import ru.rznnike.eyehealthmanager.domain.model.common.ExternalIntentData
88

99
class ExternalIntentDispatcher(
10-
private val coroutineProvider: CoroutineProvider
10+
private val coroutineScopeProvider: CoroutineScopeProvider
1111
) {
1212
private val eventsFlow = MutableStateFlow<ExternalIntentData>(
1313
ExternalIntentData.App().apply { processed = true }
@@ -16,7 +16,7 @@ class ExternalIntentDispatcher(
1616
fun subscribe() = eventsFlow.asStateFlow()
1717

1818
fun send(data: ExternalIntentData) {
19-
coroutineProvider.scopeIo.launch {
19+
coroutineScopeProvider.io.launch {
2020
eventsFlow.emit(data)
2121
}
2222
}

app/src/main/java/ru/rznnike/eyehealthmanager/app/dispatcher/notifier/Notifier.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import androidx.annotation.StringRes
44
import kotlinx.coroutines.flow.MutableSharedFlow
55
import kotlinx.coroutines.flow.asSharedFlow
66
import kotlinx.coroutines.launch
7-
import ru.rznnike.eyehealthmanager.domain.global.CoroutineProvider
7+
import ru.rznnike.eyehealthmanager.domain.global.CoroutineScopeProvider
88

99
class Notifier(
10-
private val coroutineProvider: CoroutineProvider
10+
private val coroutineScopeProvider: CoroutineScopeProvider
1111
) {
1212
private val notifierFlow = MutableSharedFlow<SystemMessage>()
1313

@@ -86,7 +86,7 @@ class Notifier(
8686
)
8787

8888
private fun emitMessage(message: SystemMessage) {
89-
coroutineProvider.scopeIo.launch {
89+
coroutineScopeProvider.io.launch {
9090
notifierFlow.emit(message)
9191
}
9292
}

0 commit comments

Comments
 (0)