Skip to content

Commit

Permalink
- fix main view controller not attached in ios causing shared ui not…
Browse files Browse the repository at this point in the history
… to progress (#70)

- delete unnecessary platform spread controllers + di: we can assume
   default main controller is client controller
  • Loading branch information
rodvar authored Nov 22, 2024
1 parent f294f59 commit 43c1acd
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 95 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package network.bisq.mobile.client

import android.app.Application
import network.bisq.mobile.client.di.androidClientModule
import network.bisq.mobile.client.di.clientModule
import network.bisq.mobile.domain.di.domainModule
import network.bisq.mobile.presentation.di.presentationModule
Expand All @@ -15,7 +14,7 @@ class MainApplication: Application() {

startKoin {
androidContext(this@MainApplication)
modules(listOf(domainModule, presentationModule, clientModule, androidClientModule))
modules(listOf(domainModule, presentationModule, clientModule))
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ class NodeMainPresenter(
private val supplier: AndroidApplicationService.Supplier,
private val androidMemoryReportService: AndroidMemoryReportService,
private val applicationBootstrapFacade: ApplicationBootstrapFacade
) : MainPresenter() {
) : MainPresenter(applicationBootstrapFacade) {

var applicationServiceInited = false
override fun onViewAttached() {
super.onViewAttached()
// full override
// super.onViewAttached()

if (!applicationServiceInited) {
applicationServiceInited = true
Expand Down
4 changes: 2 additions & 2 deletions bisqapps/iosClient/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ EXTERNAL SOURCES:
:path: "../shared/presentation"

SPEC CHECKSUMS:
domain: 47abf0eea12f1e6f5b4f15c05dd23f437ec5478f
presentation: 55df2024e1ee347459ecf9349d6e1fde59450eef
domain: feb764d7802f6a414d3f649e95721d16a38d018e
presentation: 8c21a3748676af08d28227a02cad92c9a7eeb27a

PODFILE CHECKSUM: e4e5bb187d8247572973af90a35b57b84c96b4c6

Expand Down
4 changes: 2 additions & 2 deletions bisqapps/iosClient/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class LifecycleAwareComposeViewController: UIViewController {
init(presenter: MainPresenter) {
self.presenter = presenter
super.init(nibName: nil, bundle: nil)
presenter.attachView(view: self)
}

required init?(coder: NSCoder) {
Expand All @@ -31,7 +32,7 @@ class LifecycleAwareComposeViewController: UIViewController {
name: UIApplication.didBecomeActiveNotification,
object: nil)
}

@objc private func handleDidBecomeActive() {
presenter.onResume()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ import io.ktor.serialization.kotlinx.json.json
import kotlinx.serialization.json.Json
import kotlinx.serialization.modules.SerializersModule
import kotlinx.serialization.modules.contextual
import network.bisq.mobile.android.node.main.bootstrap.ClientApplicationBootstrapFacade
import network.bisq.mobile.client.service.ApiRequestService
import network.bisq.mobile.domain.client.main.user_profile.ClientUserProfileServiceFacade
import network.bisq.mobile.domain.client.main.user_profile.UserProfileApiGateway
import network.bisq.mobile.domain.data.repository.main.bootstrap.ApplicationBootstrapFacade
import network.bisq.mobile.domain.user_profile.UserProfileServiceFacade
import network.bisq.mobile.utils.ByteArrayAsBase64Serializer
import org.koin.dsl.module


// networking and services dependencies
val clientModule = module {

single {
HttpClient(CIO) {
install(ContentNegotiation) {
Expand All @@ -24,4 +32,11 @@ val clientModule = module {
}
}
}


single<ApplicationBootstrapFacade> { ClientApplicationBootstrapFacade() }

single { ApiRequestService(get(), "10.0.2.2") }
single { UserProfileApiGateway(get()) }
single<UserProfileServiceFacade> { ClientUserProfileServiceFacade(get()) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import co.touchlab.kermit.Logger
import kotlinx.coroutines.flow.*
import network.bisq.mobile.android.node.BuildNodeConfig
import network.bisq.mobile.client.shared.BuildConfig
import network.bisq.mobile.domain.data.repository.main.bootstrap.ApplicationBootstrapFacade
import network.bisq.mobile.presentation.ui.AppPresenter

/**
* Main Presenter as an example of implementation for now.
*/
open class MainPresenter() : BasePresenter(null), AppPresenter {
open class MainPresenter(private val applicationBootstrapFacade: ApplicationBootstrapFacade) : BasePresenter(null), AppPresenter {
lateinit var navController: NavHostController
private set

Expand All @@ -23,6 +24,16 @@ open class MainPresenter() : BasePresenter(null), AppPresenter {
private val _isContentVisible = MutableStateFlow(false)
override val isContentVisible: StateFlow<Boolean> = _isContentVisible

private var applicationServiceInited = false
override fun onViewAttached() {
super.onViewAttached()

if (!applicationServiceInited) {
applicationServiceInited = true
applicationBootstrapFacade.initialize()
}
}

// passthrough example
// private val _greetingText: StateFlow<String> = stateFlowFromRepository(
// repositoryFlow = greetingRepository.data,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package network.bisq.mobile.presentation.di

import androidx.navigation.NavController
import androidx.navigation.NavHostController
import network.bisq.mobile.presentation.MainPresenter
import network.bisq.mobile.presentation.ui.AppPresenter
Expand All @@ -20,7 +19,7 @@ val presentationModule = module {
single(named("RootNavController")) { getKoin().getProperty<NavHostController>("RootNavController") }
single(named("TabNavController")) { getKoin().getProperty<NavHostController>("TabNavController") }

single<MainPresenter> { MainPresenter() } bind AppPresenter::class
single<MainPresenter> { MainPresenter(get()) } bind AppPresenter::class

single {
SplashPresenter(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DependenciesProviderHelper {

fun initKoin() {
val instance = startKoin {
modules(listOf(domainModule, presentationModule, clientModule, iosClientModule))
modules(listOf(domainModule, presentationModule, clientModule))
}

koin = instance.koin
Expand Down

This file was deleted.

0 comments on commit 43c1acd

Please sign in to comment.