Skip to content

Commit

Permalink
Add PreferredContentMode preference (#886)
Browse files Browse the repository at this point in the history
* Add PreferredContentMode preference

* Apply suggestions from code review

Co-authored-by: エリス <[email protected]>

Co-authored-by: エリス <[email protected]>
  • Loading branch information
NiklasMerz and erisu authored Jun 16, 2020
1 parent 2921e58 commit 440fc0f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ - (WKWebViewConfiguration*) createConfigurationFromSettings:(NSDictionary*)setti
}
configuration.applicationNameForUserAgent = userAgent;

if (@available(iOS 13.0, *)) {
NSString *contentMode = [settings cordovaSettingForKey:@"PreferredContentMode"];
if ([contentMode isEqual: @"mobile"]) {
configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeMobile;
} else if ([contentMode isEqual: @"desktop"]) {
configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeDesktop;
}

}

return configuration;
}

Expand Down

0 comments on commit 440fc0f

Please sign in to comment.