Closed mzorz closed 3 years ago
You can test the changes on this Pull Request by downloading the APK here.
Working well @mzorz, nice sleuthing as usual ✨ Reproduced the issue on current develop
per your steps, and confirmed it's resolved with your change. :shipit:
Fix #581
This issue was a tricky to reproduce, but once I wrapped my head around it, I realized it was easily reproducible. Finding the root cause was a bit hard since I was too focused on the "reordering" frames part as being central to the issue.
After discarding a few theories (problems when adding views? problems with saving? problem with serialization/deserialization) and much debugging, I realized at this part of code:
we were getting
null
oneView.view
s, which gave me the hint that we weren't inflating the added views until these were actually needed (by tapping on a frame on the frame selector). Hence, the only frame that would actually have its added views was the first one, always. In the case you'd rearrange the first slide and move it elsewhere, it would still be the only one selected, but the rest of the frames would have never had their added views inflated and properly shown on the screen.So with that root cause figured out, I wrote this solution that takes care of inflating added views for a given frame when it's being prepared to be saved, in the case any such added views is
null
.Few things to have in mind:
AddedView
'sview
property from val to var, so I needed to add a few checks andlet{}
groups elsewhere (so you'll see some seemingly unrelated changes in a few places as well).addTouchListener
since we're reusing thebuildViewFromAddedViewInfo
method that was only being used in PhotoEditor on actual drawing. Given we don't need interaction when saving, this makes adding a gesture listener optional for the added viewsFrameSaveManager
.The following videos show a Story that has been edited and only its slides have been rearranged. All slides have 1 added view of type
text
. First video shows the defect ondevelop
, second video shows how things are after performing the test steps on this branch.Before
https://user-images.githubusercontent.com/6597771/115985196-15cc3200-a581-11eb-8725-2ceff3eff2a0.mov
After
https://user-images.githubusercontent.com/6597771/115985192-14026e80-a581-11eb-97e9-647f7b216117.mov
To test: