mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-18 19:22:51 +08:00
Co-authored-by: Denis Zakharov <d.zakharov@bssys.com>
This commit is contained in:
parent
f33ade83e4
commit
f4067e22d9
@ -185,16 +185,16 @@ static NSString* toBase64(NSData* data) {
|
|||||||
|
|
||||||
- (void)showCameraPicker:(NSString*)callbackId withOptions:(CDVPictureOptions *) pictureOptions
|
- (void)showCameraPicker:(NSString*)callbackId withOptions:(CDVPictureOptions *) pictureOptions
|
||||||
{
|
{
|
||||||
CDVCameraPicker* cameraPicker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
|
|
||||||
self.pickerController = cameraPicker;
|
|
||||||
|
|
||||||
cameraPicker.delegate = self;
|
|
||||||
cameraPicker.callbackId = callbackId;
|
|
||||||
// we need to capture this state for memory warnings that dealloc this object
|
|
||||||
cameraPicker.webView = self.webView;
|
|
||||||
|
|
||||||
// Perform UI operations on the main thread
|
// Perform UI operations on the main thread
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
CDVCameraPicker* cameraPicker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
|
||||||
|
self.pickerController = cameraPicker;
|
||||||
|
|
||||||
|
cameraPicker.delegate = self;
|
||||||
|
cameraPicker.callbackId = callbackId;
|
||||||
|
// we need to capture this state for memory warnings that dealloc this object
|
||||||
|
cameraPicker.webView = self.webView;
|
||||||
|
|
||||||
// If a popover is already open, close it; we only want one at a time.
|
// If a popover is already open, close it; we only want one at a time.
|
||||||
if (([[self pickerController] pickerPopoverController] != nil) && [[[self pickerController] pickerPopoverController] isPopoverVisible]) {
|
if (([[self pickerController] pickerPopoverController] != nil) && [[[self pickerController] pickerPopoverController] isPopoverVisible]) {
|
||||||
[[[self pickerController] pickerPopoverController] dismissPopoverAnimated:YES];
|
[[[self pickerController] pickerPopoverController] dismissPopoverAnimated:YES];
|
||||||
@ -374,7 +374,7 @@ static NSString* toBase64(NSData* data) {
|
|||||||
self.metadata = [[NSMutableDictionary alloc] init];
|
self.metadata = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
NSMutableDictionary* EXIFDictionary = [[controllerMetadata objectForKey:(NSString*)kCGImagePropertyExifDictionary]mutableCopy];
|
NSMutableDictionary* EXIFDictionary = [[controllerMetadata objectForKey:(NSString*)kCGImagePropertyExifDictionary]mutableCopy];
|
||||||
if (EXIFDictionary) {
|
if (EXIFDictionary) {
|
||||||
[self.metadata setObject:EXIFDictionary forKey:(NSString*)kCGImagePropertyExifDictionary];
|
[self.metadata setObject:EXIFDictionary forKey:(NSString*)kCGImagePropertyExifDictionary];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ static NSString* toBase64(NSData* data) {
|
|||||||
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
|
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
|
||||||
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
|
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
|
||||||
NSString* filePath;
|
NSString* filePath;
|
||||||
|
|
||||||
// unique file name
|
// unique file name
|
||||||
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
||||||
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
|
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
|
||||||
@ -587,15 +587,15 @@ static NSString* toBase64(NSData* data) {
|
|||||||
|
|
||||||
- (CLLocationManager*)locationManager
|
- (CLLocationManager*)locationManager
|
||||||
{
|
{
|
||||||
if (locationManager != nil) {
|
if (locationManager != nil) {
|
||||||
return locationManager;
|
return locationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
locationManager = [[CLLocationManager alloc] init];
|
locationManager = [[CLLocationManager alloc] init];
|
||||||
[locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
|
[locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
|
||||||
[locationManager setDelegate:self];
|
[locationManager setDelegate:self];
|
||||||
|
|
||||||
return locationManager;
|
return locationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation
|
- (void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation
|
||||||
|
Loading…
Reference in New Issue
Block a user