Skip to content

Commit

Permalink
feat(ios): add InAppBrowserStatusBarStyle 'darkcontent' configuration…
Browse files Browse the repository at this point in the history
… option (apache#828)



Co-authored-by: Tim Brust <github@timbrust.de>
  • Loading branch information
2 people authored and Jorge Navarro committed Apr 27, 2021
1 parent 0786260 commit 4ee13ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ simply hook `window.open` during initialization. For example:
### Preferences

#### <b>config.xml</b>
- <b>InAppBrowserStatusBarStyle [iOS only]</b>: (string, options 'lightcontent' or 'default'. Defaults to 'default') set text color style for iOS.
- <b>InAppBrowserStatusBarStyle [iOS only]</b>: (string, options 'lightcontent', 'darkcontent' or 'default'. Defaults to 'default') set text color style for iOS. 'lightcontent' is intended for use on dark backgrounds. 'darkcontent' is only available since iOS 13 and intended for use on light backgrounds.
```
<preference name="InAppBrowserStatusBarStyle" value="lightcontent" />
```
Expand Down
6 changes: 6 additions & 0 deletions src/ios/CDVWKInAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,12 @@ - (UIStatusBarStyle)preferredStatusBarStyle
NSString* statusBarStylePreference = [self settingForKey:@"InAppBrowserStatusBarStyle"];
if (statusBarStylePreference && [statusBarStylePreference isEqualToString:@"lightcontent"]) {
return UIStatusBarStyleLightContent;
} else if (statusBarStylePreference && [statusBarStylePreference isEqualToString:@"darkcontent"]) {
if (@available(iOS 13.0, *)) {
return UIStatusBarStyleDarkContent;
} else {
return UIStatusBarStyleDefault;
}
} else {
return UIStatusBarStyleDefault;
}
Expand Down

0 comments on commit 4ee13ca

Please sign in to comment.