cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Deleted] (CB-6884) Support new Cordova bridge under iOS 8 WKWebView
Date Mon, 21 Jul 2014 18:36:41 GMT

     [ https://issues.apache.org/jira/browse/CB-6884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Shazron Abdullah updated CB-6884:
---------------------------------

    Comment: was deleted

(was: Support these properties in WKWebViewConfiguration:

{code}
/*! @abstract A Boolean value indicating whether the web view suppresses
 content rendering until it is fully loaded into memory.
 @discussion The default value is NO.
 */
@property (nonatomic) BOOL suppressesIncrementalRendering;

#if TARGET_OS_IPHONE
/*! @abstract A Boolean value indicating whether HTML5 videos play inline
 (YES) or use the native full-screen controller (NO).
 @discussion The default value is NO.
 */
@property (nonatomic) BOOL allowsInlineMediaPlayback;

/*! @abstract A Boolean value indicating whether HTML5 videos require the
 user to start playing them (YES) or can play automatically (NO).
 @discussion The default value is YES.
 */
@property (nonatomic) BOOL mediaPlaybackRequiresUserAction;

/*! @abstract A Boolean value indicating whether AirPlay is allowed.
 @discussion The default value is YES.
 */
@property (nonatomic) BOOL mediaPlaybackAllowsAirPlay;

{code})

> Support new Cordova bridge under iOS 8 WKWebView
> ------------------------------------------------
>
>                 Key: CB-6884
>                 URL: https://issues.apache.org/jira/browse/CB-6884
>             Project: Apache Cordova
>          Issue Type: Sub-task
>          Components: CordovaJS, iOS
>         Environment: iOS 8 beta 2
>            Reporter: Shazron Abdullah
>            Assignee: Shazron Abdullah
>
> https://developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-8.0/index.html
> WKUserContentController - add a script message handler with name "cordova":
> https://developer.apple.com/library/prerelease/ios/documentation/WebKit/Reference/WKUserContentController_Ref/index.html#//apple_ref/swift/cl/WKUserContentController
> The WKUserContentController is associated with a WKWebViewConfiguration which is initialized
with a WKWebView.
> {code}
> WKUserContentController* userContentController = [[WKUserContentController alloc] init];
> // scriptMessageHandler is the object that conforms to the WKScriptMessageHandler protocol
> // see https://developer.apple.com/library/prerelease/ios/documentation/WebKit/Reference/WKScriptMessageHandler_Ref/index.html#//apple_ref/swift/intf/WKScriptMessageHandler
> [userContentController addScriptMessageHandler:scriptMessageHandler name:@"cordova"];
> {code}
> In JavaScript, you would call into Objective-C thus:
> {code}
> var command = { callbackId: "blabla23", service:"Camera", action: "takePicture", actionArgs:
[ 1, 2, 3 ] };
> window.webkit.messageHandlers.cordova.postMessage(command);
> {code}
> In the object that conforms to the WKScriptMessageHandler protocol:
> {code}
> - (void)userContentController:(WKUserContentController *)userContentController   didReceiveScriptMessage:(WKScriptMessage
*)message
> {
>     if (![message.name isEqualToString:@"cordova"]) {
>         return;
>     }
>     NSDictionary* command = message.body;
>     // TODO: get the callbackId, service, action, actionArgs keys and create a CDVInvokedUrlCommand,
and dispatch it
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message