]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 20 Sep 2013 08:19:08 +0000 (08:19 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 20 Sep 2013 08:19:08 +0000 (08:19 +0000)
js/libs/fluidbook/fluidbook.js
js/libs/gal/gal.filesystem.js
js/libs/gal/gal.js
js/libs/phonegap/plugins/android/webintent.js [deleted file]
js/libs/phonegap/plugins/ios/ExternalFileUtil.js [deleted file]

index ab86c70763e1f5cab6102571bdf49d93f619f2b2..c8e3aa0cfd96770baa846146d8189e2cd5d804ff 100644 (file)
@@ -1287,13 +1287,15 @@ Fluidbook.prototype = {
                        if (types_android[type] != undefined) {\r
                                this.displayLoader();\r
                                setTimeout(function() {\r
-                                       window.webintent.startActivity({\r
-                                               action: WebIntent.ACTION_VIEW,\r
+                                       webintent.startActivity({\r
+                                               action: webintent.ACTION_VIEW,\r
                                                type: types_android[type],\r
                                                url: url\r
                                        }, function(args) {\r
+                                               console.log(args);\r
                                                $this.hideLoader(5);\r
                                        }, function(args) {\r
+                                               console.warn(args);\r
                                                $this.hideLoader(5);\r
                                        });\r
                                }, 100);\r
@@ -1371,10 +1373,10 @@ Fluidbook.prototype = {
 \r
                if (this.datas.phonegap == 'android') {\r
                        var extras = {};\r
-                       extras[WebIntent.EXTRA_SUBJECT] = subject;\r
-                       extras[WebIntent.EXTRA_TEXT] = body;\r
-                       window.webintent.startActivity({\r
-                               action: WebIntent.ACTION_SEND,\r
+                       extras[webintent.EXTRA_SUBJECT] = subject;\r
+                       extras[webintent.EXTRA_TEXT] = body;\r
+                       webintent.startActivity({\r
+                               action: webintent.ACTION_SEND,\r
                                type: 'text/plain',\r
                                extras: extras\r
                        }, function(args) {\r
@@ -1395,7 +1397,7 @@ Fluidbook.prototype = {
 \r
                var locationdefault = 'yes';\r
                if (this.datas.phonegap) {\r
-                       locationdefault = 'no';\r
+                       locationdefault = 'yes';\r
                }\r
 \r
                if (options == '') {\r
index fb3bab1641585d29eb60af847b1aca2a6dc0bd49..f7229884a9fe6dc9189524d26fb47577ac8f65f1 100644 (file)
                // requestFileSystem and storageInfo shims
                var requestFileSystem = window.requestFileSystem ||
                                window.webkitRequestFileSystem;
-
                var storageInfo = window.storageInfo || window.webkitStorageInfo;
 
                var quota = opt_quota || DEFAULT_QUOTA;
                // 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
                        // 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);
+               }
 
        };
 
         * 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
                        }, onError);
                });
 
-               cb();
-       };
+       }
 
        if (!gal) {
                throw 'Game asset loader needs to be loaded before loading the fs adapter';
index 4848f28c825d27a9bde293d26076d4adc296ef71..9569006b277fba1f8b7912a0a8bc81cb252849fe 100644 (file)
 
        GAL.prototype.initAdapter = function(callback) {
                if (null == this.adapter) {
-                       initAdapter_(callback);
+                       this.initAdapter_(callback);
                } else {
                        callback(this.adapter);
                }
                );
        };
 
-       /**
-        * @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) {
                this.adapter.init(this._fsprefix, function() {
                        callback($this.adapter);
                });
-       }
+       };
 
        /**
         * @private
         */
        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);
                        }
         * 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 (file)
index da22b80..0000000
+++ /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 (file)
index 308d1fd..0000000
+++ /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]);
-       }
-};