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
\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
\r
var locationdefault = 'yes';\r
if (this.datas.phonegap) {\r
- locationdefault = 'no';\r
+ locationdefault = 'yes';\r
}\r
\r
if (options == '') {\r
// 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';
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);
+++ /dev/null
-/**
- * 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;
-});
+++ /dev/null
-/*
- 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]);
- }
-};