Sha256: 14ed7d535fc1e9a591556dd3d66f7cfda72543cc44f080189f8299919dc35df0

Contents?: true

Size: 1.61 KB

Versions: 17

Compression:

Stored size: 1.61 KB

Contents

#import "CameraSingleton.h"
#import "CameraBase.h"
#import "Camera.h"

extern int get_camera_max_width(const char* camera_type);
void camera_choose_picture(NSDictionary* options, id<IMethodResult> callback_api);
extern int save_image_to_device_gallery(const char* image_path);

@implementation CameraSingleton


-(NSString*)getInitialDefaultID {
    return CAMERA_TYPE_BACK;
}


-(void) enumerate:(id<IMethodResult>)methodResult {
    NSMutableArray* ar = [NSMutableArray arrayWithCapacity:2];
    if (get_camera_max_width([CAMERA_TYPE_BACK UTF8String]) > 0) {
        [ar addObject:CAMERA_TYPE_BACK];
    }
    if (get_camera_max_width([CAMERA_TYPE_FRONT UTF8String]) > 0) {
        [ar addObject:CAMERA_TYPE_FRONT];
    }
    [methodResult setResult:ar];
}

-(void) getCameraByType:(NSString*)cameraType methodResult:(id<IMethodResult>)methodResult {
    if (get_camera_max_width([cameraType UTF8String]) > 0) {
        [methodResult setResult:cameraType];
    }
}


-(void) choosePicture:(NSDictionary*)propertyMap methodResult:(id<IMethodResult>)methodResult {
    camera_choose_picture([CameraBase applyAliasesToDictionary:[Camera convertValuesToString:propertyMap]], methodResult);
}


-(void) copyImageToDeviceGallery:(NSString*)pathToImage methodResult:(id<IMethodResult>)methodResult {
    if (save_image_to_device_gallery([pathToImage UTF8String])) {
        
    }
    else {
        NSMutableDictionary* dict = [NSMutableDictionary dictionaryWithCapacity:10];
        [dict setObject:@"error" forKey:@"status"];
        [dict setObject:@"can not read image file !" forKey:@"message"];
        [methodResult setResult:dict];
    }
}


@end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
rhodes-7.6.0 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-7.5.1 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-7.4.1 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-7.1.17 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-6.2.0 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-6.0.11 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-5.5.18 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-5.5.17 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-5.5.15 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-5.5.0.22 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-5.5.2 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-5.5.0.7 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-5.5.0.3 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
rhodes-5.5.0 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
tauplatform-1.0.3 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
tauplatform-1.0.2 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m
tauplatform-1.0.1 lib/commonAPI/mediacapture/ext/platform/iphone/impl/CameraSingleton.m