Skip to content

Commit 347d78c

Browse files
committed
Add new value for 'forge.display.setStatusBarStyle' on iOS: 'UIStatusBarStyleDarkContent'
1 parent ddaa39d commit 347d78c

6 files changed

Lines changed: 36 additions & 12 deletions

File tree

inspector/ios-inspector/ForgeModule/display/display_EventListener.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ + (void)application:(UIApplication *)application postDidFinishLaunchingWithOptio
4141
NSString *style = [[[config objectForKey:@"statusbar"] objectForKey:@"ios"] objectForKey:@"style"];
4242
if ([style isEqualToString:@"light_content"] || [style isEqualToString:@"UIStatusBarStyleLightContent"]) {
4343
ForgeApp.sharedApp.viewController.statusBarStyle = UIStatusBarStyleLightContent;
44+
} else if ([style isEqualToString:@"dark_content"] ||[style isEqualToString:@"UIStatusBarStyleDarkContent"]) {
45+
if (@available(iOS 13.0, *)) {
46+
ForgeApp.sharedApp.viewController.statusBarStyle = UIStatusBarStyleDarkContent;
47+
} else {
48+
ForgeApp.sharedApp.viewController.statusBarStyle = UIStatusBarStyleDefault;
49+
}
4450
} else if ([style isEqualToString:@"default"] ||[style isEqualToString:@"UIStatusBarStyleDefault"]) {
4551
ForgeApp.sharedApp.viewController.statusBarStyle = UIStatusBarStyleDefault;
4652
}

module/docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Transparent
3030
: Sets iOS status bar transparency.
3131

3232
Style
33-
: Sets the status bar style on iOS, `default` will use black text, `light_content` will use white text.
33+
: Sets the status bar style on iOS: `UIStatusBarStyleDefault` will use black text if iOS dark mode is disabled. If dark mode is enabled the text color will be controlled by iOS. `UIStatusBarStyleLightContent` will use light text. `UIStatusBarStyleDarkContent` will use dark text irrespective of iOS dark mode settings.
3434

3535

3636
### Orientations

module/inspector_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"ios": {
1212
"hidden": true,
13-
"transparent": true,
13+
"transparent": false,
1414
"style": "default"
1515
}
1616
},

module/ios/module.a

-92 KB
Binary file not shown.

module/manifest.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"changes": "* `fullscreen` config section deprecated in favor of new config section: `statusbar`\n* New API method: `setStatusBarStyle`\n* New config option: `display.statusbar.ios.style`\n* Android 'P' support",
2+
"changes": "* Add new value for `forge.display.setStatusBarStyle` on iOS: `dark_content`",
33
"description": "Configure display behaviour, like rotation and fullscreen, for your app.\n\nThis module also let you programmatically access and set device specific display options.",
4-
"min_platform_version": "v2.7.1",
4+
"min_platform_version": "v2.8.2",
55
"namespace": "display",
6-
"platform_version": "v2.7.1",
7-
"version": "2.11"
6+
"platform_version": "v2.8.2",
7+
"version": "2.12"
88
}

module/tests/interactive.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ asyncTest("Status bar visible", 1, function() {
3030
});
3131

3232
if (forge.is.ios()) {
33-
asyncTest("Set status bar style, iOS", 1, function() {
34-
forge.display.setStatusBarStyle("light_content", function () {
35-
askQuestion("Status bar should be black with white text", {
33+
asyncTest("Set status bar style UIStatusBarStyleLightContent, iOS", 1, function() {
34+
forge.display.setStatusBarStyle("UIStatusBarStyleLightContent", function () {
35+
askQuestion("Status bar should use light text", {
3636
Yes: function () {
3737
ok(true, "User claims success");
3838
start();
@@ -48,9 +48,27 @@ if (forge.is.ios()) {
4848
});
4949
});
5050

51-
asyncTest("Set status bar style, iOS", 1, function() {
52-
forge.display.setStatusBarStyle("default", function () {
53-
askQuestion("Status bar should be white with black text", {
51+
asyncTest("Set status bar style UIStatusBarStyleDarkContent, iOS", 1, function() {
52+
forge.display.setStatusBarStyle("UIStatusBarStyleDarkContent", function () {
53+
askQuestion("Status bar should use dark text", {
54+
Yes: function () {
55+
ok(true, "User claims success");
56+
start();
57+
},
58+
No: function () {
59+
ok(false, "User claims failure");
60+
start();
61+
}
62+
});
63+
}, function () {
64+
ok(true, "Not available");
65+
start();
66+
});
67+
});
68+
69+
asyncTest("Set status bar style UIStatusBarStyleDefault, iOS", 1, function() {
70+
forge.display.setStatusBarStyle("UIStatusBarStyleDefault", function () {
71+
askQuestion("Status bar should use a text color appropriate for dark mode", {
5472
Yes: function () {
5573
ok(true, "User claims success");
5674
start();

0 commit comments

Comments
 (0)