Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/android node networking POC integration #38

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
75b9cf3
Remove protobuf files and i18n resources
HenrikJannsen Nov 9, 2024
8409358
Remove mobile package (was first dev app with showing version number)
HenrikJannsen Nov 9, 2024
b03f572
Add multidex dependency, add protobuf source path
HenrikJannsen Nov 9, 2024
173ac68
- small adaptations on android native POC whilst understanding it
rodvar Nov 8, 2024
013c631
- convert android native POC code to Kotlin for easier transition
rodvar Nov 9, 2024
ee7a7bd
- replace completable future with coroutines job
rodvar Nov 9, 2024
d4f3715
- protobuf fixes on POC merged from boilingfrog, fully communicates …
rodvar Nov 11, 2024
a2428a7
- integration of last commit into the androidNode
rodvar Nov 11, 2024
bd95fb7
- integrated services from POC with all their dependencies, ready to…
rodvar Nov 11, 2024
ed0c7c9
- initialize services, added typesafe conf where its expecting it
rodvar Nov 12, 2024
7956c55
- integration of print default sec key and language, printing on sys…
rodvar Nov 12, 2024
ea13fed
Added Koin Dependency (#31)
Nov 12, 2024
884f719
- integrated services from POC with all their dependencies, ready to…
rodvar Nov 11, 2024
439775b
- hardcode presenter dependency till issues with DI Koin and android…
rodvar Nov 12, 2024
f660262
- remove protobuf lite dep causing trouble with protobuf in bisq2 ja…
rodvar Nov 12, 2024
554ecd6
- capable of creating profile if non existent and gets persisted
rodvar Nov 12, 2024
d50bc99
- observe network changes and log, fetch and print btc market price
rodvar Nov 12, 2024
ac67e0e
- private messaging (trading) integration
rodvar Nov 12, 2024
90b621d
- public messaging integration
rodvar Nov 12, 2024
5301180
- Implementation for android node memory report integrated with main…
rodvar Nov 12, 2024
49fe426
- android node ci config to use its own presenter as main
rodvar Nov 13, 2024
31281fd
- integration of app state
rodvar Nov 13, 2024
a093cff
- add cleanup on presenter destruction
rodvar Nov 13, 2024
4fae6fa
- fix userProfile mode package name
rodvar Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 35 additions & 25 deletions bisqapps/androidNode/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import com.google.protobuf.gradle.*
import org.apache.tools.ant.taskdefs.condition.Os
import com.google.protobuf.gradle.proto

plugins {
alias(libs.plugins.kotlinMultiplatform)
Expand Down Expand Up @@ -32,6 +32,11 @@ kotlin {
implementation(compose.preview)
implementation(libs.androidx.activity.compose)
}
androidUnitTest.dependencies {
implementation(libs.mock.io)
implementation(libs.kotlin.test.junit.v180)
implementation(libs.junit)
}
kotlin.srcDirs(
"src/androidMain/kotlin",
"${layout.buildDirectory}/generated/source/proto/debug/java",
Expand All @@ -47,32 +52,28 @@ android {

sourceSets {
getByName("main") {
proto {
srcDir("src/androidMain/proto")
java {
srcDir("src/main/resources")
srcDir("${layout.buildDirectory}/generated/source/proto/debug/java")
srcDir("${layout.buildDirectory}/generated/source/proto/release/java")
proto {
srcDir("${layout.buildDirectory}/extracted-include-protos/debug")
}
}
java.srcDirs(
"src/layout.buildDirectory/kotlin",
"${layout.buildDirectory}/generated/source/proto/debug/java",
"${layout.buildDirectory}/generated/source/proto/release/java"
)
}
}

defaultConfig {
applicationId = "network.bisq.mobile.node"
minSdk = libs.versions.android.node.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
multiDexEnabled = true
versionCode = 1
versionName = project.version.toString()
buildConfigField("String", "APP_VERSION", "\"${version}\"")
buildConfigField("String", "SHARED_VERSION", "\"${sharedVersion}\"")
}

// We don't want to use the protobuf coming in bisq2 core dependencies as we use protobuf-lite for mobile
configurations.all {
exclude(group = "com.google.protobuf", module = "protobuf-java")
}

packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
Expand Down Expand Up @@ -104,17 +105,11 @@ protobuf {
protoc {
artifact = "com.google.protobuf:protoc:4.28.2$archSuffix"
}
plugins {
create("javalite") {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0$archSuffix"
}
}
generateProtoTasks {
all().forEach { task ->
task.inputs.dir("${layout.buildDirectory.get()}/extracted-include-protos/debug")
task.builtins {
create("java") {
option("lite")
}
create("java")
}
}
}
Expand All @@ -125,9 +120,16 @@ dependencies {
debugImplementation(compose.uiTooling)

// bisq2 core dependencies
implementation(libs.bisq.core.common) {
exclude(group = "com.google.protobuf", module = "protobuf-java")
}
implementation(libs.androidx.multidex)
implementation(libs.google.guava)
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
implementation(libs.typesafe.config)

implementation(libs.bouncycastle)
implementation(libs.bouncycastle.pg)

implementation(libs.bisq.core.common)
implementation(libs.bisq.core.i18n)
implementation(libs.bisq.core.persistence)
implementation(libs.bisq.core.security)
Expand All @@ -154,10 +156,18 @@ dependencies {
implementation(libs.bisq.core.presentation)

// protobuf
implementation(libs.protobuf.lite)
implementation(libs.protobuf.gradle.plugin)
implementation(libs.protoc)

implementation(libs.koin.core)
implementation(libs.koin.android)
}

// ensure tests run on J17
tasks.withType<Test> {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(17))
}
)
}
2 changes: 2 additions & 0 deletions bisqapps/androidNode/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name="network.bisq.mobile.android.node.MainApplication"
android:icon="@mipmap/ic_launcher"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.koin.android.ext.android.inject

class MainActivity : ComponentActivity() {
private val presenter : MainPresenter by inject()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
presenter.attachView(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import network.bisq.mobile.presentation.di.presentationModule
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin


class MainApplication : Application() {
override fun onCreate() {
super.onCreate()

startKoin {
androidContext(this@MainApplication)
modules(listOf(androidNodeModule, domainModule, presentationModule))
// order is important, last one is picked for each interface/class key
modules(listOf(domainModule, presentationModule, androidNodeModule))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package network.bisq.mobile.android.node.di

import network.bisq.mobile.android.node.AndroidNodeGreetingFactory
import network.bisq.mobile.android.node.presentation.MainNodePresenter
import network.bisq.mobile.domain.GreetingFactory
import network.bisq.mobile.presentation.MainPresenter
import org.koin.dsl.module

val androidNodeModule = module {
single<GreetingFactory> { AndroidNodeGreetingFactory() }
single<MainPresenter> { MainNodePresenter(get()) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package network.bisq.mobile.android.node.domain.model

import bisq.common.observable.Observable
import bisq.security.pow.ProofOfWork
import lombok.Getter
import lombok.Setter
import java.security.KeyPair

/**
* TODO do we need to make this shared? If so it involves getting rid of the bisq.* deps, lombok and include java.security in shared..
* Most probably we don't and this can be just part of androidNode (we'll know when the bisq-apis gets defined)
*/
@Getter
class UserProfileModel {
@Setter
var keyPair: KeyPair? = null

@Setter
lateinit var pubKeyHash: ByteArray

@Setter
var proofOfWork: ProofOfWork? = null

private val userName = Observable<String>()
val terms = Observable("")
val statement = Observable("")
val nym = Observable<String>()
private val nickName = Observable<String>()
private val profileId = Observable<String>()

val isBusy = Observable<Boolean>()
}
Loading
Loading