Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions src/imagepicker.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ let StaticArrayBuffer = <ArrayBufferStatic>ArrayBuffer;

export class SelectedAsset extends imageAssetModule.ImageAsset {
private _uri: android.net.Uri;
private _thumb: imagesource.ImageSource;
private _thumbRequested: boolean;
private _thumbAsset: imageAssetModule.ImageAsset;
private _fileUri: string;
private _data: ArrayBuffer;

constructor(uri: android.net.Uri) {
super(SelectedAsset._calculateFileUri(uri));
this._uri = uri;
this._thumbRequested = false;
}

data(): Promise<any> {
Expand Down Expand Up @@ -58,14 +55,6 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
});
}

// [Deprecated. Please use thumbAsset instead.]
get thumb(): imagesource.ImageSource {
if (!this._thumbRequested) {
this.decodeThumbUri();
}
return this._thumb;
}

get thumbAsset(): imageAssetModule.ImageAsset {
return this._thumbAsset;
}
Expand Down Expand Up @@ -188,18 +177,6 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
return "com.android.providers.media.documents" === uri.getAuthority();
}

private decodeThumbUri(): void {
// Decode image size
let REQUIRED_SIZE = {
maxWidth: 100,
maxHeight: 100
};

// Decode with scale
this._thumb = this.decodeUri(this._uri, REQUIRED_SIZE);
this.notifyPropertyChange("thumb", this._thumb);
}

private decodeThumbAssetUri(): void {
// Decode image size
let REQUIRED_SIZE = {
Expand Down
50 changes: 0 additions & 50 deletions src/imagepicker.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export class Album extends data_observable.Observable {
private _imagePicker: ImagePicker;
private _assets: data_observablearray.ObservableArray<Asset>;
private _title: string;
private _thumb: image_source.ImageSource;
private _thumbAsset: imageAssetModule.ImageAsset;

constructor(imagePicker: ImagePicker, title: string) {
Expand All @@ -139,16 +138,6 @@ export class Album extends data_observable.Observable {
return this._assets;
}

// [Deprecated. Please use thumbAsset instead.]
get thumb(): image_source.ImageSource {
return this._thumb;
}

protected setThumb(value: image_source.ImageSource): void {
this._thumb = value;
this.notifyPropertyChange("thumb", value);
}

get thumbAsset(): imageAssetModule.ImageAsset {
return this._thumbAsset;
}
Expand All @@ -160,11 +149,6 @@ export class Album extends data_observable.Observable {
}

export class SelectedAsset extends imageAssetModule.ImageAsset {
// [Deprecated. SelectedAsset will be used directly as a source for the thumb image]
get thumb(): image_source.ImageSource {
return null;
}

get uri(): string {
return null;
}
Expand All @@ -186,9 +170,7 @@ export class Asset extends SelectedAsset {
private _selected: boolean;
private _album: Album;

private _thumb: image_source.ImageSource;
private _image: image_source.ImageSource;
private _thumbRequested: boolean;

constructor(album: Album, asset: PHAsset | UIImage) {
super(asset);
Expand All @@ -200,15 +182,6 @@ export class Asset extends SelectedAsset {
return this._album;
}

// [Deprecated. Asset will be used directly as a source for the thumb image]
get thumb(): image_source.ImageSource {
if (!this._thumbRequested) {
this._thumbRequested = true;
this.onThumbRequest();
}
return this._thumb;
}

get selected(): boolean {
return !!this._selected;
}
Expand Down Expand Up @@ -243,14 +216,6 @@ export class Asset extends SelectedAsset {
data(): Promise<any> {
return Promise.reject(new Error("Not implemented."));
}

protected setThumb(value: image_source.ImageSource): void {
this._thumb = value;
this.notifyPropertyChange("thumb", this._thumb);
}

protected onThumbRequest(): void {
}
}

// iOS8+ Photo framework based view model implementation...
Expand Down Expand Up @@ -314,15 +279,6 @@ class ImagePickerPH extends ImagePicker {
}
}

createPHImageThumb(target, asset: PHAsset): void {
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(asset, this._thumbRequestSize, PHImageContentMode.AspectFill,
this._thumbRequestOptions, function (target, uiImage, info) {
let imageSource = new image_source.ImageSource();
imageSource.setNativeSource(uiImage);
target.setThumb(imageSource);
}.bind(this, target));
}

createPHImageThumbAsset(target, asset: PHAsset): void {
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(asset, this._thumbRequestSize, PHImageContentMode.AspectFill,
this._thumbRequestOptions, function (target, uiImage, info) {
Expand Down Expand Up @@ -427,7 +383,6 @@ class AlbumPH extends Album {

if (!this._setThumb && imagePicker) {
this._setThumb = true;
imagePicker.createPHImageThumb(this, asset);
imagePicker.createPHImageThumbAsset(this, asset);

}
Expand Down Expand Up @@ -456,11 +411,6 @@ class AssetPH extends Asset {
return this._phAsset;
}

protected onThumbRequest(): void {
super.onThumbRequest();
(<ImagePickerPH>(<AlbumPH>this.album).imagePicker).createPHImageThumb(this, this._phAsset);
}

get uri(): string {
return this._phAsset.localIdentifier.toString();
}
Expand Down
7 changes: 0 additions & 7 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ export interface ImageOptions {
}

export class SelectedAsset extends imageAssetModule.ImageAsset {
/**
* [Deprecated. SelectedAsset will be used directly as a source for the thumb image]
* A 100x100 pixels thumb of the selected image.
* This property will be initialized on demand. The first access will return undefined or null.
* It will trigger an async load and when the thumb is obtained, a property changed notification will occur.
*/
thumb: imagesource.ImageSource;

/**
* URI that identifies the image asset.
Expand Down