Skip to content

Commit

Permalink
integrated datastore module
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagarjuna0033 committed Jan 14, 2025
1 parent eddd6e8 commit 405e7a0
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 96 deletions.
6 changes: 1 addition & 5 deletions androidApp/dependencies/demoDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 1 addition & 5 deletions androidApp/dependencies/demoReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
5 changes: 1 addition & 4 deletions androidApp/dependencies/prodDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
8 changes: 1 addition & 7 deletions androidApp/dependencies/prodReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
7 changes: 2 additions & 5 deletions core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,12 +22,12 @@ import org.mifos.mobile.core.network.utils.KtorInterceptor
val NetworkModule = module {

single<HttpClient>(KtorClient) {
val preferencesRepository = get<PreferencesHelper>()
val preferencesRepository = get<UserPreferencesRepository>()

ktorHttpClient.config {
install(Auth)
install(KtorInterceptor) {
getToken = { preferencesRepository.authToken }
getToken = { preferencesRepository.token.value }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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://"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
Expand Down Expand Up @@ -51,7 +52,7 @@ class Config {
}

class KtorInterceptorRe(
private val preferencesHelper: PreferencesHelper,
private val repository: UserPreferencesRepository,
) {
companion object Plugin : HttpClientPlugin<ConfigRe, KtorInterceptorRe> {
private const val HEADER_TENANT = "Fineract-Platform-TenantId"
Expand Down Expand Up @@ -84,5 +85,5 @@ class KtorInterceptorRe(
}

class ConfigRe {
lateinit var preferencesHelper: PreferencesHelper
lateinit var repository: UserPreferencesRepository
}

0 comments on commit 405e7a0

Please sign in to comment.