Permalink
Browse files

Update with a snapshot of the release to market of WebWorks for Table…

…t OS v2.1.0.6
  • Loading branch information...
1 parent c0ece6c commit 7244a070509cc3c0e0a1914989934ede52499e72 @kwhatmough kwhatmough committed Jul 7, 2011
Showing with 5,149 additions and 841 deletions.
  1. +52 −41 framework/src/WebWorksAppTemplate.as
  2. +35 −14 framework/src/webworks/FunctionBroker.as
  3. +8 −2 framework/src/webworks/JavaScriptLoader.as
  4. +5 −5 framework/src/webworks/access/Feature.as
  5. +3 −3 framework/src/webworks/config/ConfigData.as
  6. +30 −7 framework/src/webworks/extension/DefaultExtension.as
  7. +67 −0 framework/src/webworks/extension/WebWorksReturnValue.as
  8. +466 −0 framework/src/webworks/fullScreenView/FullScreenView.as
  9. +8 −0 framework/src/webworks/loadingScreen/LoadingScreen.as
  10. +22 −31 framework/src/webworks/loadingScreen/Transitions.as
  11. +24 −0 framework/src/webworks/service/IWebWorksData.as
  12. +25 −0 framework/src/webworks/service/IWebWorksService.as
  13. +44 −0 framework/src/webworks/service/ServiceManager.as
  14. +533 −0 framework/src/webworks/service/blob/BlobManager.as
  15. +8 −0 framework/src/webworks/util/DeviceURL.as
  16. +99 −0 framework/src/webworks/util/IntUtil.as
  17. +281 −0 framework/src/webworks/util/MD5.as
  18. +56 −2 framework/src/webworks/webkit/WebkitControl.as
  19. +5 −0 framework/src/webworks/webkit/WebkitEvent.as
  20. +0 −71 js_api/BlackBerry_Application/library.xml
  21. +0 −71 js_api/BlackBerry_Application_Events/library.xml
  22. +0 −106 js_api/BlackBerry_Invoke/library.xml
  23. +0 −115 js_api/BlackBerry_System/library.xml
  24. +0 −61 js_api/BlackBerry_System_Events/library.xml
  25. +0 −105 js_api/BlackBerry_Ui/library.xml
  26. +0 −73 js_api/BlackBerry_Utilities/library.xml
  27. BIN js_api/Common_AS/JSONLibrary/bin/JSONLibrary.swc
  28. +7 −0 js_api/Common_AS/JSONLibrary/src/json/JSONEncoder.as
  29. 0 js_api/{BlackBerry_Application_Events → blackberry.app.event}/js/common/app_event_dispatcher.js
  30. 0 js_api/{BlackBerry_Application_Events → blackberry.app.event}/js/common/app_event_ns.js
  31. +24 −0 js_api/blackberry.app.event/library.xml
  32. 0 ...ckberry.app.event}/src/Air/ApplicationEvents/src/blackberry/applicationEvents/ApplicationEvent.as
  33. 0 js_api/{BlackBerry_Application → blackberry.app}/js/common/app_dispatcher.js
  34. 0 js_api/{BlackBerry_Application → blackberry.app}/js/common/app_ns.js
  35. +24 −0 js_api/blackberry.app/library.xml
  36. +5 −4 ...Berry_Application → blackberry.app}/src/Air/Application/src/blackberry/application/Application.as
  37. +37 −0 js_api/blackberry.identity/js/common/identity_dispatcher.js
  38. +26 −0 js_api/blackberry.identity/js/common/identity_ns.js
  39. +24 −0 js_api/blackberry.identity/library.xml
  40. +49 −0 js_api/blackberry.identity/src/Air/Identity/src/blackberry/identity/Identity.as
  41. 0 js_api/{BlackBerry_Invoke → blackberry.invoke}/js/common/invoke_dispatcher.js
  42. 0 js_api/{BlackBerry_Invoke → blackberry.invoke}/js/common/invoke_ns.js
  43. +24 −0 js_api/blackberry.invoke/library.xml
  44. 0 js_api/{BlackBerry_Invoke → blackberry.invoke}/src/Air/Invoke/src/blackberry/invoke/Invoke.as
  45. +147 −0 js_api/blackberry.io.dir/js/common/dir_dispatcher.js
  46. +42 −0 js_api/blackberry.io.dir/js/common/dir_ns.js
  47. +24 −0 js_api/blackberry.io.dir/library.xml
  48. +295 −0 js_api/blackberry.io.dir/src/Air/Directory/src/blackberry/io/dir/DirectoryExtension.as
  49. +162 −0 js_api/blackberry.io.file/js/common/file_dispatcher.js
  50. +49 −0 js_api/blackberry.io.file/js/common/file_ns.js
  51. +24 −0 js_api/blackberry.io.file/library.xml
  52. +317 −0 js_api/blackberry.io.file/src/Air/File/src/blackberry/io/file/FileExtension.as
  53. +45 −0 js_api/blackberry.media.camera/js/common/camera_dispatcher.js
  54. +66 −0 js_api/blackberry.media.camera/js/common/camera_ns.js
  55. +23 −0 js_api/blackberry.media.camera/library.xml
  56. +122 −0 js_api/blackberry.media.camera/src/Air/Camera/src/blackberry/media/camera/Camera.as
  57. +60 −0 js_api/blackberry.media.microphone/js/common/mic_dispatcher.js
  58. +33 −0 js_api/blackberry.media.microphone/js/common/mic_ns.js
  59. +24 −0 js_api/blackberry.media.microphone/library.xml
  60. +136 −0 ...kberry.media.microphone/src/Air/Microphone/src/blackberry/media/microphone/MicrophoneExtension.as
  61. +40 −0 js_api/blackberry.media.microphone/src/Air/Microphone/src/org/bytearray/micrecorder/IEncoder.as
  62. +331 −0 js_api/blackberry.media.microphone/src/Air/Microphone/src/org/bytearray/micrecorder/MicRecorder.as
  63. +107 −0 ...ackberry.media.microphone/src/Air/Microphone/src/org/bytearray/micrecorder/encoder/WaveEncoder.as
  64. +84 −0 ...kberry.media.microphone/src/Air/Microphone/src/org/bytearray/micrecorder/events/RecordingEvent.as
  65. +80 −0 js_api/blackberry.payment/js/common/payment_dispatcher.js
  66. +30 −0 js_api/blackberry.payment/js/common/payment_ns.js
  67. +24 −0 js_api/blackberry.payment/library.xml
  68. +159 −0 js_api/blackberry.payment/src/Air/Payment/src/blackberry/payment/Payment.as
  69. +41 −0 js_api/blackberry.payment/src/Air/Payment/src/blackberry/payment/PurchaseData.as
  70. 0 js_api/{BlackBerry_System_Events → blackberry.system.event}/js/common/system_event_dispatcher.js
  71. 0 js_api/{BlackBerry_System_Events → blackberry.system.event}/js/common/system_event_ns.js
  72. +24 −0 js_api/blackberry.system.event/library.xml
  73. 0 ...vents → blackberry.system.event}/src/Air/SystemEvents/src/blackberry/system/event/SystemEvents.as
  74. 0 js_api/{BlackBerry_System → blackberry.system}/js/common/system_dispatcher.js
  75. 0 js_api/{BlackBerry_System → blackberry.system}/js/common/system_ns.js
  76. +24 −0 js_api/blackberry.system/library.xml
  77. +6 −5 js_api/{BlackBerry_System → blackberry.system}/src/Air/System/src/blackberry/system/System.as
  78. 0 js_api/{BlackBerry_Ui → blackberry.ui.dialog}/js/common/dialog/dialog_dispatcher.js
  79. 0 js_api/{BlackBerry_Ui → blackberry.ui.dialog}/js/common/dialog/dialog_ns.js
  80. +24 −0 js_api/blackberry.ui.dialog/library.xml
  81. 0 ...i/{BlackBerry_Ui → blackberry.ui.dialog}/src/Air/UserInterface/src/blackberry/ui/dialog/Dialog.as
  82. 0 js_api/{BlackBerry_Utilities → blackberry.utils}/js/common/utilities_ns.js
  83. +23 −0 js_api/blackberry.utils/library.xml
  84. 0 js_api/{BlackBerry_Utilities → blackberry.utils}/src/Air/Utilities/src/blackberry/utils/Utilities.as
  85. +4 −4 js_api/globalJS/3_xhr.js
  86. +38 −0 js_api/globalJS/5_blob.js
  87. +3 −4 packager/src/net/rim/tumbler/WidgetPackager.java
  88. +185 −50 packager/src/net/rim/tumbler/airpackager/AirPackager.java
  89. +57 −15 packager/src/net/rim/tumbler/config/WidgetConfig.java
  90. +102 −0 packager/src/net/rim/tumbler/extension/ExtensionDependencyManager.java
  91. +21 −1 packager/src/net/rim/tumbler/extension/ExtensionDescriptor.java
  92. +102 −47 packager/src/net/rim/tumbler/extension/ExtensionMap.java
  93. +4 −1 packager/src/net/rim/tumbler/log/resources/MessageBundle_en_CA.properties
  94. +22 −0 packager/src/net/rim/tumbler/session/BBWPProperties.java
  95. +54 −3 packager/src/net/rim/tumbler/xml/ConfigXMLParser.java
