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

Integrate full node POC code into Bisq-mobile project #6

Closed
HenrikJannsen opened this issue Oct 24, 2024 · 12 comments
Closed

Integrate full node POC code into Bisq-mobile project #6

HenrikJannsen opened this issue Oct 24, 2024 · 12 comments
Assignees
Labels
AndroidNode This issue is applicable ONLY for `androidNode` app

Comments

@HenrikJannsen
Copy link
Contributor

HenrikJannsen commented Oct 24, 2024

https://github.com/HenrikJannsen/andorid_only_poc/tree/use-code-from-production-pr is a plain Android project. We should move the into the new project structure of bisq-mobile.

To consider:

  • protobuf related code should be part of the client code (in this case, part of the androidNode module)
  • work on this should start after -> Add Bisq 2 library dependencies #5
@rodvar rodvar added the AndroidNode This issue is applicable ONLY for `androidNode` app label Oct 24, 2024
@rodvar
Copy link
Collaborator

rodvar commented Oct 24, 2024

I will be working on this after setting up the app architecture basic layers

@rodvar
Copy link
Collaborator

rodvar commented Nov 6, 2024

work on this can start now though not merged yet, leveraging this PR -> bisq-network/bisq2#2965

@rodvar
Copy link
Collaborator

rodvar commented Nov 8, 2024

#29 allows to work on this now.

to generate the jars at the moment please download this PR branch is PR branch and run ./gradlew clean build publishAll

@rodvar rodvar self-assigned this Nov 8, 2024
@rodvar
Copy link
Collaborator

rodvar commented Nov 8, 2024

bisq-network/bisq2#2965 merged, we can go full speed on this one now

@rodvar
Copy link
Collaborator

rodvar commented Nov 9, 2024

POC native android bisq2

Analysis

  • MVController design pattern with services following Bisq2 style being the MainActivity the main view
  • the meat is in the controller which has an init phase that sets everything up for usage (this can correlate directly to our MainPresenter for androidNode)
  • init: setup of jars statics (probably better to strip out of the controller/presenter)
  • init: instanciation of services (we can replace later with DI )
  • initialize: setups all the services needed by the main custom AndroidApplicationService (wraps all the usages of bisq2 jars services :) )
  • currently the POC is creating a new profile on each session , there must be some persistance setup work to be done to avoid this
  • the above also prints useful data to screen (like chat messages, connected nodes, etc) all by observing changes to data models
  • all the features implemented in the poc are listed under the comment // Use cases which is very handy for migrating one by one and test through-fully

Adaptations done

  • Migrated all the POC code to Kotlin which was like a breeze with AndroidStudio code convertion tool
  • Changed some usages of Java futures for Kotlin co routines that gives you more control and are better optimised for mobile env

Notes for migration and next steps

  • bisq2 jars sync/async is pure java futures. As long as we wrap everything in co-routines I think it should be fine but this needs to be tested through-fully specially on real devices to analyse energy / battery consumption and error handling in case the OS kills anything
  • choose features one by one and start building the Main presenter for androidNode. For now this is fine, we can deal later on how to make it compatible with the app shared presentation this would most probably be some kind of repository where all the stuff gets saved and the shared logic can pick it up (injecting the right repositories). For now let's focus on having a KMP android node that can connect to bisq network and interact for trading.

@HenrikJannsen
Copy link
Contributor Author

  • currently the POC is creating a new profile on each session , there must be some persistance setup work to be done to avoid this

No, its persisted already. With #34 you get all running. You need to have a localhost seed node and desktop app with some chat messages to see the messages...

@rodvar
Copy link
Collaborator

rodvar commented Nov 10, 2024

  • currently the POC is creating a new profile on each session , there must be some persistance setup work to be done to avoid this

No, its persisted already. With #34 you get all running. You need to have a localhost seed node and desktop app with some chat messages to see the messages...

great to hear @HenrikJannsen just had a look at it, don't fully get why all the proto files are gone are we using the ones coming in the Jars..? I'll test this in a moment

@HenrikJannsen
Copy link
Contributor Author

are we using the ones coming in the Jars..?

Yes.

@rodvar
Copy link
Collaborator

rodvar commented Nov 13, 2024

OK, got the POC fully integrated, some considerations in respect to the description:

  • we ended up using protobuf that comes with the Bisq2 jars, couldn't get it to work with protobuf-lite so that's disregarded (~6MB + debug apk diff)
  • it's all working as in the android native POC :D
  • next steps are refactors to allow to connect the data comming from the bisq network to the needs of the shared presentation, and further implementation

I think I'll wrap up this work to create a PR, review and merge, and then create issues to do this more organised.
The main step would be using shared repositories so that the androidNode networking can save the information in a way that the UI will expect it later. Might need some sort of bridge software to translate from one to the other, but if I do it this way the devs helping with UI can continue developing the models and repositories they need.
In that arch push would be good to add some sort of KMP persistance for the general app purpose, so regardless of where things are read and written, it will be done.

I have all this in mind will come up with an organised way to bring this in gradually if everyone is on board.

@HenrikJannsen
Copy link
Contributor Author

Might need some sort of bridge software to translate from one to the other, but if I do it this way the devs helping with UI can continue developing the models and repositories they need.

Can you elaborate more what you mean here?

@rodvar
Copy link
Collaborator

rodvar commented Nov 13, 2024

Might need some sort of bridge software to translate from one to the other, but if I do it this way the devs helping with UI can continue developing the models and repositories they need.

Can you elaborate more what you mean here?

discussed over matrix - For the record, it means bridging whatever models the datasource uses (e.g. protobuf models for p2p comms) into the shared repositories model definitions that the shared UI uses (our bisqapps model definitions)

@rodvar
Copy link
Collaborator

rodvar commented Nov 13, 2024

the foundations are laid with the merged PR, new issues will be created soon to continue work on this in a per use case base

@rodvar rodvar closed this as completed Nov 13, 2024
@rodvar rodvar added this to the MVP (version 0.1.0) milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AndroidNode This issue is applicable ONLY for `androidNode` app
Projects
None yet
Development

No branches or pull requests

2 participants