New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ios): allow multiple photo selection #11867
Conversation
iphone/Classes/MediaModule.m
Outdated
|
||
NSArray *types = (NSArray *)[args objectForKey:@"mediaTypes"]; | ||
#if IS_SDK_IOS_14 | ||
if ([TiUtils isIOSVersionOrGreater:@"14.0"] && ([args objectForKey:@"selectionLimit"] || [TiUtils boolValue:[args objectForKey:@"allowMultiple"] def:NO])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we maybe always use it on iOS 14? The old image picker is now deprecated and should be replaced for iOS 14+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In new PHPickerViewController, there is no option for image editing(may be included in future releases). I think this is important feature and we can not remove it in minor release.
iphone/Classes/MediaModule.m
Outdated
DebugLog(@"[ERROR] Failed to load video- %@ .", error.description); | ||
} | ||
dispatch_group_leave(group); | ||
}]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be a lot of duplicate code logic here. Maybe move to own handler class / methods to clean up the business logic around this.
if (autoHidePicker) { | ||
[self closeModalPicker:picker]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are on a background thread here. Maybe validate if closeModalPicker
and sendPickerSuccess
really are performed on the main thread. In any case, there doesn't seem to be much processing here, so is a global queue / background queue necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no special handling in this delegate method for closeModalPicker
and sendPickerSuccess
. It is same as with old picker. In dispatch_group_notify
queue is mandatory to pass.
iOS formatting is failing lint. Run 'npm run format:ios' |
@jquick-axway Can you verify doc for android multiple selection callback? |
@@ -1109,7 +1109,7 @@ - (void)openPhotoGallery:(id)args | |||
|
|||
NSArray *types = (NSArray *)[args objectForKey:@"mediaTypes"]; | |||
#if IS_SDK_IOS_14 | |||
if ([TiUtils isIOSVersionOrGreater:@"14.0"] && ([args objectForKey:@"selectionLimit"] || [TiUtils boolValue:[args objectForKey:@"allowMultiple"] def:NO])) { | |||
if ([TiUtils isIOSVersionOrGreater:@"14.0"] && [TiUtils boolValue:[args objectForKey:@"allowMultiple"] def:NO]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why not to use the PHPicker by default on iOS 14 all the time? I'd love to use it from now on - the UX is amazing, also for single selections!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- In new PHPickerViewController, there is no option for image editing. I think this is important feature and we can not remove it in minor release. (I'll create a ticket to deprecate editing property, in case it is not supported by Apple in future releases).
- In PHPickerViewController, video file need to copy locally as per discussion https://developer.apple.com/forums/thread/652695. I think this is not the best way. May be its handling can be changed by Apple.
So I have limited this API to multiple selection only. It will be updated in future release.
In case you want to use the API with single selection, set Ti.Media.allowMultiple = true
and Ti.Media.selectionLimit = 1. But yes, a minor change required in your callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh, thats sad! Didn't know they missed parity when updating the API. Alrighty, thanks for the clarification Vijay! 🙂
FR Passed Verified on: |
The backport to
Check the run for full details # Fetch latest updates from GitHub
git fetch
# Check out the target branch
git checkout 9_3_X
# Make sure it's up to date
git pull
# Check out your branch
git checkout -b backport-11867-to-9_3_X
# Apply the commits from the PR
curl -s https://github.com/appcelerator/titanium_mobile/commit/2f2163e2f911ffa1e219892003d69fc5de6db62d.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/a95c6c9656a99300ac715d479e50094dbdf6439d.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/b70ee42d7e581b81cec9186fd179490999f0b182.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/d3cbcce165298314329eedd509ce83ff0e058860.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/42ffd028edfc10a875e103a77b5c2ef4b7f3ca00.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/062084ac6ac12b2115043d6ed1a2bb79200f11ee.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/3eff002f514d0b832acca09fdf4cc72229144ac3.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/8be6c6a401589f7792cd5537cdbd62af70a85eb4.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/7758f1290e5ddf96e6c54e286c8ac020c8565a71.patch | git am -3 --ignore-whitespace
curl -s https://github.com/appcelerator/titanium_mobile/commit/4a26c49a68a150d69b6a8f6ec7a6c75054545ba8.patch | git am -3 --ignore-whitespace
# Push it to GitHub
git push --set-upstream origin backport-11867-to-9_3_X Then, create a pull request where the |
* add workaround code for video loading * updated logic for selectionLimit to work with allowMultiple true only Fixes TIMOB-27984
https://jira.appcelerator.org/browse/TIMOB-27984