cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [16/38] js commit: [Blackberry10] Clobber window.requestFileSystem to use WebKit version
Date Tue, 14 May 2013 21:12:55 GMT
[Blackberry10] Clobber window.requestFileSystem to use WebKit version


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/dbb478cc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/dbb478cc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/dbb478cc

Branch: refs/heads/3.0.0
Commit: dbb478cc1b16051dfe7ab465f1ac82801c1c9b47
Parents: d21fed2
Author: Bryan Higgins <bhiggins@blackberry.com>
Authored: Mon Apr 1 11:18:36 2013 -0400
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Fri May 3 09:49:38 2013 -0400

----------------------------------------------------------------------
 lib/blackberry10/plugin/blackberry10/platform.js   |   21 ++++++++-
 .../plugin/blackberry10/requestFileSystem.js       |   39 +++++++++++++++
 2 files changed, 59 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/dbb478cc/lib/blackberry10/plugin/blackberry10/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/platform.js b/lib/blackberry10/plugin/blackberry10/platform.js
index 871f2d1..d43cdd5 100644
--- a/lib/blackberry10/plugin/blackberry10/platform.js
+++ b/lib/blackberry10/plugin/blackberry10/platform.js
@@ -25,13 +25,15 @@ module.exports = {
     id: "blackberry10",
     initialize: function () {
         document.addEventListener("deviceready", function () {
+            /*
+             TODO
             blackberry.event.addEventListener("pause", function () {
                 cordova.fireDocumentEvent("pause");
             });
             blackberry.event.addEventListener("resume", function () {
                 cordova.fireDocumentEvent("resume");
             });
-
+            */
             window.addEventListener("online", function () {
                 cordova.fireDocumentEvent("online");
             });
@@ -40,5 +42,22 @@ module.exports = {
                 cordova.fireDocumentEvent("offline");
             });
         });
+    },
+    clobbers: {
+        open: {
+            path: "cordova/plugin/InAppBrowser"
+        },
+        requestFileSystem: {
+            path: "cordova/plugin/blackberry10/requestFileSystem"
+        }
+    },
+    merges: {
+        navigator: {
+            children: {
+                compass: {
+                    path: 'cordova/plugin/blackberry10/compass'
+                }
+            }
+        }
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/dbb478cc/lib/blackberry10/plugin/blackberry10/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/requestFileSystem.js b/lib/blackberry10/plugin/blackberry10/requestFileSystem.js
new file mode 100644
index 0000000..18c64e5
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/requestFileSystem.js
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+function getFileSystemName(fs) {
+    return (fs.name.indexOf("Persistent") != -1) ? "persistent" : "temporary";
+}
+
+function makeEntry(entry) {
+    if (entry.isDirectory) {
+        return new DirectoryEntry(entry.name, decodeURI(entry.toURL()).substring(11));
+    }
+    else {
+        return new FileEntry(entry.name, decodeURI(entry.toURL()).substring(11));
+    }
+}
+
+module.exports = function (type, size, success, fail) {
+    window.webkitRequestFileSystem(type, size, function (fs) {
+        success((new FileSystem(getFileSystemName(fs), makeEntry(fs.root))));
+    }, fail);
+};


Mime
View raw message