You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ripple.apache.org by gt...@apache.org on 2013/10/21 04:42:32 UTC
[03/15] git commit: Stubbing in inappbrowser
Stubbing in inappbrowser
- parse out whitelist from config
- created overlay for inappbrowser
- inappbrowser bridge stup
Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/86157fd4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/86157fd4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/86157fd4
Branch: refs/heads/next
Commit: 86157fd49a3918725f8e1d6e3c47e709bd9d3dfb
Parents: 4b90a4d
Author: Gord Tanner <gt...@gmail.com>
Authored: Thu Sep 5 21:30:57 2013 -0400
Committer: Gord Tanner <gt...@gmail.com>
Committed: Thu Sep 5 21:30:57 2013 -0400
----------------------------------------------------------------------
assets/client/ripple.css | 13 +
.../platform/cordova/2.0.0/bridge/compass.js | 2 +-
.../cordova/3.0.0/bridge/inappbrowser.js | 53 ++++
lib/client/platform/cordova/3.0.0/spec.js | 3 +-
.../platform/cordova/3.0.0/spec/config.js | 292 +++++++++++++++++++
lib/client/ui/plugins/browser/overlay.html | 23 ++
6 files changed, 384 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/86157fd4/assets/client/ripple.css
----------------------------------------------------------------------
diff --git a/assets/client/ripple.css b/assets/client/ripple.css
index 2d7a40b..48742b2 100644
--- a/assets/client/ripple.css
+++ b/assets/client/ripple.css
@@ -445,6 +445,19 @@ section.left { left: 0; }
margin: 5px;
}
+.overlay-browser {
+ z-index: 1000;
+ position: absolute;
+ display: none;
+ width: 100%;
+ height: 100%;
+ -webkit-box-orient: horizontal;
+ -webkit-box-pack: center;
+ -webkit-box-align: center;
+ overflow-y: auto;
+ background: rgba(255, 255, 255, 1);
+}
+
.overlay-menu {
z-index: 1000;
position: absolute;
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/86157fd4/lib/client/platform/cordova/2.0.0/bridge/compass.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/2.0.0/bridge/compass.js b/lib/client/platform/cordova/2.0.0/bridge/compass.js
index 01cac56..da8fcc8 100644
--- a/lib/client/platform/cordova/2.0.0/bridge/compass.js
+++ b/lib/client/platform/cordova/2.0.0/bridge/compass.js
@@ -28,7 +28,7 @@ module.exports = {
getHeading: function (success) {
// TODO: build facility to trigger onError() from emulator
// see pivotal item: https://www.pivotaltracker.com/story/show/7040343
-
+
var win = bridge.window(),
heading = new win.CompassHeading();
heading.trueHeading = geo.getPositionInfo().heading;
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/86157fd4/lib/client/platform/cordova/3.0.0/bridge/inappbrowser.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/3.0.0/bridge/inappbrowser.js b/lib/client/platform/cordova/3.0.0/bridge/inappbrowser.js
new file mode 100644
index 0000000..fa5b684
--- /dev/null
+++ b/lib/client/platform/cordova/3.0.0/bridge/inappbrowser.js
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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.
+ *
+ */
+module.exports = {
+ open: function (win, fail, args) {
+ var url = args[0],
+ target = args[1],
+ options = args[2];
+
+ console.log(args);
+ },
+
+ show: function (win, fail, args) {
+ console.log(args);
+ },
+
+ close: function (win, fail, args) {
+ console.log(args);
+ },
+
+ injectScriptCode: function (win, fail, args) {
+ console.log(args);
+ },
+
+ injectScriptFile: function (win, fail, args) {
+ console.log(args);
+ },
+
+ injectStyleCode: function (win, fail, args) {
+ console.log(args);
+ },
+
+ injectStyleFile: function (win, fail, args) {
+ console.log(args);
+ }
+};
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/86157fd4/lib/client/platform/cordova/3.0.0/spec.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/3.0.0/spec.js b/lib/client/platform/cordova/3.0.0/spec.js
index bcd3062..4e9b051 100644
--- a/lib/client/platform/cordova/3.0.0/spec.js
+++ b/lib/client/platform/cordova/3.0.0/spec.js
@@ -23,7 +23,7 @@ module.exports = {
type: "platform",
nativeMethods: {},
- config: ripple('platform/cordova/2.0.0/spec/config'),
+ config: ripple('platform/cordova/3.0.0/spec/config'),
device: ripple('platform/cordova/2.0.0/spec/device'),
ui: ripple('platform/cordova/2.0.0/spec/ui'),
events: ripple('platform/cordova/2.0.0/spec/events'),
@@ -48,6 +48,7 @@ module.exports = {
bridge.add("PluginManager", ripple('platform/cordova/3.0.0/bridge/PluginManager'));
bridge.add("SplashScreen", ripple('platform/cordova/3.0.0/bridge/splashscreen'));
+ bridge.add("InAppBrowser", ripple('platform/cordova/3.0.0/bridge/inappbrowser'));
honeypot.monitor(win, "cordova").andRun(get, set);
},
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/86157fd4/lib/client/platform/cordova/3.0.0/spec/config.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/3.0.0/spec/config.js b/lib/client/platform/cordova/3.0.0/spec/config.js
new file mode 100644
index 0000000..64373be
--- /dev/null
+++ b/lib/client/platform/cordova/3.0.0/spec/config.js
@@ -0,0 +1,292 @@
+/*
+ *
+ * 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.
+ *
+ */
+var constants = ripple('constants');
+
+module.exports = {
+ fileName: "config.xml",
+ validateVersion: function (configValidationObject) {
+ var valid = true;
+ valid = !((!configValidationObject.widget.validationResult[0].attributes.xmlns.valid) ||
+ (!configValidationObject.widget.validationResult[0].attributes["xmlns:gap"].valid));
+
+ return valid;
+ },
+ extractInfo: function (configValidationObject) {
+ if (!configValidationObject) {
+ return null;
+ }
+
+ var widgetInfo = {};
+
+ widgetInfo.id = configValidationObject.widget.validationResult[0].attributes.id.value || "";
+ widgetInfo.name = configValidationObject.widget.children.name.validationResult[0].value;
+ widgetInfo.icon = configValidationObject.widget.children.icon.validationResult[0].attributes.src.value;
+ widgetInfo.version = configValidationObject.widget.validationResult[0].attributes.version.value;
+
+ widgetInfo.whitelist = configValidationObject.widget.children.access.validationResult.map(function (r) {
+ return {
+ origin: r.attributes.origin.value,
+ subdomains: r.attributes.subdomains.value
+ }
+ });
+
+ return widgetInfo;
+ },
+ schema: {
+ rootElement: "widget",
+ widget: {
+ nodeName: "widget",
+ required: true,
+ occurrence: 1,
+ attributes: {
+ xmlns: {
+ attributeName: "xmlns",
+ required: true,
+ type: "list",
+ listValues: ["http://www.w3.org/ns/widgets"]
+ },
+ "xmlns:gap": {
+ attributeName: "xmlns:gap",
+ required: true,
+ type: "list",
+ listValues: ["http://phonegap.com/ns/1.0"]
+ },
+ "xml:lang": {
+ attributeName: "xml:lang",
+ required: false,
+ type: "iso-language"
+ },
+ dir: {
+ attributeName: "dir",
+ required: false,
+ type: "list",
+ listValues: ["ltr", "rtl", "lro", "rlo"]
+ },
+ id: {
+ attributeName: "id",
+ required: false,
+ type: "string"
+ },
+ version: {
+ attributeName: "version",
+ required: false,
+ type: "string"
+ },
+ height: {
+ attributeName: "height",
+ required: false,
+ type: "integer"
+ },
+ width: {
+ attributeName: "width",
+ required: false,
+ type: "integer"
+ },
+ viewmodes: {
+ attributeName: "viewmodes",
+ required: false,
+ type: "list",
+ listValues: ["floating", "fullscreen"]
+ }
+ },
+ children: {
+ name: {
+ nodeName: "name",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "short": {
+ attributeName: "short",
+ type: "string",
+ required: false
+ },
+ "xml:lang": {
+ attributeName: "xml:lang",
+ type: "string",
+ required: false,
+ unique: true
+ }
+ }
+ },
+ description: {
+ nodeName: "description",
+ required: false,
+ occurrence: 0,
+ type: "string",
+ attributes: {
+ "xml:lang": {
+ attributeName: "xml:lang",
+ type: "string",
+ required: false,
+ unique: true
+ }
+ }
+ },
+ author: {
+ nodeName: "author",
+ required: false,
+ occurrence: 1,
+ type: "string",
+ attributes: {
+ email: {
+ attributeName: "email",
+ type: "regex",
+ required: false,
+ regex: constants.REGEX.EMAIL
+ },
+ href: {
+ attributeName: "href",
+ type: "regex",
+ required: false,
+ regex: constants.REGEX.URL
+ }
+ }
+ },
+ license: {
+ nodeName: "license",
+ required: false,
+ occurrence: 1,
+ type: "string",
+ attributes: {
+ href: {
+ attributeName: "href",
+ type: "regex",
+ required: false,
+ regex: constants.REGEX.URL
+ },
+ "xml:lang": {
+ attributeName: "xml:lang",
+ type: "string",
+ required: false,
+ unique: true
+ }
+ }
+ },
+ icon: {
+ nodeName: "icon",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ src: {
+ attributeName: "src",
+ type: "string",
+ required: true
+ },
+ height: {
+ attributeName: "height",
+ required: false,
+ type: "integer"
+ },
+ width: {
+ attributeName: "width",
+ required: false,
+ type: "integer"
+ }
+ }
+ },
+ content: {
+ nodeName: "content",
+ required: false,
+ occurrence: 1,
+ attributes: {
+ src: {
+ attributeName: "src",
+ type: "string",
+ required: true
+ },
+ encoding: {
+ attributeName: "encoding",
+ type: "string",
+ required: false
+ },
+ type: {
+ attributeName: "type",
+ type: "string",
+ required: false
+ }
+ }
+ },
+ access: {
+ nodeName: "access",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ origin: {
+ attributeName: "origin",
+ type: "string",
+ required: true
+ },
+ subdomains: {
+ attributeName: "subdomains",
+ type: "boolean",
+ required: false
+ }
+ }
+ },
+ feature: {
+ nodeName: "feature",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ type: "list",
+ required: true,
+ listValues: ["http://api.phonegap.com/1.0/accelerometer", "http://api.phonegap.com/1.0/camera",
+ "http://api.phonegap.com/1.0/compass", "http://api.phonegap.com/1.0/contacts", "http://api.phonegap.com/1.0/device",
+ "http://api.phonegap.com/1.0/events", "http://api.phonegap.com/1.0/file", "http://api.phonegap.com/1.0/geolocation",
+ "http://api.phonegap.com/1.0/media", "http://api.phonegap.com/1.0/network", "http://api.phonegap.com/1.0/notification",
+ "http://api.phonegap.com/1.0/storage"]
+ },
+ required: {
+ attributeName: "required",
+ type: "boolean",
+ required: false
+ }
+ }
+ },
+ preference: {
+ nodeName: "preference",
+ required: false,
+ occurrence: 0,
+ attributes: {
+ name: {
+ attributeName: "name",
+ type: "string",
+ required: true
+ },
+ value: {
+ type: "string",
+ attributeName: "value",
+ required: false
+ },
+ readonly: {
+ attributeName: "readonly",
+ type: "boolean",
+ required: false
+ }
+ }
+ }
+ }
+ }
+ }
+};
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/86157fd4/lib/client/ui/plugins/browser/overlay.html
----------------------------------------------------------------------
diff --git a/lib/client/ui/plugins/browser/overlay.html b/lib/client/ui/plugins/browser/overlay.html
new file mode 100644
index 0000000..c28d65e
--- /dev/null
+++ b/lib/client/ui/plugins/browser/overlay.html
@@ -0,0 +1,23 @@
+<!--
+ *
+ * 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.
+ *
+-->
+<section id="inappbrowser" class="overlay-browser">
+ This is the InAppBrowser!
+</section>