diff --git a/bisqapps/androidNode/src/androidMain/kotlin/network/bisq/mobile/android/node/MainActivity.kt b/bisqapps/androidNode/src/androidMain/kotlin/network/bisq/mobile/android/node/MainActivity.kt index 70828de0..95877343 100644 --- a/bisqapps/androidNode/src/androidMain/kotlin/network/bisq/mobile/android/node/MainActivity.kt +++ b/bisqapps/androidNode/src/androidMain/kotlin/network/bisq/mobile/android/node/MainActivity.kt @@ -5,7 +5,6 @@ import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview -import network.bisq.mobile.domain.data.repository.SingleObjectRepository import network.bisq.mobile.presentation.MainPresenter import network.bisq.mobile.presentation.ui.App import org.koin.android.ext.android.inject diff --git a/bisqapps/androidNode/src/androidMain/kotlin/network/bisq/mobile/android/node/di/AndroidNodeModule.kt b/bisqapps/androidNode/src/androidMain/kotlin/network/bisq/mobile/android/node/di/AndroidNodeModule.kt index 6c1afbbc..ca1d6bb7 100644 --- a/bisqapps/androidNode/src/androidMain/kotlin/network/bisq/mobile/android/node/di/AndroidNodeModule.kt +++ b/bisqapps/androidNode/src/androidMain/kotlin/network/bisq/mobile/android/node/di/AndroidNodeModule.kt @@ -1,9 +1,14 @@ package network.bisq.mobile.android.node.di +import bisq.security.SecurityService +import bisq.user.identity.UserIdentityService import network.bisq.mobile.android.node.domain.data.repository.NodeGreetingRepository import network.bisq.mobile.android.node.presentation.MainNodePresenter +import network.bisq.mobile.android.node.service.AndroidApplicationService +import network.bisq.mobile.android.node.service.AndroidMemoryReportService import network.bisq.mobile.presentation.MainPresenter import network.bisq.mobile.presentation.ui.AppPresenter +import org.koin.android.ext.koin.androidContext import org.koin.dsl.bind import org.koin.dsl.module @@ -13,4 +18,24 @@ val androidNodeModule = module { // this line showcases both, the posibility to change behaviour of the app by changing one definiton // and binding the same obj to 2 different abstractions single { MainNodePresenter(get()) } bind AppPresenter::class + + // Services +// TODO might not work because of the jars dependencies, needs more work +// single { +// val context = androidContext() +// AndroidMemoryReportService(context) +// } +// single { +// val filesDirsPath = androidContext().filesDir.toPath() +// val androidMemoryService: AndroidMemoryReportService = get() +// AndroidApplicationService(androidMemoryService, filesDirsPath) +// } +// single { +// val applicationService: AndroidApplicationService = get() +// applicationService.userService.userIdentityService +// } +// single { +// val applicationService: AndroidApplicationService = get() +// applicationService.securityService +// } } \ No newline at end of file diff --git a/bisqapps/iosClient/iosClient/ContentView.swift b/bisqapps/iosClient/iosClient/ContentView.swift index b1d3d9ce..5461c8e0 100644 --- a/bisqapps/iosClient/iosClient/ContentView.swift +++ b/bisqapps/iosClient/iosClient/ContentView.swift @@ -6,10 +6,6 @@ import domain struct ComposeView: UIViewControllerRepresentable { - // TODO DI injection is not fully resolved for iOS. we need to fix this with Koin or worst case ask the - // view for the presenter its using - // it can also work because this is just the main presenter that binds to lifecycle, that we allow - // this hardcoded dependnecy here. private let presenter: MainPresenter = get() func makeUIViewController(context: Context) -> UIViewController { diff --git a/bisqapps/iosClient/iosClient/iosClient.swift b/bisqapps/iosClient/iosClient/iosClient.swift index 73717e03..f105b707 100644 --- a/bisqapps/iosClient/iosClient/iosClient.swift +++ b/bisqapps/iosClient/iosClient/iosClient.swift @@ -4,7 +4,6 @@ import presentation @main struct iosClient: App { init() { - // TODO might need to get away the helper approach in favour of adding koin pods in DependenciesProviderHelper().doInitKoin() } diff --git a/bisqapps/shared/domain/build.gradle.kts b/bisqapps/shared/domain/build.gradle.kts index 53d222bb..065b761a 100644 --- a/bisqapps/shared/domain/build.gradle.kts +++ b/bisqapps/shared/domain/build.gradle.kts @@ -35,7 +35,7 @@ kotlin { //put your multiplatform dependencies here implementation(libs.koin.core) implementation(libs.kotlinx.coroutines) - + implementation(libs.logging.kermit) } commonTest.dependencies { implementation(libs.kotlin.test) diff --git a/bisqapps/shared/domain/src/commonMain/kotlin/network/bisq/mobile/domain/data/repository/SingleObjectRepository.kt b/bisqapps/shared/domain/src/commonMain/kotlin/network/bisq/mobile/domain/data/repository/SingleObjectRepository.kt index 689393e7..d16c58ed 100644 --- a/bisqapps/shared/domain/src/commonMain/kotlin/network/bisq/mobile/domain/data/repository/SingleObjectRepository.kt +++ b/bisqapps/shared/domain/src/commonMain/kotlin/network/bisq/mobile/domain/data/repository/SingleObjectRepository.kt @@ -1,12 +1,11 @@ package network.bisq.mobile.domain.data.repository +import co.touchlab.kermit.Logger import kotlinx.coroutines.* import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import network.bisq.mobile.domain.data.model.BaseModel -import network.bisq.mobile.domain.data.model.Greeting import network.bisq.mobile.domain.data.persistance.PersistenceSource -import kotlin.jvm.JvmStatic /** * Repository implementation for a single object. Allows for persistance if the persistance source if provided, otherwise is mem-only. @@ -17,6 +16,8 @@ abstract class SingleObjectRepository( private val persistenceSource: PersistenceSource? = null ) : Repository { + private val logger = Logger.withTag(SingleObjectRepository::class.simpleName ?: "SingleObjectRepository") + private val _data = MutableStateFlow(null) override val data: StateFlow = _data @@ -53,12 +54,12 @@ abstract class SingleObjectRepository( override suspend fun clear() { try { + persistenceSource?.clear() scope.cancel() } catch (e: Exception) { - // TODO log error + logger.e("Failed to cancel repository coroutine scope", e) } finally { _data.value = null - persistenceSource?.clear() } } } \ No newline at end of file