{
"id": "175818",
"key": "TIMOB-28250",
"fields": {
"issuetype": {
"id": "1",
"description": "A problem which impairs or prevents the functions of the product.",
"name": "Bug",
"subtask": false
},
"project": {
"id": "10153",
"key": "TIMOB",
"name": "Titanium SDK/CLI",
"projectCategory": {
"id": "10100",
"description": "Titanium and related SDKs used in application development",
"name": "Client"
}
},
"fixVersions": [
{
"id": "21052",
"description": "",
"name": "Release 9.3.0",
"archived": false,
"released": true,
"releaseDate": "2020-12-14"
}
],
"resolution": null,
"resolutiondate": null,
"created": "2020-11-20T10:50:03.000+0000",
"priority": {
"name": "None",
"id": "6"
},
"labels": [],
"versions": [
{
"id": "21129",
"name": "Release 9.2.2",
"archived": false,
"released": true,
"releaseDate": "2020-10-29"
}
],
"issuelinks": [],
"assignee": {
"name": "vijaysingh",
"key": "vijaysingh",
"displayName": "Vijay Singh",
"active": true,
"timeZone": "America/Los_Angeles"
},
"updated": "2020-11-25T10:34:15.000+0000",
"status": {
"description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.",
"name": "Closed",
"id": "6",
"statusCategory": {
"id": 3,
"key": "done",
"colorName": "green",
"name": "Done"
}
},
"components": [
{
"id": "10206",
"name": "iOS",
"description": "iOS Platform"
}
],
"description": "h5.Description\r\n\r\nWhen calling openPhotoGallery and passing in {{mediaTypes: [ Ti.Media.MEDIA_TYPE_PHOTO ]}}, a mediaType of {{Ti.Media.MEDIA_TYPE_LIVEPHOTO}} can be returned and the shape of the returned object is also different, containing a {{livePhotos}} array, instead of a {{images}} array\r\n\r\n{code}\r\nconst win = Ti.UI.createWindow({ layout: 'vertical' });\r\nconst singleBtn = Ti.UI.createButton({ title: 'Select single', top: 50 });\r\nsingleBtn.addEventListener('click', () => {\r\n selectImage(false);\r\n});\r\nwin.add(singleBtn);\r\nconst multiBtn = Ti.UI.createButton({ title: 'Select multiple' });\r\nmultiBtn.addEventListener('click', () => {\r\n selectImage(true);\r\n});\r\nwin.add(multiBtn);\r\nwin.open();\r\nfunction selectImage(allowMultiple) {\r\n Ti.Media.requestPhotoGalleryPermissions((e) => {\r\n if (!e.success) {\r\n console.error('failed to get permissions');\r\n console.error(e);\r\n return;\r\n }\r\n Titanium.Media.openPhotoGallery({\r\n success: function(e) {\r\n console.log(e);\r\n },\r\n error: function(e) {\r\n console.error('errored on openPhotoGallery')\r\n console.error(e);\r\n },\r\n mediaTypes: [ Ti.Media.MEDIA_TYPE_PHOTO ],\r\n allowMultiple\r\n });\r\n });\r\n}\r\n{code}\r\n\r\nh5.Steps to reproduce\r\n\r\n1. Add the above code to an existing app.js\r\n2. Ensure you have a NSPhotoLibraryUsageDescription key in your plist like below\r\n{code}\r\nNSPhotoLibraryUsageDescription\r\nCan we steal your pics?\r\n{code}\r\n3. Build to iOS\r\n4. Tap the {{Select single}} button and select a live photo\r\n5. Tap the {{Select multi}} button and select a live photo\r\n\r\nh5.Actual\r\n\r\nIn step 4 an object is returned with mediaType of Ti.Media.MEDIA_TYPE_PHOTO\r\nIn step 5 an object is returned with a livePhotos array and contains an object with a media type of Ti.Media.MEDIA_TYPE_LIVEPHOTO\r\n\r\nh5.Expected\r\n\r\nA mediaType of Ti.Media.MEDIA_TYPE_LIVEPHOTO should not be returned if only Ti.Media.MEDIA_TYPE_PHOTO was requested",
"attachment": [],
"flagged": false,
"summary": "iOS 14: openPhotoGallery with allowMultiple does not respect mediaTypes and returns LIVEPHOTO when requesting only PHOTO",
"creator": {
"name": "eharris",
"key": "eharris",
"displayName": "Ewan Harris",
"active": true,
"timeZone": "Europe/Dublin"
},
"subtasks": [],
"reporter": {
"name": "eharris",
"key": "eharris",
"displayName": "Ewan Harris",
"active": true,
"timeZone": "Europe/Dublin"
},
"environment": "iOS 14\r\nSDK 9.2.2.GA, 9.3.0.v20201119162516",
"closedSprints": [
{
"id": 1211,
"state": "closed",
"name": "2020 Sprint 24",
"startDate": "2020-11-23T18:12:00.000Z",
"endDate": "2020-12-07T18:12:00.000Z",
"completeDate": "2020-12-04T22:07:24.313Z",
"originBoardId": 114
}
],
"comment": {
"comments": [
{
"id": "457649",
"author": {
"name": "eharris",
"key": "eharris",
"displayName": "Ewan Harris",
"active": true,
"timeZone": "Europe/Dublin"
},
"body": "It looks like we use a different type of picker dependent on whether allowMultiple is set, so it might be that this is down to a difference there. However it feels strange to me for us to return a live photo when one was not requested?",
"updateAuthor": {
"name": "eharris",
"key": "eharris",
"displayName": "Ewan Harris",
"active": true,
"timeZone": "Europe/Dublin"
},
"created": "2020-11-20T11:05:08.000+0000",
"updated": "2020-11-20T11:05:08.000+0000"
},
{
"id": "457689",
"author": {
"name": "vijaysingh",
"key": "vijaysingh",
"displayName": "Vijay Singh",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "PR - https://github.com/appcelerator/titanium_mobile/pull/12289\r\nTest Case - \r\n\r\n{code:java}\r\nvar window = Ti.UI.createWindow();\r\n \r\nvar navWindow = Ti.UI.createNavigationWindow({window: window});\r\nvar tableView = Ti.UI.createTableView(\r\n{\r\n\twidth: Ti.UI.FILL,\r\n\theight: Ti.UI.FILL,\r\n});\r\nwindow.add(tableView);\r\nvar addButton = Ti.UI.createButton(\r\n{\r\n\ttitle: \"Add\",\r\n\tleft: \"10dp\",\r\n\tbottom: \"10dp\",\r\n});\r\naddButton.addEventListener(\"click\", function(e) {\r\n\tvar dialog = Ti.UI.createAlertDialog(\r\n\t{\r\n\t\tmessage: \"Which media type do you want to open?\",\r\n\t\tbuttonNames: [\"Photo\", \"Live Photo\", \"Video\", \"All\"],\r\n\t});\r\n\tdialog.addEventListener(\"click\", function(e) {\r\n\t\tvar mediaTypes;\r\n\t\tif (e.index === 0) {\r\n\t\t\tmediaTypes = [Ti.Media.MEDIA_TYPE_PHOTO];\r\n\t\t} else if (e.index === 1) {\r\n\t\t\tmediaTypes = [Ti.Media.MEDIA_TYPE_LIVEPHOTO];\r\n\t\t} else if (e.index === 2) {\r\n\t\t\tmediaTypes = [Ti.Media.MEDIA_TYPE_VIDEO];\r\n\t\t} else if (e.index === 3) {\r\n\t\t\tmediaTypes = [Ti.Media.MEDIA_TYPE_PHOTO, Ti.Media.MEDIA_TYPE_LIVEPHOTO, Ti.Media.MEDIA_TYPE_VIDEO];\r\n\t\t} else {\r\n\t\t\tTi.API.info(\"@@@ Alert was canceled.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tdialog.hide();\r\n\t\tTi.Media.openPhotoGallery(\r\n\t\t{\r\n\t\t\tallowMultiple: true,\r\n\t\t selectionLimit: 10,\r\n\t\t\tautohide: true,\r\n\t\t\tmediaTypes: mediaTypes,\r\n\t\t\tsuccess: function(e) {\r\n\t\t\t\tTi.API.info(\"@@@ success() e: \" + JSON.stringify(e));\r\n\t\t\t\tvar createRowFrom = function(selectionEvent) {\r\n \r\n\t\t\t\t\tvar fileName = null;\r\n \r\n\t\t\t\t\tif (!fileName) {\r\n\t\t\t\t\t\tif (selectionEvent.mediaType === Ti.Media.MEDIA_TYPE_PHOTO) {\r\n\t\t\t\t\t\t\tfileName = \"Image\";\r\n\t\t\t\t\t\t} else if (selectionEvent.mediaType === Ti.Media.MEDIA_TYPE_VIDEO) {\r\n\t\t\t\t\t\t\tfileName = \"Video\";\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tfileName = \"Live Photo\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar row = Ti.UI.createTableViewRow({ title: fileName });\r\n\t\t\t\t\trow.addEventListener(\"click\", function(e) {\r\n\t\t\t\t\t\tswitch (selectionEvent.mediaType) {\r\n\t\t\t\t\t\t\tcase Ti.Media.MEDIA_TYPE_PHOTO:\r\n\t\t\t\t\t\t\t\tvar childWindow = Ti.UI.createWindow({backgroundColor: 'white'});\r\n\t\t\t\t\t\t\t\tchildWindow.add(Ti.UI.createImageView(\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\timage: selectionEvent.media,\r\n\t\t\t\t\t\t\t\t\twidth: Ti.UI.FILL,\r\n\t\t\t\t\t\t\t\t\theight: Ti.UI.FILL,\r\n\t\t\t\t\t\t\t\t}));\r\n\t\t\t\t\t\t\t\tnavWindow.openWindow(childWindow);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase Ti.Media.MEDIA_TYPE_LIVEPHOTO:\r\n\t\t\t\t\t\t\t\tvar childWindow = Ti.UI.createWindow({backgroundColor: 'white'});\r\n\t\t\t\t\t\t\t\tvar livePhotoView = Ti.UI.iOS.createLivePhotoView({\r\n\t\t\t\t\t\t\t\t\tlivePhoto: selectionEvent.livePhoto,\r\n\t\t\t\t\t\t\t\t\tmuted: true,\r\n\t\t\t\t\t\t\t\t\twidth: 300\r\n\t\t\t\t\t\t\t\t});\r\n \r\n\t\t\t\t\t\t\t\tlivePhotoView.addEventListener(\"start\", function(e) {\r\n\t\t\t\t\t\t\t\t\tTi.API.warn(\"-- Start playback --\");\r\n\t\t\t\t\t\t\t\t\tTi.API.warn(e);\r\n\t\t\t\t\t\t\t\t});\r\n \r\n\t\t\t\t\t\t\t\tlivePhotoView.addEventListener(\"stop\", function(e) {\r\n\t\t\t\t\t\t\t\t\tTi.API.warn(\"-- Stop playback --\");\r\n\t\t\t\t\t\t\t\t\tTi.API.warn(e);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\tchildWindow.add(livePhotoView);\r\n\t\t\t\t\t\t\t\tnavWindow.openWindow(childWindow);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase Ti.Media.MEDIA_TYPE_VIDEO:\r\n\t\t\t\t\t\t\t\tvar childWindow = Ti.UI.createWindow({backgroundColor: 'white'});\r\n\t\t\t\t\t\t\t\tchildWindow.add(Ti.Media.createVideoPlayer(\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\turl: selectionEvent.media.nativePath,\r\n\t\t\t\t\t\t\t\t\tautoplay: true,\r\n\t\t\t\t\t\t\t\t\tmediaControlStyle: Ti.Media.VIDEO_CONTROL_DEFAULT,\r\n\t\t\t\t\t\t\t\t\tscalingMode: Ti.Media.VIDEO_SCALING_ASPECT_FIT,\r\n\t\t\t\t\t\t\t\t\twidth: Ti.UI.FILL,\r\n\t\t\t\t\t\t\t\t\theight: Ti.UI.FILL,\r\n\t\t\t\t\t\t\t\t}));\r\n\t\t\t\t\t\t\t\tnavWindow.openWindow(childWindow);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\talert(\"Unknown media type selected.\");\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn row;\r\n\t\t\t\t};\r\n\t\t\t\tif (e.images) {\r\n\t\t\t\t\tfor (var index = 0; index < e.images.length; index++) {\r\n\t\t\t\t\t\ttableView.appendRow(createRowFrom(e.images[index]));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (e.livePhotos) {\r\n\t\t\t\t\tfor (var index = 0; index < e.livePhotos.length; index++) {\r\n\t\t\t\t\t\ttableView.appendRow(createRowFrom(e.livePhotos[index]));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (e.videos) {\r\n\t\t\t\t\tfor (var index = 0; index < e.videos.length; index++) {\r\n\t\t\t\t\t\ttableView.appendRow(createRowFrom(e.videos[index]));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcancel: function() {\r\n\t\t\t\tTi.API.info(\"@@@ Photo gallery selection canceled.\");\r\n\t\t\t},\r\n\t\t\terror: function() {\r\n\t\t\t\tTi.API.info(\"@@@ Photo gallery selection error.\");\r\n\t\t\t},\r\n\t\t});\r\n\t});\r\n\tdialog.show();\r\n});\r\nwindow.add(addButton);\r\nvar clearButton = Ti.UI.createButton(\r\n{\r\n\ttitle: \"Clear\",\r\n\tright: \"10dp\",\r\n\tbottom: \"10dp\",\r\n});\r\nclearButton.addEventListener(\"click\", function(e) {\r\n\ttableView.data = [];\r\n});\r\nwindow.add(clearButton);\r\nnavWindow.open();\r\n{code}\r\n\r\nIn Case of Photo media type selection it should show images only after selection.",
"updateAuthor": {
"name": "vijaysingh",
"key": "vijaysingh",
"displayName": "Vijay Singh",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2020-11-23T20:04:27.000+0000",
"updated": "2020-11-23T20:04:27.000+0000"
},
{
"id": "457711",
"author": {
"name": "ssekhri",
"key": "ssekhri",
"displayName": "Satyam Sekhri",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "FR Passed.\r\nWaiting for Jenkins build.",
"updateAuthor": {
"name": "ssekhri",
"key": "ssekhri",
"displayName": "Satyam Sekhri",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2020-11-24T23:59:16.000+0000",
"updated": "2020-11-24T23:59:16.000+0000"
}
],
"maxResults": 5,
"total": 5,
"startAt": 0
}
}
}