-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - add trusted node basic navigation logic customization for xClients, and override on node * - wrap api client in TrustedNodeService to handle it with different components and used it
- Loading branch information
Showing
12 changed files
with
162 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...c/androidMain/kotlin/network/bisq/mobile/android/node/presentation/NodeSplashPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package network.bisq.mobile.android.node.presentation | ||
|
||
import network.bisq.mobile.domain.data.model.Settings | ||
import network.bisq.mobile.domain.data.repository.SettingsRepository | ||
import network.bisq.mobile.domain.service.bootstrap.ApplicationBootstrapFacade | ||
import network.bisq.mobile.domain.service.user_profile.UserProfileServiceFacade | ||
import network.bisq.mobile.presentation.MainPresenter | ||
import network.bisq.mobile.presentation.ui.uicases.startup.SplashPresenter | ||
|
||
class NodeSplashPresenter( | ||
mainPresenter: MainPresenter, | ||
applicationBootstrapFacade: ApplicationBootstrapFacade, | ||
private val userProfileService: UserProfileServiceFacade, | ||
private val settingsRepository: SettingsRepository | ||
) : SplashPresenter(mainPresenter, applicationBootstrapFacade, userProfileService, settingsRepository) { | ||
|
||
/** | ||
* Default implementation in shared is for xClients. Override on node to avoid this. | ||
*/ | ||
override fun doCustomNavigationLogic(settings: Settings) { | ||
// do nothin | ||
} | ||
} |
54 changes: 38 additions & 16 deletions
54
...ommonMain/kotlin/network/bisq/mobile/client/bootstrap/ClientApplicationBootstrapFacade.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
shared/domain/src/commonMain/kotlin/network/bisq/mobile/domain/service/TrustedNodeService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package network.bisq.mobile.domain.service | ||
|
||
import kotlinx.coroutines.CoroutineScope | ||
import network.bisq.mobile.client.websocket.WebSocketClient | ||
import network.bisq.mobile.domain.data.BackgroundDispatcher | ||
import network.bisq.mobile.utils.Logging | ||
|
||
/** | ||
* This service allows to interact with the underlaying connectivity system | ||
* against the trusted node for the client. | ||
*/ | ||
class TrustedNodeService(private val websocketClient: WebSocketClient): Logging { | ||
private val backgroundScope = CoroutineScope(BackgroundDispatcher) | ||
|
||
// TODO websocketClient.isConnected should be observable so that we emit | ||
// events when disconnected and UI can react | ||
fun isConnected() = websocketClient.isConnected | ||
|
||
/** | ||
* Connects to the trusted node, throws an exception if connection fails | ||
*/ | ||
suspend fun connect() { | ||
runCatching { | ||
websocketClient.connect() | ||
}.onSuccess { | ||
log.d { "Connected to trusted node" } | ||
}.onFailure { | ||
log.e { "ERROR: FAILED to connect to trusted node - details above" } | ||
throw it | ||
} | ||
} | ||
|
||
suspend fun disconnect() { | ||
// TODO | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
...monMain/kotlin/network/bisq/mobile/domain/service/bootstrap/ApplicationBootstrapFacade.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters