Posted on Sat 08 August 2020 in Devlog
I started working on Pantrific again a couple of weeks ago with Dwayne. The original codebase was written using AngularJS for the front-end and Java with JEE for the back-end. The new codebase is being written with Angular for the front-end and NodeJS / Express / Mongo / TypeScript for the back-end. The goal is to get an MVP out the door as quickly as possible without all of the original bells and whistles. It will be just like any other recipe site, but it'll be our own. We're currently wrapping up milestone 1.
At work, it's been two months since I started applying the Repository pattern to our code base. It slid it quite nicely and we're close to releasing our first app. Things can always be better but overall I am proud of what we've put together. Moving forward, I want to focus on fixing our DialogFragments on Android.
Recently, I converted all of our Dialogs to DialogFragments so they are lifecycle aware. Prior to this we would see a "WindowLeak" log message every time the device was rotated. This implies that the dialog or parent of the dialog was not cleaned up and disposed of properly which can cause memory leaks.
While doing the conversion, I ran into an interesting problem. We held on to callback functions for when the user taps on a specific button. This causes issues with the entire lifecycle since callbacks are not serializable. If the device is rotated while the dialog is visible, the OS will tear the activity and fragment stack down and reconstruct it with new instances. This means we have to come up with a different way of handling button presses. There is an approach I think we are likely to take which involves forcing dialog creation to be done only in Fragments and setting the DialogFragment's "targetFragment" to the fragment that is doing the displaying of the dialog. By setting this, you can call "onActivityResult" from within the DialogFragment to communicate back to the parent fragment. Unfortunately, this is going to be a fairly large undertaking to do this, not because we have so many dialogs, but we are displaying dialogs in areas that aren't Fragments. So those need to be cleaned up first.