From: Vincent Vanwaelscappel Date: Fri, 20 Sep 2013 08:19:08 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=06ffe9551ebf9ff6c27005ff43089944a6676e28;p=fluidbook-html5.git --- diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index ab86c707..c8e3aa0c 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -1287,13 +1287,15 @@ Fluidbook.prototype = { if (types_android[type] != undefined) { this.displayLoader(); setTimeout(function() { - window.webintent.startActivity({ - action: WebIntent.ACTION_VIEW, + webintent.startActivity({ + action: webintent.ACTION_VIEW, type: types_android[type], url: url }, function(args) { + console.log(args); $this.hideLoader(5); }, function(args) { + console.warn(args); $this.hideLoader(5); }); }, 100); @@ -1371,10 +1373,10 @@ Fluidbook.prototype = { if (this.datas.phonegap == 'android') { var extras = {}; - extras[WebIntent.EXTRA_SUBJECT] = subject; - extras[WebIntent.EXTRA_TEXT] = body; - window.webintent.startActivity({ - action: WebIntent.ACTION_SEND, + extras[webintent.EXTRA_SUBJECT] = subject; + extras[webintent.EXTRA_TEXT] = body; + webintent.startActivity({ + action: webintent.ACTION_SEND, type: 'text/plain', extras: extras }, function(args) { @@ -1395,7 +1397,7 @@ Fluidbook.prototype = { var locationdefault = 'yes'; if (this.datas.phonegap) { - locationdefault = 'no'; + locationdefault = 'yes'; } if (options == '') { diff --git a/js/libs/gal/gal.filesystem.js b/js/libs/gal/gal.filesystem.js index fb3bab16..f7229884 100644 --- a/js/libs/gal/gal.filesystem.js +++ b/js/libs/gal/gal.filesystem.js @@ -153,7 +153,6 @@ // requestFileSystem and storageInfo shims var requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; - var storageInfo = window.storageInfo || window.webkitStorageInfo; var quota = opt_quota || DEFAULT_QUOTA; @@ -162,16 +161,7 @@ // Callback when the filesystem has been initialized var onInitFs = function(fs) { that.fs = fs; - - createDir_(fs.root, ROOT_DIR.split('/'), function(res) { - // Create a directory for the root of the GAL - fs.root.getDirectory(ROOT_DIR, {create: true}, function(dirEntry) { - that.root = dirEntry; - callback(); - }, onError); - }); - - + that.regenerate(callback); }; // Callback when the filesystem API has granted quota @@ -180,13 +170,16 @@ // Save grantedBytes in the adapter that.grantedBytes = grantedBytes; // Once quota is grantedBytes, initialize a filesystem - requestFileSystem(persistent, 0, onInitFs, onError); }; - - quotaCallback(0); - + if (storageInfo != undefined) { + // Get quota + storageInfo.requestQuota(window.PERSISTENT, quota, + quotaCallback, onError); + } else { + quotaCallback(0); + } }; @@ -247,13 +240,17 @@ * Clears everything out of the root directory. Mostly for unit testing. */ GALFS.prototype.clear = function(cb) { + var $this = this; // Remove the root directory this.root.removeRecursively(function() { + $this.regenerate(cb); }, onError); + }; + GALFS.prototype.regenerate = function(callback) { var that = this; // And then recreate it - fs = this.fs; + var fs = this.fs; createDir_(fs.root, ROOT_DIR.split('/'), function(res) { // Create a directory for the root of the GAL @@ -263,8 +260,7 @@ }, onError); }); - cb(); - }; + } if (!gal) { throw 'Game asset loader needs to be loaded before loading the fs adapter'; diff --git a/js/libs/gal/gal.js b/js/libs/gal/gal.js index 4848f28c..9569006b 100644 --- a/js/libs/gal/gal.js +++ b/js/libs/gal/gal.js @@ -212,7 +212,7 @@ GAL.prototype.initAdapter = function(callback) { if (null == this.adapter) { - initAdapter_(callback); + this.initAdapter_(callback); } else { callback(this.adapter); } @@ -231,12 +231,7 @@ ); }; - /** - * @private - * Sets the manifest and parses out bundles and bundle order. - * @param {function} callback Called when the adapter has initialized. - */ - function initAdapter_(callback) { + GAL.prototype.initAdapter_=function(callback) { var $this = this; if (this.adapter != null) { @@ -248,7 +243,7 @@ this.adapter.init(this._fsprefix, function() { callback($this.adapter); }); - } + }; /** * @private @@ -273,10 +268,9 @@ */ function finishInit_(manifest, callback) { var context = this; - initAdapter_.call(context, function() { + this.initAdapter_.call(context, function() { setManifest_.call(context, manifest); // Optionally, start auto-download. - console.log('autodownload ' + manifest.autoDownload); if (manifest.autoDownload && context.online()) { downloadAll_.call(context); } @@ -334,20 +328,17 @@ * Starts downloading all of the assets in the manifest, in order. */ function downloadAll_() { - console.log('downloadAll_'); var that = this; // Start by downloading the first bundle, then download subsequent ones. (function loop(bundleIndex) { console.log(bundleIndex); if (bundleIndex == that.bundleOrder.length) { // We're done downloading stuff! - console.log('ok !'); return; } var bundleName = that.bundleOrder[bundleIndex]; - console.log('loading ' + bundleName); that.onLoaded(bundleName, function() { // Once bundle is loaded, load the next bundle. loop(bundleIndex + 1); diff --git a/js/libs/phonegap/plugins/android/webintent.js b/js/libs/phonegap/plugins/android/webintent.js deleted file mode 100644 index da22b800..00000000 --- a/js/libs/phonegap/plugins/android/webintent.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * cordova Web Intent plugin - * Copyright (c) Boris Smus 2010 - * - */ -var WebIntent = function() { - -}; - -WebIntent.ACTION_SEND = "android.intent.action.SEND"; -WebIntent.ACTION_VIEW= "android.intent.action.VIEW"; -WebIntent.EXTRA_TEXT = "android.intent.extra.TEXT"; -WebIntent.EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; -WebIntent.EXTRA_STREAM = "android.intent.extra.STREAM"; -WebIntent.EXTRA_EMAIL = "android.intent.extra.EMAIL"; - -WebIntent.prototype.startActivity = function(params, success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'startActivity', [params]); -}; - -WebIntent.prototype.hasExtra = function(params, success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'hasExtra', [params]); -}; - -WebIntent.prototype.getUri = function(success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'getUri', []); -}; - -WebIntent.prototype.getExtra = function(params, success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'getExtra', [params]); -}; - - -WebIntent.prototype.onNewIntent = function(callback) { - return cordova.exec(function(args) { - callback(args); - }, function(args) { - }, 'WebIntent', 'onNewIntent', []); -}; - -WebIntent.prototype.sendBroadcast = function(params, success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'sendBroadcast', [params]); -}; - -cordova.addConstructor(function() { - window.webintent = new WebIntent(); - - // backwards compatibility - window.plugins = window.plugins || {}; - window.plugins.webintent = window.webintent; -}); diff --git a/js/libs/phonegap/plugins/ios/ExternalFileUtil.js b/js/libs/phonegap/plugins/ios/ExternalFileUtil.js deleted file mode 100644 index 308d1fd3..00000000 --- a/js/libs/phonegap/plugins/ios/ExternalFileUtil.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - THIS SOFTWARE IS PROVIDED BY ANDREW TRICE "AS IS" AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - EVENT SHALL ANDREW TRICE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -window.ExternalFileUtil = { - openWith: function(path, uti, success, fail, offset) { - return cordova.exec(success, fail, "ExternalFileUtil", "openWith", [path, uti, offset.left, offset.top]); - } -};