You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ni...@apache.org on 2020/06/04 18:15:09 UTC

[cordova-ios] branch contentmode updated: Add PreferredContentMode preference

This is an automated email from the ASF dual-hosted git repository.

niklasmerz pushed a commit to branch contentmode
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/contentmode by this push:
     new dcb32ea  Add PreferredContentMode preference
dcb32ea is described below

commit dcb32ea3ad7c876a9104daba38953924f89b3add
Author: Niklas Merz <nm...@gedys-intraware.de>
AuthorDate: Thu Jun 4 20:14:39 2020 +0200

    Add PreferredContentMode preference
---
 .../Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m        | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
index cf3bf58..3af440f 100644
--- a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
+++ b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m
@@ -135,6 +135,16 @@
     }
     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;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org