Skip to content

Commit f7d7a2a

Browse files
author
Veselina Radeva
committed
refactor: Remove thumb related methods and properties. Use thumbAsset instead.
1 parent fb4c97b commit f7d7a2a

2 files changed

Lines changed: 0 additions & 46 deletions

File tree

src/imagepicker.android.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@ let StaticArrayBuffer = <ArrayBufferStatic>ArrayBuffer;
1818

1919
export class SelectedAsset extends imageAssetModule.ImageAsset {
2020
private _uri: android.net.Uri;
21-
private _thumb: imagesource.ImageSource;
22-
private _thumbRequested: boolean;
2321
private _thumbAsset: imageAssetModule.ImageAsset;
2422
private _fileUri: string;
2523
private _data: ArrayBuffer;
2624

2725
constructor(uri: android.net.Uri) {
2826
super(SelectedAsset._calculateFileUri(uri));
2927
this._uri = uri;
30-
this._thumbRequested = false;
3128
}
3229

3330
data(): Promise<any> {
@@ -180,18 +177,6 @@ export class SelectedAsset extends imageAssetModule.ImageAsset {
180177
return "com.android.providers.media.documents" === uri.getAuthority();
181178
}
182179

183-
private decodeThumbUri(): void {
184-
// Decode image size
185-
let REQUIRED_SIZE = {
186-
maxWidth: 100,
187-
maxHeight: 100
188-
};
189-
190-
// Decode with scale
191-
this._thumb = this.decodeUri(this._uri, REQUIRED_SIZE);
192-
this.notifyPropertyChange("thumb", this._thumb);
193-
}
194-
195180
private decodeThumbAssetUri(): void {
196181
// Decode image size
197182
let REQUIRED_SIZE = {

src/imagepicker.ios.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export class Album extends data_observable.Observable {
117117
private _imagePicker: ImagePicker;
118118
private _assets: data_observablearray.ObservableArray<Asset>;
119119
private _title: string;
120-
private _thumb: image_source.ImageSource;
121120
private _thumbAsset: imageAssetModule.ImageAsset;
122121

123122
constructor(imagePicker: ImagePicker, title: string) {
@@ -139,11 +138,6 @@ export class Album extends data_observable.Observable {
139138
return this._assets;
140139
}
141140

142-
protected setThumb(value: image_source.ImageSource): void {
143-
this._thumb = value;
144-
this.notifyPropertyChange("thumb", value);
145-
}
146-
147141
get thumbAsset(): imageAssetModule.ImageAsset {
148142
return this._thumbAsset;
149143
}
@@ -176,9 +170,7 @@ export class Asset extends SelectedAsset {
176170
private _selected: boolean;
177171
private _album: Album;
178172

179-
private _thumb: image_source.ImageSource;
180173
private _image: image_source.ImageSource;
181-
private _thumbRequested: boolean;
182174

183175
constructor(album: Album, asset: PHAsset | UIImage) {
184176
super(asset);
@@ -224,14 +216,6 @@ export class Asset extends SelectedAsset {
224216
data(): Promise<any> {
225217
return Promise.reject(new Error("Not implemented."));
226218
}
227-
228-
protected setThumb(value: image_source.ImageSource): void {
229-
this._thumb = value;
230-
this.notifyPropertyChange("thumb", this._thumb);
231-
}
232-
233-
protected onThumbRequest(): void {
234-
}
235219
}
236220

237221
// iOS8+ Photo framework based view model implementation...
@@ -295,15 +279,6 @@ class ImagePickerPH extends ImagePicker {
295279
}
296280
}
297281

298-
createPHImageThumb(target, asset: PHAsset): void {
299-
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(asset, this._thumbRequestSize, PHImageContentMode.AspectFill,
300-
this._thumbRequestOptions, function (target, uiImage, info) {
301-
let imageSource = new image_source.ImageSource();
302-
imageSource.setNativeSource(uiImage);
303-
target.setThumb(imageSource);
304-
}.bind(this, target));
305-
}
306-
307282
createPHImageThumbAsset(target, asset: PHAsset): void {
308283
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(asset, this._thumbRequestSize, PHImageContentMode.AspectFill,
309284
this._thumbRequestOptions, function (target, uiImage, info) {
@@ -408,7 +383,6 @@ class AlbumPH extends Album {
408383

409384
if (!this._setThumb && imagePicker) {
410385
this._setThumb = true;
411-
imagePicker.createPHImageThumb(this, asset);
412386
imagePicker.createPHImageThumbAsset(this, asset);
413387

414388
}
@@ -437,11 +411,6 @@ class AssetPH extends Asset {
437411
return this._phAsset;
438412
}
439413

440-
protected onThumbRequest(): void {
441-
super.onThumbRequest();
442-
(<ImagePickerPH>(<AlbumPH>this.album).imagePicker).createPHImageThumb(this, this._phAsset);
443-
}
444-
445414
get uri(): string {
446415
return this._phAsset.localIdentifier.toString();
447416
}

0 commit comments

Comments
 (0)