Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20485] LivePhoto: Proxy should override apiName

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-08-05T18:30:51.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsios, livephotos, qe-5.4.0
ReporterFokke Zandbergen
AssigneeHans Knöchel
Created2016-02-29T13:59:21.000+0000
Updated2016-08-05T18:30:57.000+0000

Description

When I read Ti.UI.iOS.LivePhoto.apiName it return Ti.Proxy and logs:
[ERROR] Subclasses must override the apiName API endpoint.
Which comes from: https://github.com/appcelerator/titanium_mobile/blob/bdfbe4d530e81caf440b595351bc84bef79f27d4/iphone/Classes/TiProxy.m#L1310

Comments

  1. Hans Knöchel 2016-02-29

    PR: https://github.com/appcelerator/titanium_mobile/pull/7785
  2. Hans Knöchel 2016-08-04

    Demo:
       Ti.API.warn(Ti.UI.iOS.LivePhoto.apiName);
       
    Expected result: "Ti.UI.iOS.LivePhoto" *EDIT*: See the below demo-code with the current usage instead.
  3. Josh Longton 2016-08-04

    *Reopening*, Ti.API.warn(Ti.UI.iOS.LivePhoto.apiName) returns an undefined object error. *ENV*
       iPhone 6s (9.3.1)
       iOS Simulator (9.3)
       
Mac OSX El Capitan 10.11.6
       Studio: 4.7.0.201607250649
       
Ti SDK: 5.4.0.v20160804021257
       
Appc NPM: 4.2.7
       Appc CLI: 5.4.0-38
       Node: v4.4.4
       
    *Error*
       [ERROR] :  Script Error {
       [ERROR] :      column = 461;
       [ERROR] :      line = 1;
       [ERROR] :      message = "undefined is not an object (evaluating 'Ti.UI.iOS.LivePhoto.apiName')";
       [ERROR] :      sourceURL = "file:///var/containers/Bundle/Application/AE7515B1-3A96-48B8-9E63-1862B94724E5/TIMOB-20396.app/app.js";
       [ERROR] :      stack = "success@file:///var/containers/Bundle/Application/AE7515B1-3A96-48B8-9E63-1862B94724E5/TIMOB-20396.app/app.js:1:461";
       [ERROR] :  }
       
    *App.js used*
       Ti.API.warn(Ti.UI.iOS.LivePhoto.apiName);
       
       var window = Ti.UI.createWindow({
           backgroundColor: "white"
       });
       
       var btn1 = Ti.UI.createButton({
           title: "Select live photo!",
           top: 30
       });
       
       btn1.addEventListener("click", openGallery);
       window.add(btn1);
       window.open();
       
       function openGallery() {
           Ti.Media.openPhotoGallery({
               mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO, Ti.Media.MEDIA_TYPE_LIVEPHOTO],
               success: function(e) {
                   var livePhoto = e.livePhoto // Live photo of type Ti.UI.iOS.LivePhoto
       
                   if (livePhoto) {
                       var livePhotoView = Ti.UI.iOS.createLivePhotoView({
                           livePhoto: livePhoto,
                           muted: true,
                           width: 300
                       });
       
                       livePhotoView.addEventListener("start", function(e) {
                           Ti.API.warn("-- Start playback --");
                           Ti.API.warn(e);
                       });
       
                       livePhotoView.addEventListener("stop", function(e) {
                           Ti.API.warn("-- Stop playback --");
                           Ti.API.warn(e);
                       });
                    window.add(livePhotoView);
                    Ti.API.warn(Ti.UI.iOS.LivePhoto.apiName);
                   }
               }
           });
       }
       
  4. Hans Knöchel 2016-08-05

    Hey Josh, sorry, my mistake in providing the test-case. Of course, we cannot check the apiName on the LivePhoto itself. Updated demo-code attached. Now, we log the apiName after a live-photo is selected from the library, which returns a Ti.UI.iOS.LivePhoto instance. Thanks! Demo:
       var window = Ti.UI.createWindow({
           backgroundColor: "white"
       });
        
       var btn1 = Ti.UI.createButton({
           title: "Select live photo!",
           top: 30
       });
        
       btn1.addEventListener("click", openGallery);
       window.add(btn1);
       window.open();
        
       function openGallery() {
           Ti.Media.openPhotoGallery({
               mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO, Ti.Media.MEDIA_TYPE_LIVEPHOTO],
               success: function(e) {
                   var livePhoto = e.livePhoto // Live photo of type Ti.UI.iOS.LivePhoto
                  
                   // Log the apiName
                   Ti.API.warn(livePhoto.apiName);
        
                   if (livePhoto) {
                       var livePhotoView = Ti.UI.iOS.createLivePhotoView({
                           livePhoto: livePhoto,
                           muted: true,
                           width: 300
                       });
        
                       livePhotoView.addEventListener("start", function(e) {
                           Ti.API.warn("-- Start playback --");
                           Ti.API.warn(e);
                       });
        
                       livePhotoView.addEventListener("stop", function(e) {
                           Ti.API.warn("-- Stop playback --");
                           Ti.API.warn(e);
                       });
                    window.add(livePhotoView);
                   }
               }
           });
       }
       
  5. Josh Longton 2016-08-05

    Verified as fixed, thanks [~hansknoechel]. Tested on:
       iPhone 6s plus (9.3.1)
       
Mac OSX El Capitan 10.11.6
       Studio: 4.7.0.201607250649
       
Ti SDK: 5.4.0.v20160804185318
       
Appc NPM: 4.2.7
       Appc CLI: 5.4.0-40
       Node: v4.4.4
       
    *Closing ticket*

JSON Source