Skip to content
This repository was archived by the owner on Jul 17, 2023. It is now read-only.
This repository was archived by the owner on Jul 17, 2023. It is now read-only.

Theme changes have no effect on iOS 13 with dark mode enabled #8

@alex-spataru

Description

@alex-spataru

Hi!

While testing my application (which makes use of your project), I found out that if dark mode is enabled on the iOS device, the theme setting is completely ignored and defaults to dark mode (white status bar icons).

In order to fix this, I made the following modifications to statusbar_ios.mm:

// Includes and @interface

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

// Other functions, etc

static UIStatusBarStyle statusBarStyle(StatusBar::Theme theme)
{
    if (theme == StatusBar::Dark)
        return UIStatusBarStyleLightContent;

    else if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0"))
        return UIStatusBarStyleDarkContent;

    else
        return UIStatusBarStyleDefault;
}

However, while my solution works for my test-scenario, I really doubt that my fix is the most elegant or appropriate (I never really worked with iOS/Xcode/Objective-C before). By the way, the SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO definition was copy-pasted from StackOverflow.

Greetings!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions