Windows 10 is almost upon us and it’s time to prepare apps for it. Naturally, I have been thinking of upgrading Kodi Assist to universal app platform since the SDK previews were released. However, this is not just an upgrade to existing app. I have chosen to rebuild Kodi Assist right from blank project template.
Why rebuild instead of upgrade?
Apparently, Microsoft has suggested a few upgrade paths to upgrade existing Windows Runtime 8.1 Universal apps to Windows 10 app model. While upgrade approach has its benefits (direct code reuse, for instance) it poses several problems, especially when it comes to delivering quality apps.
Windows 8.1 Universal projects started out with idea of common code shared across Windows and Windows Phone apps. However, both the projects had their own ‘heads’ for UIs and platform specific stuff. One of the upgrade approaches suggests choosing one of these heads and upgrading that to a Windows 10 project. This, however, doesn’t work out very well in real life. Even if we get most of the XAML ported directly over to Windows 10 (which is not really the case as seen below) we still end up with UI designed towards the head we chose earlier. So, if we choose Windows Phone head, for example, we are likely to end up with an UI upscaled to the bigger screen. On the other hand, if we choose the Windows UI head, it’s highly unlikely that the UI will look any good on the Phone side. In the end, we have to rewrite the UI for screen we didn’t choose earlier.
Not So Portable XAML
Despite the best efforts on part of Microsoft, the XAML does not directly port over to Windows 10. For starters, all the default styles used have different meaning on Windows 10, leading to strange text sizes. Secondly, resources like accent brushes aren’t even available on Windows 10. In the end we are left with an ugly and barely functional UI.
Changes In APIs
This one is a pet peeve of mine. Over the years, I have written small snippets of code here and there to work around a buggy API or two. Same goes for current version Kodi Assist. To be specific, we have some duct tape code to force lose focus on a text box so that the keyboard is dismissed after search button is pressed. Also, the current implementation of slider for Windows Runtime 8.1 fires value changed event continuously while the slider is being dragged. That is not always desirable. We had to add a timer to capture the slider’s value every second so that there aren’t 100 requests per second for changing the volume. In my experience, these duct tapes don’t usually work well with upgraded APIs. They are either completely unnecessary (due to new APIs being more stable) or need to be replaced by different tapes to patch different holes. However, when code is directly upgraded from an older version of platform, many of these tapes get though undetected and cause all sorts of troubles down the line. Manually copying code from blank template adds another layer of filter against such code.
Okay. What’s happening then?
I’m glad you asked. Here is the very first screenshot of Kodi Assist for Windows 10.
It doesn’t do much. Right now, most of the backend code has been copied over. That process was surprisingly smooth. All I had to do was to drop the classes in appropriate folders and change a few namespaces here and there.
Is this approach slower that upgrade path? Probably. But this is the approach that gives quality code which in turn gives quality apps. I may very well be wrong. But I’m going to stick to it for now. If you’re interested, join in the development on GitHub.