oxen-io / session-desktop

Session Desktop - Onion routing based messenger
https://getsession.org
GNU General Public License v3.0
1.53k stars 195 forks source link

Unifying clients' codebase using a cross-platform development framework #2623

Open no149 opened 1 year ago

no149 commented 1 year ago

Seeing as the two codebases differ in features and one is lagging behind in some areas and we have to maintain two codebases for the mobile and desktop apps, I was wondering if it would be a good idea to start creating a react-native codebase out of Session-Desktop and eventually make it the only codebase for all Session client projects.

I am right now in the process of exploring this idea, researching the tradeoffs and getting an estimate of how much work needs to be done for this possible process.

Please share your thoughts.

KeeJef commented 1 year ago

Right now we are making an effort to move more of the cross platform code into a library https://github.com/oxen-io/libsession-util, the hope is that most of our core functionality, (path building, encryption, message conflict management etc...) will exist here and clients will act as more of a UI wrapper ontop of this library. We think this is the best way forward to ensure the platforms are a little more in sync and we have less functionality gaps. React native would be a way to do this aswell, but at this point would probably be a very significant undertaking vs this approach.

no149 commented 1 year ago

That would not address the unification of UI code. Also Typescript or Java are more approachable than C++, so more chance of developer involvement.

My question is, assuming enough time and resources, what are the technical downsides to the react-native approach?

no149 commented 1 year ago

It is not as significant an undertaking as you suppose. The desktop app is basically React which I believe can be converted into a react-native app under one month worth of time, by one or two react developers. Alas I do not have the necessary skills to do that in that timeframe, neither I am free everyday and hour because like most of you I am an employed developer by day. That said, I've begin the process on my machine just to get an approximate feel of it. It involves two steps basically:

  1. Remove the Electron code and replace it with react-native code.
  2. Modify the exisiting react code wherever necessary, to the equivalent react-native code.

The first one isn't a major one since Electron code accounts for like under 10% of the whole project. The second step isn't major one either since, as I said above, the code should stay almost be the same between react and react-native. Some jsx needs to be replaced with the react-native paradigm and elements but that's about it.

Also this process doesn't need to be mutually exclusive with the utils project that you mentioned. We can still have that if the need be, and create one UI codebase using react-native on top of it.

We need one or two professional react native developers here. I will contribute whatever I can but before that I would need to become proficient with the react paradigm.

no149 commented 1 year ago

FYI I have started learning react-native and refactoring the Session desktop codebase along the way to make it a react-native application. I'm going to create a repository for that once I feel it is developed enough and ready for that, which should happen in a month.

KeeJef commented 1 year ago

Keep the issue updated, interested to know how you progress

no149 commented 1 year ago

I am progressing very slowly. Here's the repo anyhow: https://github.com/no149/Session-Expo

I am in the process of disabling all nodejs/electron specific calls for now so that it compiles at least using tsc. I need a helping hand in that procedure. Those lines can be either disabled for now or replaced with equivalent Expo/React-native calls. That's the first major step. Afterwards, we can gradually convert it to the Expo UI paradigm. I already have a sample messenger UI ready which can be used as a jump-start to speed up the UI building process.

no149 commented 1 year ago

Hello? I need help with this transition. Anyone please? P.S I've lost my day to day job for now. So I have more time now.

zcyph commented 1 year ago

Hi @no149, glad to see this effort going on!

I'm sure someone more helpful than me will be able to get back to you on that, but in the meantime you might be interested in joining these rooms on Session where some dev related topics get discussed:

https://open.getsession.org/session-dev?public_key=a03c383cf63c3c4efe67acc52112a6dd734b3a946b9545f488aaa93da7991238

https://sog.zcyph.cc/sessiondev?public_key=e56fa54f9da6df91928f97023e8651e2df10fb6cf743a1ec96d0543acb8f2e7a

KeeJef commented 11 months ago

Hey, any updates as to how this is progressing @no149 ? Happy to loop you in directly with Session desktop development team if that would help

no149 commented 11 months ago

Unfortunately I lost interest while working on it, primarily because I was alone (true, I could ask for help from the above mentioned channels) and I had to learn react native at the same time, which was a twofold struggle. I also have a day job so...

Anyhow, I am working on another project at this time which is still related to mobile development, but it's based on dotnet MAUI this time around since dotnet and C# have been my primary framework for years and I feel more comfortable with the environment even though it is lagging behind react in terms of ecosystem.

For what it's worth, if anybody's interested, it is possible to unify the codebase using MAUI as well, by using the IKVM converter to run the Session's android service codebase on dotnet and implement a single UI on top of that.

no149 commented 9 months ago

How can I make jar files out of the Android build? Edit - I need it for the purpose of testing the IKVM converter to run Java code on dotnet.