[TIMOB-13240] iOS: Media - Titanium.Media.openPhotoGallery is not working for iPads
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2013-04-01T23:16:45.000+0000 |
| Affected Version/s | Release 3.1.0 |
| Fix Version/s | 2013 Sprint 07 API, 2013 Sprint 07 |
| Components | iOS |
| Labels | qe-3.1.0 |
| Reporter | Anshu Mittal |
| Assignee | Sabil Rahim |
| Created | 2013-03-28T11:39:44.000+0000 |
| Updated | 2015-03-31T10:38:49.000+0000 |
Description
Titanium.Media.openPhotoGallery is not working for iPads.
This is not regression since the issue occurs on 3.0.2 GA as well
Steps to reproduce:
1. Create an app using the code below.
2. Launch the test app.
Actual:
No photo gallery is invoked on iPads whereas photo gallery is successfully invoked on iPhones.
Expected:
Photo gallery should be invoked on iPads as well.
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'white'
});
var imageView = Titanium.UI.createImageView({
height:200,
width:200,
top:20,
left:10,
backgroundColor:'#999'
});
var popoverView;
var arrowDirection;
if (Titanium.Platform.osname == 'ipad')
{
// photogallery displays in a popover on the ipad and we
// want to make it relative to our image with a left arrow
arrowDirection = Ti.UI.iPad.POPOVER_ARROW_DIRECTION_LEFT;
popoverView = imageView;
}
Titanium.Media.openPhotoGallery({
success:function(event)
{
var cropRect = event.cropRect;
var image = event.media;
// set image view
Ti.API.debug('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
imageView.image = image;
}
else
{
// is this necessary?
}
Titanium.API.info('PHOTO GALLERY SUCCESS cropRect.x ' + cropRect.x + ' cropRect.y ' + cropRect.y + ' cropRect.height ' + cropRect.height + ' cropRect.width ' + cropRect.width);
},
cancel:function()
{
alert('cancelled fired');
},
error:function(error)
{
},
allowEditing:true,
popoverView:popoverView,
arrowDirection:arrowDirection,
mediaTypes:[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO]
});
win1.add(imageView);
win1.open();
Test case is invalid. use this code
Now click on the imageView. popup should appear. Marking ticket as invalid.var win = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'white' }); var imageView = Titanium.UI.createImageView({ height:200, width:200, top:20, left:10, backgroundColor:'#999' }); win.add(imageView); var popoverView; var arrowDirection; if (Titanium.Platform.osname == 'ipad') { // photogallery displays in a popover on the ipad and we // want to make it relative to our image with a left arrow arrowDirection = Ti.UI.iPad.POPOVER_ARROW_DIRECTION_LEFT; popoverView = imageView; } imageView.addEventListener('click', function(){ Titanium.Media.openPhotoGallery({ success:function(event) { var cropRect = event.cropRect; var image = event.media; // set image view Ti.API.debug('Our type was: '+event.mediaType); if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { imageView.image = image; } else { // is this necessary? } Titanium.API.info('PHOTO GALLERY SUCCESS cropRect.x ' + cropRect.x + ' cropRect.y ' + cropRect.y + ' cropRect.height ' + cropRect.height + ' cropRect.width ' + cropRect.width); }, cancel:function() { }, error:function(error) { }, allowEditing:true, popoverView:popoverView, arrowDirection:arrowDirection, mediaTypes:[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO] }); }); win.open();Tested with: SDK: 3.1.0.v20130409124549 Studio:3.1.0.201304011603 Device: iPad2(v 5.1) OS: OSX 10.7.5 Changed test case works well for iPads as well.
function OpenPhoneGallery(){ this.animate(VARS.a); Ti.Media.openPhotoGallery({ success : function(ev) { SharePageCallFunc(ev); }, cancel : function(){ alert("Gallery closed"); }, error : function(err){ var a = Titanium.UI.createAlertDialog({ title : 'Gallery' }); a.setMessage('Unexpected error: ' + err.code); a.show(); }, showControls : false, mediaTypes : Ti.Media.MEDIA_TYPE_PHOTO, autohide : true }); }
function OpenPhoneGallery(){ this.animate(VARS.a); Ti.Media.openPhotoGallery({ success : function(ev) { SharePageCallFunc(ev); }, cancel : function(){ alert("Gallery closed"); }, error : function(err){ var a = Titanium.UI.createAlertDialog({ title : 'Gallery' }); a.setMessage('Unexpected error: ' + err.code); a.show(); }, showControls : false, mediaTypes : Ti.Media.MEDIA_TYPE_PHOTO, autohide : true }); }