Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28407] Review possible incorrectly documented setter/getter functions

GitHub Issuen/a
TypeStory
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2021-04-08T19:38:07.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.0
Componentsn/a
Labelsn/a
ReporterEwan Harris
AssigneeEwan Harris
Created2021-03-30T13:23:06.000+0000
Updated2021-05-03T18:14:20.000+0000

Description

Description

In the linked ticket there was some inconsistencies around setters that existed on one platform but not the other, but were documented to exist on both. In order to make sure we're clean, I took a look through the JSCA file to try and see if there were anymore that existed here. My criteria was (script attached) * Have to be under Titanium namespace (but not XML) * Are not deprecated already * Have a corresponding read-write property * Getter has 0 arguments, setter has 1 argument This gave me the below potential problematic APIs
{
  "getters": [
    {
      "function": "getTabs",
      "parent": "Titanium.UI.TabGroup"
    }
  ],
  "setters": [
    {
      "function": "setCheckable",
      "parent": "Titanium.Android.MenuItem"
    },
    {
      "function": "setChecked",
      "parent": "Titanium.Android.MenuItem"
    },
    {
      "function": "setEnabled",
      "parent": "Titanium.Android.MenuItem"
    },
    {
      "function": "setVisible",
      "parent": "Titanium.Android.MenuItem"
    },
    {
      "function": "setTimeout",
      "parent": "Titanium.Network.HTTPClient"
    },
    {
      "function": "setWindow",
      "parent": "Titanium.UI.Tab"
    },
    {
      "function": "setHeaderPullView",
      "parent": "Titanium.UI.TableView"
    }
  ],
  "isers": [
    {
      "function": "isCheckable",
      "parent": "Titanium.Android.MenuItem"
    },
    {
      "function": "isChecked",
      "parent": "Titanium.Android.MenuItem"
    },
    {
      "function": "isEnabled",
      "parent": "Titanium.Android.MenuItem"
    },
    {
      "function": "isVisible",
      "parent": "Titanium.Android.MenuItem"
    },
    {
      "function": "isSupported",
      "parent": "Titanium.App.iOS.UserActivity"
    },
    {
      "function": "isLooping",
      "parent": "Titanium.Media.Sound"
    },
    {
      "function": "isPaused",
      "parent": "Titanium.Media.Sound"
    }
  ]
}
If these are incorrectly documented they need the same treatment as this commit https://github.com/appcelerator/titanium_mobile/commit/580cffc90d27d5b21d5fbb9de34bc9bb73f923a7

Attachments

FileDateSize
cat.mp32021-04-07T12:20:29.000+000023822
setters-getters-finder.js2021-03-30T16:32:23.000+00001372

Comments

  1. Ewan Harris 2021-03-30

    This may also apply to some of the "is" APIs? Edit: yes it does, updated list and script
  2. Ewan Harris 2021-03-30

    * TabGroup.getTabs - done in https://github.com/appcelerator/titanium_mobile/commit/580cffc90d27d5b21d5fbb9de34bc9bb73f923a7 * MenuItem.setCheckable (Android only) - Does not exist * MenuItem.setChecked (Android only) - Does not exist * MenuItem.setEnabled (Android only) - Does not exist * MenuItem. setVisible (Android only)- Does not exist * HTTPClient.setTimeout - Does not exist on either platform * Tab.setWindow - exists on Android, does not exist on iOS * TableView.setHeaderPullView (iOS only) - Does not exist Only one that isn't clearcut (i.e. it's obvious the docs are invalid) is Tab.setWindow, I think this is the same as in https://github.com/appcelerator/titanium_mobile/pull/12661 and should be reworked? Everything else is clearcut and should be marked as deprecated/removed in 10
  3. Ewan Harris 2021-03-30

    * MenuItem.isCheckable (Android only) - Does not exist * MenuItem.isChecked (Android only) - Does not exist * MenuItem.isEnabled (Android only) - Does not exist * MenuItem.isVisible (Android only)- Does not exist * UserActivity.isSupported (iOS only) - Exists is valid per TIMOB-19510 * Sound.isLooping - Does not exist on Android, exists on iOS * Sound.isPlaying - Does not exist on Android, exists on iOS
  4. Ewan Harris 2021-03-30

    I think the read-write should only be applicable for setter methods, get/is should probably only look for if a property exists, which adds the following: * Intent.getData (Android only) - Does not exist * HTTPClient.getAllResponseHeaders - Exists on both platforms * MenuItem.isActionViewExpanded (Android only) - Does not exist * ResultSet.isValidRow - Exists on both platforms * Sound.isPaused - Does not exist on Android, exists on iOS
  5. Ewan Harris 2021-03-30

    PR for comments: https://github.com/appcelerator/titanium_mobile/pull/12677 Not marking for review as there is technically work to be done still, I just want opinions on what that work should be: * Remove the APIs fully now across both platforms * Mark as removed/deprecated on the right platform, and only deprecate on the platform with a view to remove properly in future cc [~cwilliams] [~jquick] [~vijaysingh] [~gmathews] whatcha thinking?
  6. Ewan Harris 2021-04-07

    Test case (requires the attached cat.mp3 file in the Resources directory)
       var win1 = Ti.UI.createWindow({
           backgroundColor: 'blue',
           fullscreen: false
       });
       
       win1.addEventListener('click', () => {
           const sound = Ti.Media.createSound({ url: 'cat.mp3'});
           console.log(sound.isLooping());
           console.log(sound.isPlaying());
           console.log(sound.isPaused());
       })
       
       var tab1 = Ti.UI.createTab({
           title: 'Tab 1'
       });
       
       if (OS_ANDROID) {
           tab1.setWindow(win1);
       } else {
           tab1.window = win1;
       }
       
       var win2 = Ti.UI.createWindow({
           backgroundColor: 'yellow'
       });
       var tab2 = Ti.UI.createTab({
           window: win2,
           title: 'Tab 2'
       });
       
       var tabGroup = Ti.UI.createTabGroup({
           activity: {
               onCreateOptionsMenu: function(e) {
                   var menu = e.menu;
                   var menuItem = menu.add({
                       title : "Item 1",
                       itemId: 1
                   });
                   console.log(menuItem.isActionViewExpanded());
                   console.log(menuItem.isCheckable());
                   console.log(menuItem.isChecked());
                   console.log(menuItem.isEnabled());
                   console.log(menuItem.isVisible());
       
               }
           }
       });
        
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
       tabGroup.open();
       
  7. Christopher Williams 2021-04-08

    https://github.com/appcelerator/titanium_mobile/pull/12692
  8. Christopher Williams 2021-04-08

    merged to master and 10_0_X branches

JSON Source