monitorizare-vot-ios icon indicating copy to clipboard operation
monitorizare-vot-ios copied to clipboard

[UI] Implement Dark Mode support

Open CristiHabliuc opened this issue 5 years ago • 10 comments

This would require a more flexible color configuration, meaning:

  • [ ] ~Colors should now be stored in asset catalogs~ we can't because of the minimum deployment version (9.3). We should implement the logic in the UIColor extension for light/dark mode colors.
  • [ ] Set colors for light + dark mode for each defined color

CristiHabliuc avatar Sep 27 '19 13:09 CristiHabliuc

Hi! I would like to help you with it as part of Hacktoberfest

pankova avatar Oct 01 '19 19:10 pankova

@pankova do you think can you take care of this one?

CristiHabliuc avatar Oct 02 '19 11:10 CristiHabliuc

I would be glad to help you with this feature :)

pankova avatar Oct 02 '19 11:10 pankova

Awesome! Before you start, please read our git workflow if you haven't contributed to our projects before. Looking forward to see the progress. Cheers!

CristiHabliuc avatar Oct 02 '19 11:10 CristiHabliuc

@CristiHabliuc hi! Could you please give me test app auth data to go through all screens without a lot of difficulties? :)

pankova avatar Oct 17 '19 19:10 pankova

i tried test auth from other issue thread (0722222222 123456), but it's invalid Screenshot 2019-10-17 at 22 55 59

pankova avatar Oct 17 '19 19:10 pankova

@pankova that account is correct. please make sure you are using the latest code from the develop branch. and also that the backend api that you are calling is https://mv-mobile-dev.azurewebsites.net

aniri avatar Oct 17 '19 20:10 aniri

the problem was with prod url, thx!

pankova avatar Oct 17 '19 20:10 pankova

This should be fixed with Pull Request

ghost avatar Nov 21 '19 22:11 ghost

Since the use of asset catalogs is out of scope due to the support for older versions of iOS, I'd suggest to keep the current structure of UIColor+Presets.swift and create an extension with different behaviours on older OS versions.

public extension UIColor {
    convenience init(defaultHex: UInt32, darkHex: UInt32) {
        if #available(iOS 13.0, *) {
            self.init { traitCollection in
                if traitCollection.userInterfaceStyle == .dark {
                    return .init(hexCode: darkhex)
                }
                return .init(hexCode: defaultHex)
            }
        }
        else {
            self.init(hexCode: defaultHex)
        }
    }
}

By doing this pre iOS 13 versions will fall back to the default color scheme while new versions will have support for both. This solutions does not require any change in the rest of the application.

Since all the images are PNG based some of them will require re-export in either PDF format (for template rendering mode) or a dark mode friendly version (similar extension required).

I'm happy to make this change.

magyarosibotond avatar Mar 16 '20 21:03 magyarosibotond