Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ios): allow enabling fullscreen functions #651

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ Whether to use a dark styled keyboard on iOS

Ionic apps work better if the WKWebView is not scrollable, so the scroll is disabled by default, but can be enabled with this preference. This only affects the main ScrollView of the WKWebView, so only affects the body, not other scrollable components.

#### WKFullScreenEnabled

```xml
<preference name="WKFullScreenEnabled" value="true" />
```

Default value is `false`.

Whether to enable fullscreen functions in WKWebView. If enabled, the functions document.documentElement.webkitRequestFullscreen and document.documentElement.webkitRequestFullScreen will be available.

## Plugin Requirements

* **Cordova CLI**: 7.1.0+
Expand Down
3 changes: 3 additions & 0 deletions src/ios/CDVWKWebViewEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ - (WKWebViewConfiguration*) createConfigurationFromSettings:(NSDictionary*)setti
) {
userAgent = [NSString stringWithFormat:@"%@ %@", userAgent, [settings cordovaSettingForKey:@"AppendUserAgent"]];
}
if([settings cordovaBoolSettingForKey:@"WKFullScreenEnabled" defaultValue:NO]){
[configuration.preferences setValue:[NSNumber numberWithBool:YES] forKey:@"fullScreenEnabled"];
}
configuration.applicationNameForUserAgent = userAgent;
configuration.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:YES];
configuration.suppressesIncrementalRendering = [settings cordovaBoolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
Expand Down