forked from jboss-developer/ticket-monster
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JDF-370 ticket-monster ios add CordovaLib classes in order to build i…
…n XCode
- Loading branch information
Showing
90 changed files
with
17,254 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
#import "CDVAvailability.h" | ||
|
||
#import "CDVPlugin.h" | ||
#import "CDVViewController.h" | ||
#import "CDVCommandDelegate.h" | ||
#import "CDVURLProtocol.h" | ||
#import "CDVInvokedUrlCommand.h" | ||
|
||
#import "CDVAccelerometer.h" | ||
#import "CDVBattery.h" | ||
#import "CDVCamera.h" | ||
#import "CDVCapture.h" | ||
#import "CDVConnection.h" | ||
#import "CDVContact.h" | ||
#import "CDVContacts.h" | ||
#import "CDVDebug.h" | ||
#import "CDVDevice.h" | ||
#import "CDVFile.h" | ||
#import "CDVFileTransfer.h" | ||
#import "CDVLocation.h" | ||
#import "CDVNotification.h" | ||
#import "CDVPluginResult.h" | ||
#import "CDVReachability.h" | ||
#import "CDVSound.h" | ||
#import "CDVSplashScreen.h" | ||
#import "CDVWhitelist.h" | ||
#import "CDVLocalStorage.h" | ||
#import "CDVInAppBrowser.h" | ||
#import "CDVScreenOrientationDelegate.h" | ||
#import "CDVTimer.h" | ||
|
||
#import "NSArray+Comparisons.h" | ||
#import "NSData+Base64.h" | ||
#import "NSDictionary+Extensions.h" | ||
#import "NSMutableArray+QueueAdditions.h" | ||
#import "UIDevice+Extensions.h" | ||
|
||
#import "CDVJSON.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "CDVPlugin.h" | ||
|
||
@interface CDVAccelerometer : CDVPlugin <UIAccelerometerDelegate> | ||
{ | ||
double x; | ||
double y; | ||
double z; | ||
NSTimeInterval timestamp; | ||
} | ||
|
||
@property (readonly, assign) BOOL isRunning; | ||
@property (nonatomic, strong) NSString* callbackId; | ||
|
||
- (CDVAccelerometer*)init; | ||
|
||
- (void)start:(CDVInvokedUrlCommand*)command; | ||
- (void)stop:(CDVInvokedUrlCommand*)command; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
#import "CDVAccelerometer.h" | ||
|
||
@interface CDVAccelerometer () {} | ||
@property (readwrite, assign) BOOL isRunning; | ||
@end | ||
|
||
@implementation CDVAccelerometer | ||
|
||
@synthesize callbackId, isRunning; | ||
|
||
// defaults to 10 msec | ||
#define kAccelerometerInterval 40 | ||
// g constant: -9.81 m/s^2 | ||
#define kGravitationalConstant -9.81 | ||
|
||
- (CDVAccelerometer*)init | ||
{ | ||
self = [super init]; | ||
if (self) { | ||
x = 0; | ||
y = 0; | ||
z = 0; | ||
timestamp = 0; | ||
self.callbackId = nil; | ||
self.isRunning = NO; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
[self stop:nil]; | ||
} | ||
|
||
- (void)start:(CDVInvokedUrlCommand*)command | ||
{ | ||
NSString* cbId = command.callbackId; | ||
NSTimeInterval desiredFrequency_num = kAccelerometerInterval; | ||
UIAccelerometer* pAccel = [UIAccelerometer sharedAccelerometer]; | ||
|
||
// accelerometer expects fractional seconds, but we have msecs | ||
pAccel.updateInterval = desiredFrequency_num / 1000; | ||
self.callbackId = cbId; | ||
if (!self.isRunning) { | ||
pAccel.delegate = self; | ||
self.isRunning = YES; | ||
} | ||
} | ||
|
||
- (void)onReset | ||
{ | ||
[self stop:nil]; | ||
} | ||
|
||
- (void)stop:(CDVInvokedUrlCommand*)command | ||
{ | ||
UIAccelerometer* theAccelerometer = [UIAccelerometer sharedAccelerometer]; | ||
|
||
theAccelerometer.delegate = nil; | ||
self.isRunning = NO; | ||
} | ||
|
||
/** | ||
* Picks up accel updates from device and stores them in this class | ||
*/ | ||
- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration | ||
{ | ||
if (self.isRunning) { | ||
x = acceleration.x; | ||
y = acceleration.y; | ||
z = acceleration.z; | ||
timestamp = ([[NSDate date] timeIntervalSince1970] * 1000); | ||
[self returnAccelInfo]; | ||
} | ||
} | ||
|
||
- (void)returnAccelInfo | ||
{ | ||
// Create an acceleration object | ||
NSMutableDictionary* accelProps = [NSMutableDictionary dictionaryWithCapacity:4]; | ||
|
||
[accelProps setValue:[NSNumber numberWithDouble:x * kGravitationalConstant] forKey:@"x"]; | ||
[accelProps setValue:[NSNumber numberWithDouble:y * kGravitationalConstant] forKey:@"y"]; | ||
[accelProps setValue:[NSNumber numberWithDouble:z * kGravitationalConstant] forKey:@"z"]; | ||
[accelProps setValue:[NSNumber numberWithDouble:timestamp] forKey:@"timestamp"]; | ||
|
||
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:accelProps]; | ||
[result setKeepCallback:[NSNumber numberWithBool:YES]]; | ||
[self.commandDelegate sendPluginResult:result callbackId:self.callbackId]; | ||
} | ||
|
||
// TODO: Consider using filtering to isolate instantaneous data vs. gravity data -jm | ||
|
||
/* | ||
#define kFilteringFactor 0.1 | ||
// Use a basic low-pass filter to keep only the gravity component of each axis. | ||
grav_accelX = (acceleration.x * kFilteringFactor) + ( grav_accelX * (1.0 - kFilteringFactor)); | ||
grav_accelY = (acceleration.y * kFilteringFactor) + ( grav_accelY * (1.0 - kFilteringFactor)); | ||
grav_accelZ = (acceleration.z * kFilteringFactor) + ( grav_accelZ * (1.0 - kFilteringFactor)); | ||
// Subtract the low-pass value from the current value to get a simplified high-pass filter | ||
instant_accelX = acceleration.x - ( (acceleration.x * kFilteringFactor) + (instant_accelX * (1.0 - kFilteringFactor)) ); | ||
instant_accelY = acceleration.y - ( (acceleration.y * kFilteringFactor) + (instant_accelY * (1.0 - kFilteringFactor)) ); | ||
instant_accelZ = acceleration.z - ( (acceleration.z * kFilteringFactor) + (instant_accelZ * (1.0 - kFilteringFactor)) ); | ||
*/ | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
#define __CORDOVA_IOS__ | ||
|
||
#define __CORDOVA_0_9_6 906 | ||
#define __CORDOVA_1_0_0 10000 | ||
#define __CORDOVA_1_1_0 10100 | ||
#define __CORDOVA_1_2_0 10200 | ||
#define __CORDOVA_1_3_0 10300 | ||
#define __CORDOVA_1_4_0 10400 | ||
#define __CORDOVA_1_4_1 10401 | ||
#define __CORDOVA_1_5_0 10500 | ||
#define __CORDOVA_1_6_0 10600 | ||
#define __CORDOVA_1_6_1 10601 | ||
#define __CORDOVA_1_7_0 10700 | ||
#define __CORDOVA_1_8_0 10800 | ||
#define __CORDOVA_1_8_1 10801 | ||
#define __CORDOVA_1_9_0 10900 | ||
#define __CORDOVA_2_0_0 20000 | ||
#define __CORDOVA_2_1_0 20100 | ||
#define __CORDOVA_2_2_0 20200 | ||
#define __CORDOVA_2_3_0 20300 | ||
#define __CORDOVA_2_4_0 20400 | ||
#define __CORDOVA_2_5_0 20500 | ||
#define __CORDOVA_2_6_0 20600 | ||
#define __CORDOVA_2_7_0 20700 | ||
#define __CORDOVA_NA 99999 /* not available */ | ||
|
||
/* | ||
#if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_1_7_0 | ||
// do something when its at least 1.7.0 | ||
#else | ||
// do something else (non 1.7.0) | ||
#endif | ||
*/ | ||
#ifndef CORDOVA_VERSION_MIN_REQUIRED | ||
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_2_7_0 | ||
#endif | ||
|
||
/* | ||
Returns YES if it is at least version specified as NSString(X) | ||
Usage: | ||
if (IsAtLeastiOSVersion(@"5.1")) { | ||
// do something for iOS 5.1 or greater | ||
} | ||
*/ | ||
#define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending) | ||
|
||
#define CDV_IsIPad() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)) | ||
|
||
#define CDV_IsIPhone5() ([[UIScreen mainScreen] bounds].size.height == 568 && [[UIScreen mainScreen] bounds].size.width == 320) | ||
|
||
/* Return the string version of the decimal version */ | ||
#define CDV_VERSION [NSString stringWithFormat:@"%d.%d.%d", \ | ||
(CORDOVA_VERSION_MIN_REQUIRED / 10000), \ | ||
(CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100, \ | ||
(CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100] | ||
|
||
#ifdef __clang__ | ||
#define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg))) | ||
#else | ||
#define CDV_DEPRECATED(version, msg) __attribute__((deprecated())) | ||
#endif | ||
|
||
// Enable this to log all exec() calls. | ||
#define CDV_ENABLE_EXEC_LOGGING 0 | ||
#if CDV_ENABLE_EXEC_LOGGING | ||
#define CDV_EXEC_LOG NSLog | ||
#else | ||
#define CDV_EXEC_LOG(...) do {} while (NO) | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "CDVPlugin.h" | ||
|
||
@interface CDVBattery : CDVPlugin { | ||
UIDeviceBatteryState state; | ||
float level; | ||
bool isPlugged; | ||
NSString* callbackId; | ||
} | ||
|
||
@property (nonatomic) UIDeviceBatteryState state; | ||
@property (nonatomic) float level; | ||
@property (nonatomic) bool isPlugged; | ||
@property (strong) NSString* callbackId; | ||
|
||
- (void)updateBatteryStatus:(NSNotification*)notification; | ||
- (NSDictionary*)getBatteryStatus; | ||
- (void)start:(CDVInvokedUrlCommand*)command; | ||
- (void)stop:(CDVInvokedUrlCommand*)command; | ||
- (void)dealloc; | ||
@end |
Oops, something went wrong.