diff --git a/androidApp/dependencies/demoDebugRuntimeClasspath.txt b/androidApp/dependencies/demoDebugRuntimeClasspath.txt index 6bc5ee945..be9a20c67 100644 --- a/androidApp/dependencies/demoDebugRuntimeClasspath.txt +++ b/androidApp/dependencies/demoDebugRuntimeClasspath.txt @@ -188,11 +188,9 @@ com.russhwolf:multiplatform-settings-no-arg:1.2.0 com.russhwolf:multiplatform-settings-serialization-android-debug:1.2.0 com.russhwolf:multiplatform-settings-serialization:1.2.0 com.russhwolf:multiplatform-settings:1.2.0 -com.squareup.okhttp3:logging-interceptor:4.12.0 com.squareup.okhttp3:okhttp:4.12.0 com.squareup.okio:okio-jvm:3.9.1 com.squareup.okio:okio:3.9.1 -com.squareup.retrofit2:adapter-rxjava2:2.11.0 com.squareup.retrofit2:converter-gson:2.11.0 com.squareup.retrofit2:retrofit:2.11.0 dev.chrisbanes.snapper:snapper:0.2.2 @@ -239,7 +237,6 @@ io.ktor:ktor-websocket-serialization:3.0.1 io.ktor:ktor-websockets-jvm:3.0.1 io.ktor:ktor-websockets:3.0.1 io.michaelrocks:libphonenumber-android:8.13.35 -io.reactivex.rxjava2:rxjava:2.2.21 jakarta.inject:jakarta.inject-api:2.0.1 javax.inject:javax.inject:1 net.bytebuddy:byte-buddy-agent:1.14.8 @@ -276,7 +273,7 @@ org.jetbrains.compose.ui:ui:1.7.0-rc01 org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 @@ -306,5 +303,4 @@ org.jetbrains:annotations:23.0.0 org.jspecify:jspecify:1.0.0 org.mockito:mockito-core:5.6.0 org.objenesis:objenesis:3.3 -org.reactivestreams:reactive-streams:1.0.4 org.slf4j:slf4j-api:2.0.16 diff --git a/androidApp/dependencies/demoReleaseRuntimeClasspath.txt b/androidApp/dependencies/demoReleaseRuntimeClasspath.txt index 830fb760e..8f6afb06d 100644 --- a/androidApp/dependencies/demoReleaseRuntimeClasspath.txt +++ b/androidApp/dependencies/demoReleaseRuntimeClasspath.txt @@ -183,11 +183,9 @@ com.russhwolf:multiplatform-settings-no-arg:1.2.0 com.russhwolf:multiplatform-settings-serialization-android:1.2.0 com.russhwolf:multiplatform-settings-serialization:1.2.0 com.russhwolf:multiplatform-settings:1.2.0 -com.squareup.okhttp3:logging-interceptor:4.12.0 com.squareup.okhttp3:okhttp:4.12.0 com.squareup.okio:okio-jvm:3.9.1 com.squareup.okio:okio:3.9.1 -com.squareup.retrofit2:adapter-rxjava2:2.11.0 com.squareup.retrofit2:converter-gson:2.11.0 com.squareup.retrofit2:retrofit:2.11.0 dev.chrisbanes.snapper:snapper:0.2.2 @@ -234,7 +232,6 @@ io.ktor:ktor-websocket-serialization:3.0.1 io.ktor:ktor-websockets-jvm:3.0.1 io.ktor:ktor-websockets:3.0.1 io.michaelrocks:libphonenumber-android:8.13.35 -io.reactivex.rxjava2:rxjava:2.2.21 jakarta.inject:jakarta.inject-api:2.0.1 javax.inject:javax.inject:1 net.bytebuddy:byte-buddy-agent:1.14.8 @@ -271,7 +268,7 @@ org.jetbrains.compose.ui:ui:1.7.0-rc01 org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 @@ -301,5 +298,4 @@ org.jetbrains:annotations:23.0.0 org.jspecify:jspecify:1.0.0 org.mockito:mockito-core:5.6.0 org.objenesis:objenesis:3.3 -org.reactivestreams:reactive-streams:1.0.4 org.slf4j:slf4j-api:2.0.16 diff --git a/androidApp/dependencies/prodDebugRuntimeClasspath.txt b/androidApp/dependencies/prodDebugRuntimeClasspath.txt index 0700a668d..be9a20c67 100644 --- a/androidApp/dependencies/prodDebugRuntimeClasspath.txt +++ b/androidApp/dependencies/prodDebugRuntimeClasspath.txt @@ -188,11 +188,9 @@ com.russhwolf:multiplatform-settings-no-arg:1.2.0 com.russhwolf:multiplatform-settings-serialization-android-debug:1.2.0 com.russhwolf:multiplatform-settings-serialization:1.2.0 com.russhwolf:multiplatform-settings:1.2.0 -com.squareup.okhttp3:logging-interceptor:4.12.0 com.squareup.okhttp3:okhttp:4.12.0 com.squareup.okio:okio-jvm:3.9.1 com.squareup.okio:okio:3.9.1 -com.squareup.retrofit2:adapter-rxjava2:2.11.0 com.squareup.retrofit2:converter-gson:2.11.0 com.squareup.retrofit2:retrofit:2.11.0 dev.chrisbanes.snapper:snapper:0.2.2 @@ -275,7 +273,7 @@ org.jetbrains.compose.ui:ui:1.7.0-rc01 org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 @@ -305,5 +303,4 @@ org.jetbrains:annotations:23.0.0 org.jspecify:jspecify:1.0.0 org.mockito:mockito-core:5.6.0 org.objenesis:objenesis:3.3 -org.reactivestreams:reactive-streams:1.0.4 org.slf4j:slf4j-api:2.0.16 diff --git a/androidApp/dependencies/prodReleaseRuntimeClasspath.txt b/androidApp/dependencies/prodReleaseRuntimeClasspath.txt index 93a58fb95..8f6afb06d 100644 --- a/androidApp/dependencies/prodReleaseRuntimeClasspath.txt +++ b/androidApp/dependencies/prodReleaseRuntimeClasspath.txt @@ -183,13 +183,9 @@ com.russhwolf:multiplatform-settings-no-arg:1.2.0 com.russhwolf:multiplatform-settings-serialization-android:1.2.0 com.russhwolf:multiplatform-settings-serialization:1.2.0 com.russhwolf:multiplatform-settings:1.2.0 -com.squareup.okhttp3:logging-interceptor:4.12.0 com.squareup.okhttp3:okhttp:4.12.0 com.squareup.okio:okio-jvm:3.9.1 com.squareup.okio:okio:3.9.1 -com.squareup.retrofit2:adapter-rxjava2:2.11.0 -com.squareup.okio:okio-jvm:3.6.0 -com.squareup.okio:okio:3.6.0 com.squareup.retrofit2:converter-gson:2.11.0 com.squareup.retrofit2:retrofit:2.11.0 dev.chrisbanes.snapper:snapper:0.2.2 @@ -236,7 +232,6 @@ io.ktor:ktor-websocket-serialization:3.0.1 io.ktor:ktor-websockets-jvm:3.0.1 io.ktor:ktor-websockets:3.0.1 io.michaelrocks:libphonenumber-android:8.13.35 -io.reactivex.rxjava2:rxjava:2.2.21 jakarta.inject:jakarta.inject-api:2.0.1 javax.inject:javax.inject:1 net.bytebuddy:byte-buddy-agent:1.14.8 @@ -273,7 +268,7 @@ org.jetbrains.compose.ui:ui:1.7.0-rc01 org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 @@ -303,5 +298,4 @@ org.jetbrains:annotations:23.0.0 org.jspecify:jspecify:1.0.0 org.mockito:mockito-core:5.6.0 org.objenesis:objenesis:3.3 -org.reactivestreams:reactive-streams:1.0.4 org.slf4j:slf4j-api:2.0.16 diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index 551ae8b4d..97118723d 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -31,9 +31,9 @@ android { kotlin { sourceSets { commonMain.dependencies { -// api(projects.core.common) + api(projects.core.common) implementation(projects.core.model) -// implementation(projects.core.datastore) + implementation(projects.core.datastore) implementation(libs.kotlinx.serialization.json) implementation(libs.ktor.client.core) implementation(libs.ktor.client.json) @@ -44,9 +44,6 @@ kotlin { implementation(libs.ktor.serialization.kotlinx.json) implementation(libs.ktorfit.lib) implementation(libs.squareup.okio) - // TODO remove this dependency from here after common module successfully migrated to - // KMP - api(libs.kermit.logging) } androidMain.dependencies { implementation(libs.ktor.client.okhttp) diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/BaseApiManager.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/BaseApiManager.kt deleted file mode 100644 index e2f54b60a..000000000 --- a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/BaseApiManager.kt +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2024 Mifos Initiative - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md - */ -package org.mifos.mobile.core.network - -import org.mifos.mobile.core.network.services.AuthenticationService -import org.mifos.mobile.core.network.services.BeneficiaryService -import org.mifos.mobile.core.network.services.ClientChargeService -import org.mifos.mobile.core.network.services.ClientService -import org.mifos.mobile.core.network.services.GuarantorService -import org.mifos.mobile.core.network.services.LoanAccountsListService -import org.mifos.mobile.core.network.services.NotificationService -import org.mifos.mobile.core.network.services.RecentTransactionsService -import org.mifos.mobile.core.network.services.RegistrationService -import org.mifos.mobile.core.network.services.SavingAccountsListService -import org.mifos.mobile.core.network.services.ThirdPartyTransferService -import org.mifos.mobile.core.network.services.UserDetailsService - -class BaseApiManager( - private val authenticationService: AuthenticationService, - private val clientsService: ClientService, - private val savingAccountsListService: SavingAccountsListService, - private val loanAccountsListService: LoanAccountsListService, - private val recentTransactionsService: RecentTransactionsService, - private val clientChargeService: ClientChargeService, - private val beneficiaryService: BeneficiaryService, - private val thirdPartyTransferService: ThirdPartyTransferService, - private val registrationService: RegistrationService, - private val notificationService: NotificationService, - private val userDetailsService: UserDetailsService, - private val guarantorService: GuarantorService, -) { - val authenticationApi: AuthenticationService - get() = authenticationService - val clientsApi: ClientService - get() = clientsService - val savingAccountsListApi: SavingAccountsListService - get() = savingAccountsListService - val loanAccountsListApi: LoanAccountsListService - get() = loanAccountsListService - val recentTransactionsApi: RecentTransactionsService - get() = recentTransactionsService - val clientChargeApi: ClientChargeService - get() = clientChargeService - val beneficiaryApi: BeneficiaryService - get() = beneficiaryService - val thirdPartyTransferApi: ThirdPartyTransferService - get() = thirdPartyTransferService - val registrationApi: RegistrationService - get() = registrationService - val notificationApi: NotificationService - get() = notificationService - val userDetailsApi: UserDetailsService - get() = userDetailsService - val guarantorApi: GuarantorService - get() = guarantorService -} diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/NetworkModule.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/NetworkModule.kt index e1fafe81c..727aef6a0 100644 --- a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/NetworkModule.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/NetworkModule.kt @@ -12,7 +12,7 @@ package org.mifos.mobile.core.network.di import io.ktor.client.HttpClient import io.ktor.client.plugins.auth.Auth import org.koin.dsl.module -import org.mifos.mobile.core.datastore.PreferencesHelper +import org.mifos.mobile.core.datastore.UserPreferencesRepository import org.mifos.mobile.core.network.DataManager import org.mifos.mobile.core.network.KtorfitClient import org.mifos.mobile.core.network.ktorHttpClient @@ -22,12 +22,12 @@ import org.mifos.mobile.core.network.utils.KtorInterceptor val NetworkModule = module { single(KtorClient) { - val preferencesRepository = get() + val preferencesRepository = get() ktorHttpClient.config { install(Auth) install(KtorInterceptor) { - getToken = { preferencesRepository.authToken } + getToken = { preferencesRepository.token.value } } } } diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/BaseURL.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/BaseURL.kt index 5a2360b98..9e00e366f 100644 --- a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/BaseURL.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/BaseURL.kt @@ -21,8 +21,7 @@ class BaseURL { } companion object { - // TODO replace demo with gsoc - const val API_ENDPOINT = "demo.mifos.community" + const val API_ENDPOINT = "gsoc.mifos.community" const val API_PATH = "/fineract-provider/api/v1/" const val PROTOCOL_HTTPS = "https://" } diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/KtorInterceptor.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/KtorInterceptor.kt index 95d825fef..9a364b5fa 100644 --- a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/KtorInterceptor.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/KtorInterceptor.kt @@ -14,6 +14,7 @@ import io.ktor.client.plugins.HttpClientPlugin import io.ktor.client.request.HttpRequestPipeline import io.ktor.client.request.header import io.ktor.util.AttributeKey +import org.mifos.mobile.core.datastore.UserPreferencesRepository class KtorInterceptor( private val getToken: () -> String?, @@ -51,7 +52,7 @@ class Config { } class KtorInterceptorRe( - private val preferencesHelper: PreferencesHelper, + private val repository: UserPreferencesRepository, ) { companion object Plugin : HttpClientPlugin { private const val HEADER_TENANT = "Fineract-Platform-TenantId" @@ -84,5 +85,5 @@ class KtorInterceptorRe( } class ConfigRe { - lateinit var preferencesHelper: PreferencesHelper + lateinit var repository: UserPreferencesRepository }