Complete
over 1 year ago

[Bug] COMPLICATION_TYPE_STEPS returns steps divided by 1000 when steps surpass 10,000

Not sure if this is a feature or a bug, but I don't see it documented anywhere in the API docs and it feels like strange behavior to implement as a default, so it was definitely unexpected to me.

Scenario:

I am subscribing to the COMPLICATION_TYPE_STEPS Complication and returning the number of steps to a watch face. I'm using the simulator to simulate some daily steps, and everything seems to work as expected while the number of steps are less than 10,000. However, the value being returned in the simulator changes from a Number to a Float when the number of steps surpasses 10,000, and the value is then divided by 1000. My gut feeling is that some native watch faces probably show an integer while steps are less than 10000, but will switch to a "k" format with 1 or 2 precision to show thousands of steps when the number gets too wide (i.e. 12.3k instead of 12,300). That would save some real estate on the watch face and ensure it fits whatever area it's trying to squeeze into, but that behavior should probably happen outside of the Complication, so that the Complication always returns the same type of object, in this case a whole number.

Steps Complication value = 9977
Steps Complication value = 9982
Steps Complication value = 9987
Steps Complication value = 9992
Steps Complication value = 9997
Steps Complication value = 10.002000
Steps Complication value = 10.007000
Steps Complication value = 10.012000

My current workaround is to check whether the value being returned is an instance of a float and then multiplying it by 1000 and formatting it as a whole number to get the value back into actual steps. I have not published or sideloaded the watch face yet to test on a real device, so it could be a simulator issue and not a complication issue, but wanted to share my findings either way. Feels strange to have the type of the return value change like that based on the number of steps. At the very least, this should be documented somewhere (unless I missed it).

I am currently on SDK 6.4.2, but was experiencing the same behavior with 6.4.1, and I'm running the simulator against an fr965 device.

Thanks!

Parents
  • This should not be marked as done... If that is intended, than at least the documentation should be changed to something like following:

    Value is a non-negative Number of steps for the current day, not available in wheelchair mode

    Value is a non-negative Number for steps < 10000 or Decimal for steps >= 10000 (representing steps in 10k steps in this case) for the current day, not available in wheelchair mode.

    The definition of Number says its a 32bit integer so this is definitely the wrong term for the documentation.

    I think this is an important issue, because the docs are the only information about what a complication returns (there is no function signature I could alternative check e.g.), so I must rely on the docs in this case...

Comment
  • This should not be marked as done... If that is intended, than at least the documentation should be changed to something like following:

    Value is a non-negative Number of steps for the current day, not available in wheelchair mode

    Value is a non-negative Number for steps < 10000 or Decimal for steps >= 10000 (representing steps in 10k steps in this case) for the current day, not available in wheelchair mode.

    The definition of Number says its a 32bit integer so this is definitely the wrong term for the documentation.

    I think this is an important issue, because the docs are the only information about what a complication returns (there is no function signature I could alternative check e.g.), so I must rely on the docs in this case...

Children
No Data