@@ -35,6 +35,7 @@ package
import webworks.extension.IApiExtension;
import webworks.loadingScreen.LoadingScreen;
import webworks.loadingScreen.Transitions;
+ import webworks.service.ServiceManager;
import webworks.webkit.WebkitControl;
import webworks.webkit.WebkitEvent;
@@ -44,12 +45,13 @@ package
{
private static var LOCAL_PROTOCOL:String = "local:///";
- private var entryURL:String;
- private var webWindow:WebkitControl;
- private var errorDialog:AlertDialog;
- private var loadingScreen:LoadingScreen;
- private var transitions:Transitions;
- private var broker:FunctionBroker;
+ private var _entryURL:String;
+ private var _webWindow:WebkitControl;
+ private var _errorDialog:AlertDialog;
+ private var _loadingScreen:LoadingScreen;
+ private var _transitions:Transitions;
+ private var _broker:FunctionBroker;
+ private var _serviceManager:ServiceManager;
public function WebWorksAppTemplate()
{
@@ -64,7 +66,7 @@ package
{
removeEventListener(Event.ADDED_TO_STAGE, init);
stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientationChange);
- entryURL = ConfigData.getInstance().getProperty(ConfigConstants.CONTENT);
+ _entryURL = ConfigData.getInstance().getProperty(ConfigConstants.CONTENT);
NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, appActive);
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, appBackground);
appInitialized();
@@ -73,7 +75,7 @@ package
private function appActive(event:Event):void
{
stage.frameRate = 30;
- webWindow.visible = true;
+ _webWindow.visible = true;
trace("Increased Framerate to " + stage.frameRate + " | " + event);
}
@@ -87,12 +89,19 @@ package
{
setupStage();
setupWebkit();
- ConfigData.getInstance().setProperty(ConfigConstants.ENV_WEBVIEW, webWindow.qnxWebView);
+
+ ConfigData.getInstance().setProperty(ConfigConstants.ENV_WEBVIEW, _webWindow.qnxWebView);
ConfigData.getInstance().setProperty(ConfigConstants.ENV_APPLICATION, this);
- loadingScreen = new LoadingScreen(0,0, stage.stageWidth,stage.stageHeight);
- transitions = new Transitions(loadingScreen);
- broker = new FunctionBroker(webWindow.qnxWebView);
- registerExtensions(ConfigData.getInstance().properties);
+
+ _loadingScreen = new LoadingScreen(0,0, stage.stageWidth,stage.stageHeight);
+ _transitions = new Transitions(_loadingScreen, _webWindow.viewPort);
+ _serviceManager = new ServiceManager(_webWindow);
+ _broker = new FunctionBroker(_webWindow.qnxWebView, _serviceManager);
+
+ var configProperties:Dictionary = ConfigData.getInstance().properties;
+ configProperties["serviceManager"] = _serviceManager;
+
+ registerExtensions(configProperties);
}
private function registerExtensions(env:Dictionary):void
@@ -118,16 +127,16 @@ package
private function setupWebkit():void
{
var creationID:Number = int(Math.random() * 1000000) + new Date().time;
- webWindow = new WebkitControl(creationID, stage);
- webWindow.setViewPort(new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));
+ _webWindow = new WebkitControl(creationID, stage);
+ _webWindow.setViewPort(new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));
- webWindow.addEventListener(WebkitEvent.TAB_LOAD_COMPLETE, tabLoadComplete);
- webWindow.addEventListener(WebkitEvent.TAB_LOAD_ERROR, webkitLoadError);
- webWindow.addEventListener(WebkitEvent.WEBVIEW_CREATED, webkitWindowReady);
- webWindow.addEventListener(WebkitEvent.TAB_LOCATION_CHANGING, webkitLocationChanging);
- webWindow.addEventListener(WebkitEvent.TAB_LOCATION_CHANGED, webkitLocationChanged);
- webWindow.addEventListener(WebkitEvent.TAB_UNKNOWNPROTOCOL, handleUnknownProtocol)
- addChild(webWindow);
+ _webWindow.addEventListener(WebkitEvent.TAB_LOAD_COMPLETE, tabLoadComplete);
+ _webWindow.addEventListener(WebkitEvent.TAB_LOAD_ERROR, webkitLoadError);
+ _webWindow.addEventListener(WebkitEvent.WEBVIEW_CREATED, webkitWindowReady);
+ _webWindow.addEventListener(WebkitEvent.TAB_LOCATION_CHANGING, webkitLocationChanging);
+ _webWindow.addEventListener(WebkitEvent.TAB_LOCATION_CHANGED, webkitLocationChanged);
+ _webWindow.addEventListener(WebkitEvent.TAB_UNKNOWNPROTOCOL, handleUnknownProtocol)
+ addChild(_webWindow);
}
private function handleUnknownProtocol(event:WebkitEvent):void
@@ -148,24 +157,24 @@ package
var returnedBody:String = "";
try {
- returnedBody = broker.handleXHRRequest(upe.url).toString();
- webWindow.qnxWebView.notifyResourceOpened(sid, HTTPErrorMapping.getSuccessCode(), HTTPErrorMapping.getSuccessMessage());
+ returnedBody = _broker.handleXHRRequest(upe.url).toString();
+ _webWindow.qnxWebView.notifyResourceOpened(sid, HTTPErrorMapping.getSuccessCode(), HTTPErrorMapping.getSuccessMessage());
}
catch (e:Error) {
var httpError:HTTPErrorMapping = new HTTPErrorMapping(e);
- webWindow.qnxWebView.notifyResourceOpened(sid,httpError.code, httpError.message);
+ _webWindow.qnxWebView.notifyResourceOpened(sid,httpError.code, httpError.message);
}
var byteData:ByteArray;
byteData = new ByteArray();
byteData.writeUTFBytes(returnedBody);
- webWindow.qnxWebView.notifyResourceHeaderReceived(sid, "Content-Type", "text/plain");
- webWindow.qnxWebView.notifyResourceHeaderReceived(sid, "Content-Length", byteData.length.toString());
- webWindow.qnxWebView.notifyResourceDataReceived(sid, byteData);
+ _webWindow.qnxWebView.notifyResourceHeaderReceived(sid, "Content-Type", "text/plain");
+ _webWindow.qnxWebView.notifyResourceHeaderReceived(sid, "Content-Length", byteData.length.toString());
+ _webWindow.qnxWebView.notifyResourceDataReceived(sid, byteData);
- webWindow.qnxWebView.notifyResourceDone(sid);
+ _webWindow.qnxWebView.notifyResourceDone(sid);
}
private function tabLoadComplete(event:WebkitEvent):void
@@ -175,7 +184,7 @@ package
private function webkitWindowReady(event:WebkitEvent):void
{
- loadURL(entryURL);
+ loadURL(_entryURL);
}
private function webkitLoadError(event:WebkitEvent):void
@@ -196,28 +205,30 @@ package
var url:String = qnxEvent.location;
// add loading screen only if the location changes
- if (url.search(webWindow.qnxWebView.originalLocation) < 0 && loadingScreen.isLoadingScreenRequired(url))
+ if (url.search(_webWindow.qnxWebView.originalLocation) < 0 && _loadingScreen.isLoadingScreenRequired(url))
{
- loadingScreen.show(url);
+ _loadingScreen.show(url);
}
- if (loadingScreen.firstLaunchFlag)
+ if (_loadingScreen.firstLaunchFlag)
{
- loadingScreen.clearFirstLaunchFlag();
+ _loadingScreen.clearFirstLaunchFlag();
}
}
private function webkitLocationChanged(event:WebkitEvent):void
{
trace("webkitLocationChanged event");
- loadingScreen.hideIfNecessary();
+ _loadingScreen.hideIfNecessary();
}
private function onOrientationChange(event:StageOrientationEvent):void
{
- if (webWindow != null)
+ if (_webWindow != null)
{
- webWindow.setViewPort(new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));
+ _webWindow.setViewPort(new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));
+ _transitions.setViewPort(new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));
+ _loadingScreen.setLoadingScreenArea(new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));
}
}
@@ -227,15 +238,15 @@ package
url = LOCAL_PROTOCOL + url;
}
- if (loadingScreen.showOnFirstLaunch) {
- loadingScreen.show(url);
+ if (_loadingScreen.showOnFirstLaunch) {
+ _loadingScreen.show(url);
}
- webWindow.go(url);
+ _webWindow.go(url);
}
public function get transitionEffect():Transitions
{
- return transitions;
+ return _transitions;
}
}
}
@@ -24,6 +24,8 @@ package webworks
import webworks.config.ConfigData;
import webworks.errors.WebWorksError;
import webworks.extension.IApiExtension;
+ import webworks.service.IWebWorksService;
+ import webworks.service.ServiceManager;
import webworks.util.DeviceURL;
import webworks.webkit.WebkitEvent;
@@ -34,11 +36,13 @@ package webworks
*/
public class FunctionBroker extends EventDispatcher
{
- private var webView:QNXStageWebView;
+ private var _serviceManager:ServiceManager;
+ private var _webView:QNXStageWebView;
- public function FunctionBroker(webview:QNXStageWebView, target:IEventDispatcher=null)
+ public function FunctionBroker(webview:QNXStageWebView, serviceManager:ServiceManager, target:IEventDispatcher=null)
{
- webView = webview;
+ _serviceManager = serviceManager;
+ _webView = webview;
super(target);
}
@@ -53,7 +57,7 @@ package webworks
public function handleXHRRequest(obj:Object):String
{
- if ( webView == null )
+ if ( _webView == null )
throw new WebWorksError(WebWorksError.SERVER_ERROR);
var deviceUrl:String = null;
@@ -79,18 +83,35 @@ package webworks
if ( deviceUrl == null || !device.isDeviceProtocol())
throw new WebWorksError(WebWorksError.BAD_REQUEST);
- //validate the feature
- if ( ConfigData.getInstance().isFeatureAllowed(device.featureName, webView.location))
+ //If it's a service call, skip validation
+ if( device.isService())
{
- var extension:IApiExtension = ConfigData.getInstance().getExtension(device.featureName);
- if ( extension != null )
- return extension.invokeFunction(device.methodName, device.unescapedQuery);
- else
- throw new WebWorksError(WebWorksError.NOT_IMPLEMENTED);
+ var service:IWebWorksService = _serviceManager.getEndPointForMethod(deviceUrl);
+
+ if(service != null)
+ {
+ return service.execute(device.methodName, device.parametersAsObject).json;
+ }
+ else
+ {
+ throw new WebWorksError(WebWorksError.NOT_IMPLEMENTED);
+ }
}
- else
- {
- throw new WebWorksError(WebWorksError.FORBIDDEN);
+ else
+ {
+ //validate the feature
+ if ( ConfigData.getInstance().isFeatureAllowed(device.featureName, _webView.location))
+ {
+ var extension:IApiExtension = ConfigData.getInstance().getExtension(device.featureName);
+ if ( extension != null )
+ return extension.invokeFunction(device.methodName, device.unescapedQuery);
+ else
+ throw new WebWorksError(WebWorksError.NOT_IMPLEMENTED);
+ }
+ else
+ {
+ throw new WebWorksError(WebWorksError.FORBIDDEN);
+ }
}
}
}
@@ -56,18 +56,24 @@ package webworks
var features:Array = access.getFeatures();
var extension:IApiExtension;
var paths:Array;
+
+ //sort features in white list in ascending order
+ //when APIs get loaded in JavaScript, we must load parent namespace before child namespace
+ //e.g. a.b must be loaded before a.b.c, otherwise a.b.c gets overwritten by a.b
+ features.sortOn("id");
+
for(var index:String in features)
{
var feature:Feature = features[index] as Feature;
if ( feature == null )
continue;
- var widgetExt:Object = ConfigData.getInstance().getWidgetExtension(feature.getID());
+ var widgetExt:Object = ConfigData.getInstance().getWidgetExtension(feature.id);
if ( widgetExt != null )
{
//call loadFeature() of the extension
extension = widgetExt[ConfigConstants.ENTRYCLASS] as IApiExtension;
if ( extension != null )
- extension.loadFeature(feature.getID(), feature.getVersion());
+ extension.loadFeature(feature.id, feature.version);
//register js files for the feature
paths = widgetExt[ConfigConstants.REQUIREDJSFILES] as Array;
jsfiles = jsfiles.concat(paths);
@@ -40,25 +40,25 @@ package webworks.access {
//
//-----------------------------------------------------------------------------
- public function getID():String {
+ public function get id():String {
return _id;
}
- public function isRequired():Boolean {
+ public function get isRequired():Boolean {
return _isRequired;
}
- public function getVersion():String {
+ public function get version():String {
return _version;
}
- public function getDependentFeatures():Array {
+ public function get dependentFeatures():Array {
return _dependentFeatures;
}
public function isEqual(feature:Feature):Boolean
{
- return _id == feature.getID();
+ return _id == feature.id;
}
}
}
@@ -98,8 +98,8 @@ package webworks.config
var features:Array = extension.getFeatureList();
for(var index:String in features)
{
- if ( feature.getID() == features[index] )
- featureList[feature.getID()] = widgetExtensions[key];
+ if ( feature.id == features[index] )
+ featureList[feature.id] = widgetExtensions[key];
}
}
}
@@ -192,7 +192,7 @@ package webworks.config
for(var index:String in features)
{
var feature:Feature = features[index];
- if ( feature != null && feature.getID() == featureId )
+ if ( feature != null && feature.id == featureId )
return true;
}
}
Oops, something went wrong.

0 comments on commit 7244a07

Please sign in to comment.