arnaucube
arnaucube/openEventsPlatformAppPublic Self-hosted repository
openEventsPlatformApp/plugins/cordova-plugin-camera/src/ios/CDVCamera.h
plugins/cordova-plugin-camera/src/ios/CDVCamera.hRaw
  1/*
  2 Licensed to the Apache Software Foundation (ASF) under one
  3 or more contributor license agreements.  See the NOTICE file
  4 distributed with this work for additional information
  5 regarding copyright ownership.  The ASF licenses this file
  6 to you under the Apache License, Version 2.0 (the
  7 "License"); you may not use this file except in compliance
  8 with the License.  You may obtain a copy of the License at
  9
 10 http://www.apache.org/licenses/LICENSE-2.0
 11
 12 Unless required by applicable law or agreed to in writing,
 13 software distributed under the License is distributed on an
 14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15 KIND, either express or implied.  See the License for the
 16 specific language governing permissions and limitations
 17 under the License.
 18 */
 19
 20#import <Foundation/Foundation.h>
 21#import <CoreLocation/CoreLocation.h>
 22#import <CoreLocation/CLLocationManager.h>
 23#import <Cordova/CDVPlugin.h>
 24
 25enum CDVDestinationType {
 26    DestinationTypeDataUrl = 0,
 27    DestinationTypeFileUri,
 28    DestinationTypeNativeUri
 29};
 30typedef NSUInteger CDVDestinationType;
 31
 32enum CDVEncodingType {
 33    EncodingTypeJPEG = 0,
 34    EncodingTypePNG
 35};
 36typedef NSUInteger CDVEncodingType;
 37
 38enum CDVMediaType {
 39    MediaTypePicture = 0,
 40    MediaTypeVideo,
 41    MediaTypeAll
 42};
 43typedef NSUInteger CDVMediaType;
 44
 45@interface CDVPictureOptions : NSObject
 46
 47@property (strong) NSNumber* quality;
 48@property (assign) CDVDestinationType destinationType;
 49@property (assign) UIImagePickerControllerSourceType sourceType;
 50@property (assign) CGSize targetSize;
 51@property (assign) CDVEncodingType encodingType;
 52@property (assign) CDVMediaType mediaType;
 53@property (assign) BOOL allowsEditing;
 54@property (assign) BOOL correctOrientation;
 55@property (assign) BOOL saveToPhotoAlbum;
 56@property (strong) NSDictionary* popoverOptions;
 57@property (assign) UIImagePickerControllerCameraDevice cameraDirection;
 58
 59@property (assign) BOOL popoverSupported;
 60@property (assign) BOOL usesGeolocation;
 61@property (assign) BOOL cropToSize;
 62
 63+ (instancetype) createFromTakePictureArguments:(CDVInvokedUrlCommand*)command;
 64
 65@end
 66
 67@interface CDVCameraPicker : UIImagePickerController
 68
 69@property (strong) CDVPictureOptions* pictureOptions;
 70
 71@property (copy)   NSString* callbackId;
 72@property (copy)   NSString* postUrl;
 73@property (strong) UIPopoverController* pickerPopoverController;
 74@property (assign) BOOL cropToSize;
 75@property (strong) UIView* webView;
 76
 77+ (instancetype) createFromPictureOptions:(CDVPictureOptions*)options;
 78
 79@end
 80
 81// ======================================================================= //
 82
 83@interface CDVCamera : CDVPlugin <UIImagePickerControllerDelegate,
 84                       UINavigationControllerDelegate,
 85                       UIPopoverControllerDelegate,
 86                       CLLocationManagerDelegate>
 87{}
 88
 89@property (strong) CDVCameraPicker* pickerController;
 90@property (strong) NSMutableDictionary *metadata;
 91@property (strong, nonatomic) CLLocationManager *locationManager;
 92@property (strong) NSData* data;
 93
 94/*
 95 * getPicture
 96 *
 97 * arguments:
 98 *	1: this is the javascript function that will be called with the results, the first parameter passed to the
 99 *		javascript function is the picture as a Base64 encoded string
100 *  2: this is the javascript function to be called if there was an error
101 * options:
102 *	quality: integer between 1 and 100
103 */
104- (void)takePicture:(CDVInvokedUrlCommand*)command;
105- (void)cleanup:(CDVInvokedUrlCommand*)command;
106- (void)repositionPopover:(CDVInvokedUrlCommand*)command;
107
108- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info;
109- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo;
110- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker;
111- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
112
113- (void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation;
114- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error;
115
116@end