cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject git commit: [CB-4109] Remove dupe code
Date Mon, 08 Jul 2013 21:48:21 GMT
Updated Branches:
  refs/heads/master 63a5f6fb9 -> 808a3e259


[CB-4109] Remove dupe code


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/commit/808a3e25
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/tree/808a3e25
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/diff/808a3e25

Branch: refs/heads/master
Commit: 808a3e259c960efa65e5d1b53162c70a59454c45
Parents: 63a5f6f
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Mon Jul 8 14:48:02 2013 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Mon Jul 8 14:48:02 2013 -0700

----------------------------------------------------------------------
 plugin.xml         |  4 +--
 src/wp/Battery.cs  | 79 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/wp7/Battery.cs | 79 -------------------------------------------------
 src/wp8/Battery.cs | 79 -------------------------------------------------
 4 files changed, 81 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/blob/808a3e25/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 407030c..9e8a699 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -47,7 +47,7 @@
             </feature>
         </config-file>
 
-        <source-file src="src/wp7/Battery.cs" />
+        <source-file src="src/wp/Battery.cs" />
     </platform>
 
     <!-- wp8 -->
@@ -58,7 +58,7 @@
             </feature>
         </config-file>
 
-        <source-file src="src/wp8/Battery.cs" />
+        <source-file src="src/wp/Battery.cs" />
     </platform>
     
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/blob/808a3e25/src/wp/Battery.cs
----------------------------------------------------------------------
diff --git a/src/wp/Battery.cs b/src/wp/Battery.cs
new file mode 100644
index 0000000..962959e
--- /dev/null
+++ b/src/wp/Battery.cs
@@ -0,0 +1,79 @@
+/*  
+	Licensed 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.
+*/
+
+using System;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+
+using Microsoft.Phone.Info;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+    /// <summary>
+    /// Listens for changes to the state of the battery on the device.
+    /// Currently only the "isPlugged" parameter available via native APIs.
+    /// </summary>
+    public class Battery : BaseCommand
+    {
+        private bool isPlugged = false;
+        private EventHandler powerChanged;
+
+        public Battery()
+        {
+            powerChanged = new EventHandler(DeviceStatus_PowerSourceChanged);
+            isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
+        }
+
+        public void start(string options)
+        {
+            // Register power changed event handler
+            DeviceStatus.PowerSourceChanged += powerChanged;
+
+            PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
+            result.KeepCallback = true;
+            DispatchCommandResult(result);
+        }
+        public void stop(string options)
+        {
+            // Unregister power changed event handler
+            DeviceStatus.PowerSourceChanged -= powerChanged;
+        }
+
+        private void DeviceStatus_PowerSourceChanged(object sender, EventArgs e)
+        {
+            isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
+            PluginResult result = new PluginResult(PluginResult.Status.OK, GetCurrentBatteryStateFormatted());
+            result.KeepCallback = true;
+            DispatchCommandResult(result);
+        }
+
+        private string GetCurrentBatteryStateFormatted()
+        {
+            string batteryState = String.Format("\"level\":{0},\"isPlugged\":{1}",
+                                                    "null",
+                                                    isPlugged ? "true" : "false"
+                            );
+            batteryState = "{" + batteryState + "}";
+            return batteryState;
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/blob/808a3e25/src/wp7/Battery.cs
----------------------------------------------------------------------
diff --git a/src/wp7/Battery.cs b/src/wp7/Battery.cs
deleted file mode 100644
index 962959e..0000000
--- a/src/wp7/Battery.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-/*  
-	Licensed 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.
-*/
-
-using System;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-
-using Microsoft.Phone.Info;
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
-    /// <summary>
-    /// Listens for changes to the state of the battery on the device.
-    /// Currently only the "isPlugged" parameter available via native APIs.
-    /// </summary>
-    public class Battery : BaseCommand
-    {
-        private bool isPlugged = false;
-        private EventHandler powerChanged;
-
-        public Battery()
-        {
-            powerChanged = new EventHandler(DeviceStatus_PowerSourceChanged);
-            isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
-        }
-
-        public void start(string options)
-        {
-            // Register power changed event handler
-            DeviceStatus.PowerSourceChanged += powerChanged;
-
-            PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
-            result.KeepCallback = true;
-            DispatchCommandResult(result);
-        }
-        public void stop(string options)
-        {
-            // Unregister power changed event handler
-            DeviceStatus.PowerSourceChanged -= powerChanged;
-        }
-
-        private void DeviceStatus_PowerSourceChanged(object sender, EventArgs e)
-        {
-            isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
-            PluginResult result = new PluginResult(PluginResult.Status.OK, GetCurrentBatteryStateFormatted());
-            result.KeepCallback = true;
-            DispatchCommandResult(result);
-        }
-
-        private string GetCurrentBatteryStateFormatted()
-        {
-            string batteryState = String.Format("\"level\":{0},\"isPlugged\":{1}",
-                                                    "null",
-                                                    isPlugged ? "true" : "false"
-                            );
-            batteryState = "{" + batteryState + "}";
-            return batteryState;
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/blob/808a3e25/src/wp8/Battery.cs
----------------------------------------------------------------------
diff --git a/src/wp8/Battery.cs b/src/wp8/Battery.cs
deleted file mode 100644
index 962959e..0000000
--- a/src/wp8/Battery.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-/*  
-	Licensed 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.
-*/
-
-using System;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-
-using Microsoft.Phone.Info;
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
-    /// <summary>
-    /// Listens for changes to the state of the battery on the device.
-    /// Currently only the "isPlugged" parameter available via native APIs.
-    /// </summary>
-    public class Battery : BaseCommand
-    {
-        private bool isPlugged = false;
-        private EventHandler powerChanged;
-
-        public Battery()
-        {
-            powerChanged = new EventHandler(DeviceStatus_PowerSourceChanged);
-            isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
-        }
-
-        public void start(string options)
-        {
-            // Register power changed event handler
-            DeviceStatus.PowerSourceChanged += powerChanged;
-
-            PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
-            result.KeepCallback = true;
-            DispatchCommandResult(result);
-        }
-        public void stop(string options)
-        {
-            // Unregister power changed event handler
-            DeviceStatus.PowerSourceChanged -= powerChanged;
-        }
-
-        private void DeviceStatus_PowerSourceChanged(object sender, EventArgs e)
-        {
-            isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
-            PluginResult result = new PluginResult(PluginResult.Status.OK, GetCurrentBatteryStateFormatted());
-            result.KeepCallback = true;
-            DispatchCommandResult(result);
-        }
-
-        private string GetCurrentBatteryStateFormatted()
-        {
-            string batteryState = String.Format("\"level\":{0},\"isPlugged\":{1}",
-                                                    "null",
-                                                    isPlugged ? "true" : "false"
-                            );
-            batteryState = "{" + batteryState + "}";
-            return batteryState;
-        }
-
-    }
-}


Mime
View raw message