Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28250

iOS 14: openPhotoGallery with allowMultiple does not respect mediaTypes and returns LIVEPHOTO when requesting only PHOTO

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Unresolved
    • Affects Version/s: Release 9.2.2
    • Fix Version/s: Release 9.3.0
    • Component/s: iOS
    • Labels:
      None
    • Environment:

      iOS 14
      SDK 9.2.2.GA, 9.3.0.v20201119162516

    • Story Points:
      5
    • Sprint:
      2020 Sprint 24

      Description

      Description

      When 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

      const win = Ti.UI.createWindow({ layout: 'vertical' });
      const singleBtn = Ti.UI.createButton({ title: 'Select single', top: 50 });
      singleBtn.addEventListener('click', () => {
          selectImage(false);
      });
      win.add(singleBtn);
      const multiBtn = Ti.UI.createButton({ title: 'Select multiple' });
      multiBtn.addEventListener('click', () => {
          selectImage(true);
      });
      win.add(multiBtn);
      win.open();
      function selectImage(allowMultiple) {
          Ti.Media.requestPhotoGalleryPermissions((e) => {
              if (!e.success) {
                  console.error('failed to get permissions');
                  console.error(e);
                  return;
              }
              Titanium.Media.openPhotoGallery({
                  success: function(e) {
                      console.log(e);
                  },
                  error: function(e) {
                      console.error('errored on openPhotoGallery')
                      console.error(e);
                  },
                  mediaTypes: [ Ti.Media.MEDIA_TYPE_PHOTO ],
                  allowMultiple
              });
          });
      }
      

      Steps to reproduce

      1. Add the above code to an existing app.js
      2. Ensure you have a NSPhotoLibraryUsageDescription key in your plist like below

      <key>NSPhotoLibraryUsageDescription</key>
      <string>Can we steal your pics?</string>
      

      3. Build to iOS
      4. Tap the Select single button and select a live photo
      5. Tap the Select multi button and select a live photo

      Actual

      In step 4 an object is returned with mediaType of Ti.Media.MEDIA_TYPE_PHOTO
      In step 5 an object is returned with a livePhotos array and contains an object with a media type of Ti.Media.MEDIA_TYPE_LIVEPHOTO

      Expected

      A mediaType of Ti.Media.MEDIA_TYPE_LIVEPHOTO should not be returned if only Ti.Media.MEDIA_TYPE_PHOTO was requested

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vijaysingh Vijay Singh
                Reporter:
                eharris Ewan Harris
                Reviewer:
                Christopher Williams
                Tester:
                Satyam Sekhri
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration