cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [01/11] git commit: added basic Device support for Windows8
Date Wed, 14 Aug 2013 21:54:37 GMT
Updated Branches:
  refs/heads/dev c90e7234d -> 2d0c783be (forced update)


added basic Device support for Windows8


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/61fa9c6f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/61fa9c6f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/61fa9c6f

Branch: refs/heads/dev
Commit: 61fa9c6f83b283555487873032939ebbadb69f07
Parents: a89a7c7
Author: purplecabbage <purplecabbage@gmail.com>
Authored: Fri Jul 26 12:00:22 2013 -0700
Committer: purplecabbage <purplecabbage@gmail.com>
Committed: Fri Jul 26 12:00:22 2013 -0700

----------------------------------------------------------------------
 plugin.xml                  |  7 ++++++
 src/windows8/DeviceProxy.js | 54 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/61fa9c6f/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 5e9a7cb..f53799c 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -70,4 +70,11 @@
         <source-file src="src/wp/Device.cs" />
     </platform>
 
+    <!-- windows8 -->
+    <platform name="windows8">
+        <js-module src="src/windows8/DeviceProxy.js" name="DeviceProxy">
+        </js-module>
+        <!--<source-file src="src/windows8/DeviceProxy.js" target-dir="wtf" /> -->
+    </platform>
+
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/61fa9c6f/src/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/DeviceProxy.js b/src/windows8/DeviceProxy.js
new file mode 100644
index 0000000..a0e1412
--- /dev/null
+++ b/src/windows8/DeviceProxy.js
@@ -0,0 +1,54 @@
+
+cordova.define("org.apache.cordova.core.device.DeviceProxy", function (require, exports,
module) {
+/*
+ *
+ * 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 cordova = require('cordova');
+var utils = require('cordova/utils');
+
+module.exports = {
+
+    getDeviceInfo:function(win,fail,args) {
+
+        // deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId
+        var deviceId;
+
+        var localSettings = Windows.Storage.ApplicationData.current.localSettings;
+
+        if (localSettings.values.deviceId) {
+            deviceId = localSettings.values.deviceId;
+        }
+        else {
+            deviceId = localSettings.values.deviceId = utils.createUUID();
+        }
+
+        setTimeout(function () {
+            win({ platform: "windows8", version: "8", uuid: deviceId, cordova: '0.0.0', model:
window.clientInformation.platform });
+        }, 0);
+    }
+
+};
+
+
+    require("cordova/commandProxy").add("Device", module.exports);
+
+});


Mime
View raw message