Skip to content

Commit

Permalink
Revert "Adds a sortOrder flag to sort by creation date on iOS (#1090)"
Browse files Browse the repository at this point in the history
This reverts commit 33fd526.
  • Loading branch information
ivpusic committed Sep 11, 2019
1 parent 115d7c7 commit bc72e5b
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ ImagePicker.clean().then(() => {
| mediaType | string (default any) | Accepted mediaType for image selection, can be one of: 'photo', 'video', or 'any' |
| showsSelectedCount (ios only) | bool (default true) | Whether to show the number of selected assets |
| forceJpg (ios only) | bool (default false) | Whether to convert photos to JPG. This will also convert any Live Photo into its JPG representation |
| sortOrder (ios only) | string (default 'none', supported values: 'asc', 'desc', 'none') | Applies a sort order on the creation date on how media is displayed within the albums/detail photo views when opening the image picker |
| showCropGuidelines (android only) | bool (default true) | Whether to show the 3x3 grid on top of the image during cropping |
| showCropFrame (android only) | bool (default true) | Whether to show crop frame during cropping |
| hideBottomControls (android only) | bool (default false) | Whether to display bottom controls |
Expand Down
1 change: 0 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ declare module "react-native-image-crop-picker" {
mediaType?: string;
showsSelectedCount?: boolean;
forceJpg?: boolean;
sortOrder?: 'none' | 'asc' | 'desc';
showCropGuidelines?: boolean;
hideBottomControls?: boolean;
enableRotationGesture?: boolean;
Expand Down
8 changes: 0 additions & 8 deletions ios/QBImagePicker/QBImagePicker/QBAssetsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,6 @@ - (void)updateFetchRequest
default:
break;
}

if ([self.imagePickerController.sortOrder isEqualToString:@"asc"]) {
options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending: YES]];
}

if ([self.imagePickerController.sortOrder isEqualToString:@"desc"]) {
options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending: NO]];
}

self.fetchResult = [PHAsset fetchAssetsInAssetCollection:self.assetCollection options:options];

Expand Down
1 change: 0 additions & 1 deletion ios/QBImagePicker/QBImagePicker/QBImagePickerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ typedef NS_ENUM(NSUInteger, QBImagePickerMediaType) {
@property (nonatomic, assign) BOOL allowsMultipleSelection;
@property (nonatomic, assign) NSUInteger minimumNumberOfSelection;
@property (nonatomic, assign) NSUInteger maximumNumberOfSelection;
@property (nonatomic, strong) NSString* sortOrder;

@property (nonatomic, copy) NSString *prompt;
@property (nonatomic, assign) BOOL showsNumberOfSelectedAssets;
Expand Down
4 changes: 1 addition & 3 deletions ios/src/ImageCropPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ - (instancetype)init
@"mediaType": @"any",
@"showsSelectedCount": @YES,
@"forceJpg": @NO,
@"sortOrder": @"none",
@"cropperCancelText": @"Cancel",
@"cropperChooseText": @"Choose"
};
Expand Down Expand Up @@ -317,7 +316,6 @@ - (BOOL)cleanTmpDirectory {
imagePickerController.minimumNumberOfSelection = abs([[self.options objectForKey:@"minFiles"] intValue]);
imagePickerController.maximumNumberOfSelection = abs([[self.options objectForKey:@"maxFiles"] intValue]);
imagePickerController.showsNumberOfSelectedAssets = [[self.options objectForKey:@"showsSelectedCount"] boolValue];
imagePickerController.sortOrder = [self.options objectForKey:@"sortOrder"];

NSArray *smartAlbums = [self.options objectForKey:@"smartAlbums"];
if (smartAlbums != nil) {
Expand Down Expand Up @@ -609,7 +607,7 @@ - (void)qb_imagePickerController:
[lock lock];
@autoreleasepool {
UIImage *imgT = [UIImage imageWithData:imageData];

Boolean forceJpg = [[self.options valueForKey:@"forceJpg"] boolValue];

NSNumber *compressQuality = [self.options valueForKey:@"compressImageQuality"];
Expand Down

2 comments on commit bc72e5b

@AnthonyAkentiev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivpusic Hello. Could you please tell me -> why that revert is needed?
I want my picker to scroll to the latest photos and can't do that (

Thx!

@onedevlad
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.