If you aren't familiar with my spare-time project - Hiver - you can check out the intro post from a few weeks ago.
It's been a couple of weeks since I decided to start coding a Hiver mobile app. It's been an interesting journey so far. I'm learning new skills and it's really giving me a fun project to work on in my spare time.
React Native
What's React Native? It's a javascript (and XML-like) framework that is used to build mobile apps for Android and IOS. You code in Javascript, and the framework compiles your code in mobile native source code. A single code base for both mobile platforms. Sorry, Windows.. 😂. It was created by Facebook and apps such as Facebook and Instagram are written with it.
There are a number of frameworks that I could have chosen, and of course there are the native languages - Java, for Android, and Objective-C for IOS. Not that I'd be mad enough to create and maintain two separate code bases, one for each mobile platform, but it was an easy move to choose React Native, as the web version of Hiver is written in Javascript.
So it was an easy port from the web to mobile? As we Australians say - yeah nah. While the framework of the app is roughly the same between web and mobile, the implementation model is very different in React Native. Well at least that's how I've found it.
Another challenge was integrating Hive code libraries so that I can interact with the blockchain. My goto for web apps has always been Hive-JS, as it's the best documented JS library by a long shot, and quite a few devs know the in's and out's of it. There was a problem, though. In fact there were two problems:
One, I was using another framework on top of React Native called Expo. It's a common starting point for React Native apps. Due to a bug in the framework (not everyone experiences this bug), it wasn't possible to test my app on a virtual or physical device. To test the app it was possible to emulate it in a web browser. And this worked smashingly! I was coding away like a champion. Eventually I decided I really needed to test it in a virtual and real device. "Ejecting" out of the Expo framework leaves a "bare" React Native project which can be tested on all sorts of devices and emulators. Cue disappointment. My app wouldn't work on any devices ☹️.
DHive JS
There were a bunch of reasons why it wouldn't work, but the main one was that Hive-JS won't work in a React Native app. The reason is that Hive-JS relies on a native NodeJS library - Crypto. And native NodeJS libraries aren't supported by React Native. I tried a few workarounds to see if I could get it working, but it was all in vane. In the end on the advice of @good-karma I swapped libraries to DHive javascript. Like so much on the Hive blockchain, it's poorly documented, but thanks to some help from @good-karma and a couple of others I worked it out and it is now working perfectly in the app. And yes, the app now runs on devices!
What can the app do?
Well so far I've only implemented the main page (where all 'tweets' are listed), and the logic for voting and tweeting. Voting is almost fully implemented (haven't coded the vote slider yet). Now that the structure of tweets has been coded, and the logic of voting/tweeting coded, it's going to be much easier from now on. Each page - tweets, following, notifications, uses the same framework as the main page. This is where the beauty of modular programming comes in. The modular framework means the remaining pages will need far far less coding than the main page. It's kind of like cut and pasting, but it's even easier than that. Just refer to a block of code (module) that already exist.
What's still to come?
As I mentioned the individual tweet page, following page and notification tweet list are the main components left to do. More specific features include notification system, vote slider, and perhaps a 'trending' page if I can work it out. And then any features that the community want (and that I have the ability to code 😉).
It's still a "proof of concept", and one I am slowly building in my spare time. I really hope I can get all the way there and release a mobile app to the app stores. It's at that point that we can decide if it is worth pursuing properly, or if it is destined to become another forgotten relic of the Hive blockchain...
Hi @revo.
Have written to you on Discord.
Maybe you can have a look.
Retinox
Great to see progress, keep up the good work!
excellent initiative friend I use hive from my phone and I really like it but it is difficult to build a post because of the view that gives the markdown, it would be great if we could at least interact, vote mention and comment at least, because it could be done more immediately.📲
I'll keep an eye out for your updates. Success!