This week, I mainly tied up loose ends and debugged. The issues were more fiddly than I thought they would be.

Safari Issue #1 – Database Load

Previously, during initialisation (log in), an API was used to estimate if there was enough storage to load the database in. This API wasn’t supported in Safari, so the app didn’t work on Safari. At the start of the week, it was a quick fix to remove the code using the API.

However, later on, my supervisor spotted the issue that authentication wasn’t happening properly – non-existent databases, wrong username and passwords could be used to log in. Digging into the code and inspecting console output revealed that the error wasn’t being recognised as a “proper error” to be caught, it was just enclosed as information in the data returned. The previous implementation made use of a null pointer exception (upon error, some fields would be null) to catch the login errors, and removing this code broke the error-checking. I was able to fix this issue by checking for the error field in the data returned, and manually throwing an exception if the error field existed.

Next time, I’ll learn to be more thorough in my testing to prevent bugs slipping through, especially when working with existing codebases where I might be unfamiliar with side effects of the code.

Safari Issue #2 – Pop-up Blocked

TLDR: Going in circles with Safari blocking the opening of a new window, simply solved by setting a shorter timeout.

For our app, a long press detected would open up a pdf file in a new window, however, this was blocked in Safari by the built-in pop-up blocker. Despite the end solution being really simple, resolving this issue involved lots of research and experimenting.

Initially, I thought the issue was due to the indirect linking between the long-press event and I tried out a plugin for the long-press detection in place of the current implementation, and it worked – except scrolling on a tablet was being detected as a long press as well.

After trying out some hacky unsuccessful fixes to differentiate between a scroll and long-press event, I chucked in a longer timeout for the long press detection, and noticed the plugin that was working successfully on Safari, failed on a longer timeout. Following experimentation and confirmation on StackOverflow, I realised that Safari has a time limit for allowing the opening of new windows before blocking. Thereafter, I simply reverted back to our original implementation with a shorter timeout, and wow it worked.

Miscellanous Tasks

  • Recording screencast demos for using our app
  • Updating libraries to latest compatible versions
    • Learnt about package.json and semantic versioning
  • Local document schema change for marks autosaving
    • The current local autosave document just contains the minimal marks-related information required.
    • My supervisor is planning to develop a batch submit feature for all the local autosaved documents in the future, instead of the current individual submissions. To facilitate this switch, I modified the autosaving process to save additional metadata in advance, so the local document can be easily converted to its remote version and submitted
Categories: Experiential


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.