Skip to content

Commit

Permalink
Merge pull request #1 from wcwynn/updates-for-1.9
Browse files Browse the repository at this point in the history
Added example iOS program.
  • Loading branch information
aogilvie committed Jan 16, 2013
2 parents 8b2dbbe + 944fd98 commit 50d1a2f
Show file tree
Hide file tree
Showing 86 changed files with 14,473 additions and 50 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.DS_Store
example/www/phonegap/*
example/ios/exampleWizAssets.xcodeproj/xcuserdata/*
example/ios/exampleWizAssets.xcodeproj/project.xcworkspace/*
33 changes: 24 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
# PLUGIN:

phonegap-plugin-wizAssets<br />
version : 1.7<br />
last update : 10/05/2012<br />
version : 1.9<br />
last update : 06/11/2012<br />


# CHANGELOG:
<br />
- Updated for Cordova 1.7
- Updated for Cordova 1.9
- Changed deleteFile error handling.
- Removed unimplemented plugin methods.
- Updated error handling to more closely follow the w3c file api error
conventions http://www.w3.org/TR/FileAPI/


# KNOWN ISSUES:
Expand Down Expand Up @@ -90,15 +94,26 @@ wizAssets.downloadFile(String URL, String filePathToBeStoredWithFilename, Functi
<pre><code>
{

wizAssets.downloadFile("http://google.com/logo.jpg" , "img/ui/logo.jpg", function(e){ alert("success "+e) } , function(e){ alert("fail "+e) } );
wizAssets.downloadFile("http://google.com/logo.jpg", "img/ui/logo.jpg", successCallback, failCallback );

}
</code></pre>

wizAssets.deleteFiles(Array manyURIs , Function success, Function fail );
wizAssets.deleteFile(string URI, Function success, Function fail);
<br />
* delete all URIs in Array like; [ "file://documents/settings/img/cards/card001.jpg" , "file://documents/settings/img/cards/card002.jpg " .. ] <br />
* if you do specify a filename only dir, then all contents of dir will be deleted; file://documents/settings/img/cards <br />
* deletes the file specified by the URI <br />
* if the URI does not exist fail will be called with error NotFoundError <br />
* if the URI cannot be deleted (i.e. file resides in read-only memory) fail will be called with error NotModificationAllowedError <br />
<pre><code>
{
wizAssets.deleteFile("file://documents/settings/img/cards/card001.jpg", successCallback, failCallback);
}
</code></pre>

wizAssets.deleteFiles(Array manyURIs, Function success, Function fail );
<br />
* delete all URIs in Array like; [ "file://documents/settings/img/cards/card001.jpg", "file://documents/settings/img/cards/card002.jpg " .. ] <br />
* if you do not specify a filename only dir, then all contents of dir will be deleted; file://documents/settings/img/cards <br />
* the array CAN contain one URI string <br />


Expand All @@ -110,7 +125,7 @@ wizAssets.getFileURI(String filePathWithFilename, Function success, Function fai
<pre><code>
{

wizAssets.getFileURI("img/ui/logo.jpg" , function(e){ alert("success "+e) } , function(e){ alert("fail "+e) } );
wizAssets.getFileURI("img/ui/logo.jpg", successCallback, failCallback );

}
</code></pre>
Expand All @@ -125,4 +140,4 @@ wizAssets.getFileURIs(Function success, Function fail);
img/cards/card001.jpg : "file://documents/settings/img/cards/card001.jpg"

}
</code></pre>
</code></pre>
Binary file added example/ios/Frameworks/Cordova.framework/Cordova
Binary file not shown.
56 changes: 56 additions & 0 deletions example/ios/Frameworks/Cordova.framework/Headers/CDV.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
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 "CDVCordovaView.h"
#import "CDVDebug.h"
#import "CDVDebugConsole.h"
#import "CDVFile.h"
#import "CDVFileTransfer.h"
#import "CDVLocation.h"
#import "CDVMotion.h"
#import "CDVNotification.h"
#import "CDVPluginResult.h"
#import "CDVReachability.h"
#import "CDVSound.h"
#import "CDVSplashScreen.h"
#import "CDVWhitelist.h"
#import "CDVLocalStorage.h"

#import "NSData+Base64.h"
#import "NSDictionary+Extensions.h"
#import "NSMutableArray+QueueAdditions.h"
#import "UIDevice+Extensions.h"

#import "JSONKit.h"

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
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, retain) NSString* callbackId;

- (CDVAccelerometer*) init;

- (void)start:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
- (void)stop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;

@end


56 changes: 56 additions & 0 deletions example/ios/Frameworks/Cordova.framework/Headers/CDVAvailability.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
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_0_9_6 00906
#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_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_1_9_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)

41 changes: 41 additions & 0 deletions example/ios/Frameworks/Cordova.framework/Headers/CDVBattery.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
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 (retain) NSString* callbackId;

- (void) updateBatteryStatus:(NSNotification*)notification;
- (NSDictionary*) getBatteryStatus;
- (void) start:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
- (void) stop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
- (void)dealloc;
@end
101 changes: 101 additions & 0 deletions example/ios/Frameworks/Cordova.framework/Headers/CDVCamera.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
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"

enum CDVDestinationType {
DestinationTypeDataUrl = 0,
DestinationTypeFileUri
};
typedef NSUInteger CDVDestinationType;

enum CDVEncodingType {
EncodingTypeJPEG = 0,
EncodingTypePNG
};
typedef NSUInteger CDVEncodingType;

enum CDVMediaType {
MediaTypePicture = 0,
MediaTypeVideo,
MediaTypeAll
};
typedef NSUInteger CDVMediaType;

@interface CDVCameraPicker : UIImagePickerController
{
}


@property (assign) NSInteger quality;
@property (copy) NSString* callbackId;
@property (copy) NSString* postUrl;
@property (nonatomic) enum CDVDestinationType returnType;
@property (nonatomic) enum CDVEncodingType encodingType;
@property (retain) UIPopoverController* popoverController;
@property (assign) CGSize targetSize;
@property (assign) bool correctOrientation;
@property (assign) bool saveToPhotoAlbum;
@property (assign) bool cropToSize;
@property (retain) UIWebView* webView;
@property (assign) BOOL popoverSupported;

- (void) dealloc;

@end

// ======================================================================= //

@interface CDVCamera : CDVPlugin<UIImagePickerControllerDelegate,
UINavigationControllerDelegate,
UIPopoverControllerDelegate>
{
}

@property (retain) CDVCameraPicker* pickerController;

/*
* getPicture
*
* arguments:
* 1: this is the javascript function that will be called with the results, the first parameter passed to the
* javascript function is the picture as a Base64 encoded string
* 2: this is the javascript function to be called if there was an error
* options:
* quality: integer between 1 and 100
*/
- (void) takePicture:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
- (void) postImage:(UIImage*)anImage withFilename:(NSString*)filename toUrl:(NSURL*)url;
- (void) cleanup:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;

- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info;
- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo;
- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker;
- (UIImage*)imageByScalingAndCroppingForSize:(UIImage*)anImage toSize:(CGSize)targetSize;
- (UIImage*)imageByScalingNotCroppingForSize:(UIImage*)anImage toSize:(CGSize)frameSize;
- (UIImage*)imageCorrectedForCaptureOrientation:(UIImage*)anImage;

- (void) closePicker:(CDVCameraPicker*)picker __attribute__((deprecated));
- (void) dealloc;

@end



Loading

0 comments on commit 50d1a2f

Please sign in to comment.