nativescript-imagepicker
Advanced tools
Comparing version 6.1.1 to 6.1.2
@@ -24,3 +24,2 @@ "use strict"; | ||
_this._hostView = hostView; | ||
_this._imagePickerControllerDelegate = ImagePickerControllerDelegate.new(); | ||
var imagePickerController = QBImagePickerController.alloc().init(); | ||
@@ -76,7 +75,7 @@ imagePickerController.assetCollectionSubtypes = defaultAssetCollectionSubtypes; | ||
return new Promise(function (resolve, reject) { | ||
_this._imagePickerControllerDelegate._resolve = resolve; | ||
_this._imagePickerControllerDelegate._reject = reject; | ||
_this.hostController.presentViewControllerAnimatedCompletion(_this._imagePickerController, true, function () { | ||
_this._imagePickerController.delegate = _this._imagePickerControllerDelegate; | ||
}); | ||
var imagePickerControllerDelegate = ImagePickerControllerDelegate.new(); | ||
imagePickerControllerDelegate._resolve = resolve; | ||
imagePickerControllerDelegate._reject = reject; | ||
_this._imagePickerController.delegate = imagePickerControllerDelegate; | ||
_this.hostController.presentViewControllerAnimatedCompletion(_this._imagePickerController, true, null); | ||
}); | ||
@@ -95,4 +94,6 @@ }; | ||
this._reject(new Error("Selection canceled.")); | ||
this.deRegisterFromGlobal(); | ||
}; | ||
ImagePickerControllerDelegate.prototype.qb_imagePickerControllerDidFinishPickingAssets = function (imagePickerController, iosAssets) { | ||
var _this = this; | ||
var assets = []; | ||
@@ -108,7 +109,16 @@ for (var i = 0; i < iosAssets.count; i++) { | ||
imagePickerController.dismissViewControllerAnimatedCompletion(true, function () { | ||
_this.deRegisterFromGlobal(); | ||
setTimeout(utils.GC, 200); | ||
}); | ||
}; | ||
ImagePickerControllerDelegate.prototype.registerToGlobal = function () { | ||
global.imagePickerControllerDelegate = this; | ||
}; | ||
ImagePickerControllerDelegate.prototype.deRegisterFromGlobal = function () { | ||
global.imagePickerControllerDelegate = null; | ||
}; | ||
ImagePickerControllerDelegate.new = function () { | ||
return _super.new.call(this); | ||
var instance = _super.new.call(this); | ||
instance.registerToGlobal(); | ||
return instance; | ||
}; | ||
@@ -115,0 +125,0 @@ ImagePickerControllerDelegate.ObjCProtocols = [QBImagePickerControllerDelegate]; |
{ | ||
"name": "nativescript-imagepicker", | ||
"version": "6.1.1", | ||
"version": "6.1.2", | ||
"description": "A plugin for the NativeScript framework implementing multiple image picker", | ||
@@ -5,0 +5,0 @@ "repository": { |
51231
506