Skip to content
This repository was archived by the owner on Nov 29, 2022. It is now read-only.
Open
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
17 changes: 15 additions & 2 deletions Source/Classes/Core/DZNPhotoDisplayViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,14 @@ - (void)selectedMetadata:(DZNPhotoMetadata *)metadata
[self.navigationController pushViewController:controller animated:YES];

[controller setAcceptBlock:^(DZNPhotoEditorViewController *editor, NSDictionary *userInfo){
[metadata postMetadataUpdate:userInfo];
if (self.searchController.searchBar.text) {
NSMutableDictionary *allUserInfo = [userInfo mutableCopy];
if (self.searchController.searchBar.text) [allUserInfo setObject:self.searchController.searchBar.text forKey:DZNPhotoPickerControllerSearchTerm];
[metadata postMetadataUpdate:allUserInfo];
} else {
[metadata postMetadataUpdate:userInfo];
}

[self.navigationController popViewControllerAnimated:YES];
}];

Expand Down Expand Up @@ -471,7 +478,13 @@ - (void)selectedMetadata:(DZNPhotoMetadata *)metadata
progress:NULL
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished){
if (image) {
NSDictionary *userInfo = @{UIImagePickerControllerOriginalImage: image};
NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init];
[userInfo setObject:image forKey:UIImagePickerControllerOriginalImage];

if (self.searchController.searchBar.text) {
[userInfo setObject:self.searchController.searchBar.text forKey:DZNPhotoPickerControllerSearchTerm];
}

[metadata postMetadataUpdate:userInfo];
}
else {
Expand Down
1 change: 1 addition & 0 deletions Source/Classes/Core/DZNPhotoPickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ - (void)didFinishPickingPhoto:(NSNotification *)notification
if (self.finalizationBlock) {
self.finalizationBlock(self, notification.userInfo);
}

else if (self.delegate && [self.delegate respondsToSelector:@selector(photoPickerController:didFinishPickingPhotoWithInfo:)]){
[self.delegate photoPickerController:self didFinishPickingPhotoWithInfo:notification.userInfo];
}
Expand Down
1 change: 1 addition & 0 deletions Source/Classes/Core/DZNPhotoPickerControllerConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
extern NSString *const DZNPhotoPickerControllerCropMode; // An NSString (i.e. square, circular)
extern NSString *const DZNPhotoPickerControllerCropZoomScale; // An NSString (from 1.0 to maximum zoom scale, 2.0f)
extern NSString *const DZNPhotoPickerControllerPhotoMetadata; // An NSDictionary containing metadata from a captured photo
extern NSString *const DZNPhotoPickerControllerSearchTerm; // An NSString containing the search term that allowed the user to find this photo.

extern NSString *const DZNPhotoPickerDidFinishPickingNotification; // The notification key used when picking a photo finished.
extern NSString *const DZNPhotoPickerDidFailPickingNotification; // The notification key used when picking a photo failed.
Expand Down
1 change: 1 addition & 0 deletions Source/Classes/Core/DZNPhotoPickerControllerConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
NSString *const DZNPhotoPickerControllerCropMode = @"com.dzn.photoPicker.cropMode";
NSString *const DZNPhotoPickerControllerCropZoomScale = @"com.dzn.photoPicker.cropZoomScale";
NSString *const DZNPhotoPickerControllerPhotoMetadata = @"com.dzn.photoPicker.photoMetadata";
NSString *const DZNPhotoPickerControllerSearchTerm = @"com.dzn.photoPicker.searchTerm";

NSString *const DZNPhotoPickerDidFinishPickingNotification = @"com.dzn.photoPicker.didFinishPickingNotification";
NSString *const DZNPhotoPickerDidFailPickingNotification = @"com.dzn.photoPicker.didFinishPickingWithErrorNotification";
Expand Down