mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fixed issue with binding when binding to a falsy object (also added types.isNullOrundefined function).
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import appModule = require("application");
|
||||
import fileSystem = require("file-system");
|
||||
import utils = require("utils/utils");
|
||||
import types = require("utils/types");
|
||||
import definition = require("camera");
|
||||
import common = require("./camera-common");
|
||||
|
||||
@@ -14,7 +15,7 @@ export var takePicture = function (options?: definition.CameraOptions): Promise<
|
||||
if (options) {
|
||||
var reqWidth = options.width ? options.width * density : 0;
|
||||
var reqHeight = options.height ? options.height * density : reqWidth;
|
||||
var shouldKeepAspectRatio = (options.keepAspectRatio === null || options.keepAspectRatio === undefined) ? true : options.keepAspectRatio;
|
||||
var shouldKeepAspectRatio = types.isNullOrUndefined(options.keepAspectRatio) ? true : options.keepAspectRatio;
|
||||
}
|
||||
var takePictureIntent = new android.content.Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
var dateStamp = createDateTimeStamp();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import frame = require("ui/frame");
|
||||
import definition = require("camera");
|
||||
import common = require("./camera-common");
|
||||
import types = require("utils/types");
|
||||
|
||||
class UIImagePickerControllerDelegateImpl extends NSObject implements UIImagePickerControllerDelegate {
|
||||
public static ObjCProtocols = [UIImagePickerControllerDelegate];
|
||||
@@ -26,7 +27,7 @@ class UIImagePickerControllerDelegateImpl extends NSObject implements UIImagePic
|
||||
if (options) {
|
||||
this._width = options.width;
|
||||
this._height = options.height;
|
||||
this._keepAspectRatio = (options.keepAspectRatio === null || options.keepAspectRatio === undefined) ? true : options.keepAspectRatio;
|
||||
this._keepAspectRatio = types.isNullOrUndefined(options.keepAspectRatio) ? true : options.keepAspectRatio;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -76,7 +77,7 @@ export var takePicture = function (options?: definition.CameraOptions): Promise<
|
||||
if (options) {
|
||||
reqWidth = options.width || 0;
|
||||
reqHeight = options.height || reqWidth;
|
||||
keepAspectRatio = (options.keepAspectRatio === null || options.keepAspectRatio === undefined) ? true : options.keepAspectRatio;
|
||||
keepAspectRatio = types.isNullOrUndefined(options.keepAspectRatio) ? true : options.keepAspectRatio;
|
||||
}
|
||||
if (reqWidth && reqHeight) {
|
||||
listener = UIImagePickerControllerDelegateImpl.new().initWithCallbackAndOptions(resolve, { width: reqWidth, height: reqHeight, keepAspectRatio: keepAspectRatio });
|
||||
|
||||
Reference in New Issue
Block a user