You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/03/16 19:14:49 UTC
[15/29] ios commit: tweaking battery plugin for cordova-js use
tweaking battery plugin for cordova-js use
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/c76bb614
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/c76bb614
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/c76bb614
Branch: refs/heads/master
Commit: c76bb614fa117b4d392b1233a1fcd789b934a255
Parents: 0c8fa92
Author: Fil Maj <ma...@gmail.com>
Authored: Fri Mar 2 17:37:08 2012 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Fri Mar 16 10:56:49 2012 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDVBattery.h | 2 ++
CordovaLib/Classes/CDVBattery.m | 5 ++---
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c76bb614/CordovaLib/Classes/CDVBattery.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVBattery.h b/CordovaLib/Classes/CDVBattery.h
index cf78d05..ae04069 100644
--- a/CordovaLib/Classes/CDVBattery.h
+++ b/CordovaLib/Classes/CDVBattery.h
@@ -24,11 +24,13 @@
@interface CDVBattery : CDVPlugin {
UIDeviceBatteryState state;
float level;
+ bool isPlugged;
NSString* callbackId;
}
@property (nonatomic) UIDeviceBatteryState state;
@property (nonatomic) float level;
+@property (nonatomic) bool isPlugged;
@property (retain) NSString* callbackId;
- (void) updateBatteryStatus:(NSNotification*)notification;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c76bb614/CordovaLib/Classes/CDVBattery.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVBattery.m b/CordovaLib/Classes/CDVBattery.m
index fc0b564..efd3d39 100644
--- a/CordovaLib/Classes/CDVBattery.m
+++ b/CordovaLib/Classes/CDVBattery.m
@@ -27,7 +27,7 @@
@implementation CDVBattery
-@synthesize state, level, callbackId;
+@synthesize state, level, callbackId, isPlugged;
/* determining type of event occurs on JavaScript side
@@ -75,11 +75,10 @@
*/
- (NSDictionary*) getBatteryStatus
{
-
UIDevice* currentDevice = [UIDevice currentDevice];
UIDeviceBatteryState currentState = [currentDevice batteryState];
- BOOL isPlugged = FALSE; // UIDeviceBatteryStateUnknown or UIDeviceBatteryStateUnplugged
+ isPlugged = FALSE; // UIDeviceBatteryStateUnknown or UIDeviceBatteryStateUnplugged
if (currentState == UIDeviceBatteryStateCharging || currentState == UIDeviceBatteryStateFull) {
isPlugged = TRUE;
}