ghewgill / puzzles

Simon Tatham's Portable Puzzle Collection
Other
137 stars 24 forks source link

Fix iOS 14 crash and add dark mode support #5

Closed k-natt closed 3 years ago

k-natt commented 4 years ago

This has several different pieces, let me know if you'd prefer I split it into several PRs. Also, I know the diff looks big but most of that is just removing the PSTCollectionView files. The actual substance is less than a score of lines.

The app currently crashes on iOS 14 due to an assertion in UICollectionView that registered cell classes are subclasses of UICollectionViewCell. The class in question, GameListViewCell, is in fact a subclasses of PSUICollectionViewCell, which indeed does not inherit from UICollectionViewCell. Changing the superclass of GameListViewCell to UICollectionViewCell fixes the crash with no apparent side effects—as expected of an "API-compatible replacement" for UICollectionView.

Since the PSTCollectionView library is only a compatibility layer for iOS versions before 6, it is no longer needed. Changing the other couple references to it to their UIKit counterparts also appears to have no side effects, and allows us to remove the library altogether.

Additionally, when built for iOS 13+ and run in dark mode, text on the game list is white-on-white, and the status bar text is white on light gray, not great contrast. I have included basic dark mode support, adopting a system color that updates automatically based on dark mode state for the game list cell background, and forcing the game status bar text to remain black. One could go further, changing the bar tint colors or perhaps even the game color lists, but I'm not a designer and this is good enough.

Coder-256 commented 3 years ago

@ghewgill Just to be clear, the app crashes on startup on iOS 14, rendering it completely unplayable. I understand if this app is not maintained anymore but could you consider updating it just to fix the crash?