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:31 UTC
[02/15] git commit: More Cordova 3.0 support
More Cordova 3.0 support
- updated missing module prompt to handle when user selects a callback
and ones doesn't exist (used to crash, now just ignores)
- added splashscreen bridge module and tests
- got rid of debug console log
Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/4b90a4d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/4b90a4d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/4b90a4d2
Branch: refs/heads/next
Commit: 4b90a4d2beac6dbc7377205515cca1abc5c96f86
Parents: 27c7832
Author: Gord Tanner <gt...@gmail.com>
Authored: Tue Sep 3 22:23:41 2013 -0400
Committer: Gord Tanner <gt...@gmail.com>
Committed: Tue Sep 3 22:23:41 2013 -0400
----------------------------------------------------------------------
.../platform/cordova/2.0.0/bridge/compass.js | 9 +++--
.../cordova/3.0.0/bridge/splashscreen.js | 30 +++++++++++++++
lib/client/platform/cordova/3.0.0/spec.js | 2 +-
lib/client/ui/plugins/exec-dialog.js | 4 +-
lib/client/ui/plugins/splashscreen/overlay.html | 23 +++++++++++
test/unit/client/cordova/splashscreen.js | 40 ++++++++++++++++++++
6 files changed, 102 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/4b90a4d2/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 f844d17..01cac56 100644
--- a/lib/client/platform/cordova/2.0.0/bridge/compass.js
+++ b/lib/client/platform/cordova/2.0.0/bridge/compass.js
@@ -20,7 +20,6 @@
*/
var geo = ripple('geo'),
bridge = ripple('emulatorBridge'),
- CompassHeading = bridge.window().CompassHeading,
_success,
_error,
_interval;
@@ -29,8 +28,9 @@ module.exports = {
getHeading: function (success) {
// TODO: build facility to trigger onError() from emulator
// see pivotal item: https://www.pivotaltracker.com/story/show/7040343
-
- var heading = new CompassHeading();
+
+ var win = bridge.window(),
+ heading = new win.CompassHeading();
heading.trueHeading = geo.getPositionInfo().heading;
heading.magneticHeading = geo.getPositionInfo().heading;
heading.headingAccuracy = 100;
@@ -46,7 +46,8 @@ module.exports = {
_error = error;
_interval = window.setInterval(function () {
- var heading = new CompassHeading();
+ var win = bridge.window(),
+ heading = new win.CompassHeading();
heading.trueHeading = geo.getPositionInfo().heading;
heading.magneticHeading = geo.getPositionInfo().heading;
heading.headingAccuracy = 100;
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/4b90a4d2/lib/client/platform/cordova/3.0.0/bridge/splashscreen.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/3.0.0/bridge/splashscreen.js b/lib/client/platform/cordova/3.0.0/bridge/splashscreen.js
new file mode 100644
index 0000000..009416d
--- /dev/null
+++ b/lib/client/platform/cordova/3.0.0/bridge/splashscreen.js
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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 ui = ripple('ui');
+
+module.exports = {
+ show: function () {
+ ui.showOverlay('splashscreen');
+ },
+ hide: function () {
+ ui.hideOverlay('splashscreen');
+ }
+};
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/4b90a4d2/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 e8c83c9..bcd3062 100644
--- a/lib/client/platform/cordova/3.0.0/spec.js
+++ b/lib/client/platform/cordova/3.0.0/spec.js
@@ -36,7 +36,6 @@ module.exports = {
return cordova;
},
set = function (orig) {
- console.log('wtf');
if (cordova) return;
cordova = orig;
@@ -48,6 +47,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'));
honeypot.monitor(win, "cordova").andRun(get, set);
},
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/4b90a4d2/lib/client/ui/plugins/exec-dialog.js
----------------------------------------------------------------------
diff --git a/lib/client/ui/plugins/exec-dialog.js b/lib/client/ui/plugins/exec-dialog.js
index 165df15..3eee353 100644
--- a/lib/client/ui/plugins/exec-dialog.js
+++ b/lib/client/ui/plugins/exec-dialog.js
@@ -24,7 +24,9 @@ function exec(func) {
var val = $("#exec-response").val();
//TODO: handle multiple args
- func.apply(null, val ? [JSON.parse(val)] : []);
+ if (func) {
+ func.apply(null, val ? [JSON.parse(val)] : []);
+ }
$("#exec-dialog").dialog("close");
};
}
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/4b90a4d2/lib/client/ui/plugins/splashscreen/overlay.html
----------------------------------------------------------------------
diff --git a/lib/client/ui/plugins/splashscreen/overlay.html b/lib/client/ui/plugins/splashscreen/overlay.html
new file mode 100644
index 0000000..76ecae8
--- /dev/null
+++ b/lib/client/ui/plugins/splashscreen/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="splashscreen" class="overlay">
+ <h1>The app is currently displaying the splashscreen</h1>
+</section>
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/4b90a4d2/test/unit/client/cordova/splashscreen.js
----------------------------------------------------------------------
diff --git a/test/unit/client/cordova/splashscreen.js b/test/unit/client/cordova/splashscreen.js
new file mode 100644
index 0000000..01b9c3e
--- /dev/null
+++ b/test/unit/client/cordova/splashscreen.js
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+describe("Cordova splashscreen bridge", function () {
+ var splash = ripple('platform/cordova/3.0.0/bridge/splashscreen'),
+ ui = ripple('ui');
+
+ beforeEach(function () {
+ spyOn(ui, "showOverlay");
+ spyOn(ui, "hideOverlay");
+ });
+
+ it("shows the overlay on show", function () {
+ splash.show();
+ expect(ui.showOverlay).toHaveBeenCalledWith('splashscreen');
+ });
+
+ it("hides the overlay on hide", function () {
+ splash.hide();
+ expect(ui.hideOverlay).toHaveBeenCalledWith('splashscreen');
+ });
+});