Acknowledged
over 1 year ago

Face it not displaying complications with units UNIT_TEMPERATURE correctly

If I have a public complication published with UNIT_TEMPERATURE, I'd expect this to be converted and displayed depending on the watch setting for units -> Temperature. i.e. I expect that if I publish a value of 30, this would display as 30 if the watch is set to Celsius, or 86 if the watch is set to Fahrenheit. I'd also expect the appropriate unit abbreviation to be displayed next to the number.

For example, I'd expect to see something like 30°C or 86°F

However, the Face it watch face always displays this as just the number published without any abbreviation or conversion.

i.e. I see 30, irrespective of the temperature units and no unit abbreviation.

The documentation states a complication with specified units wil be displayed as, "A numerical value converted from the default units defined for the unit type to the system units with the appropriate unit abbreviation." This does not appear to be happening.

Tested with SDK 6.4.0 Connect IQ Store version 2.25

  • The glance displays what the app chooses to display and complications are not involved. The glancePreview is only for the preview when the glance is in a folder.

    There was no runtime error, and syntactically ":unit => null" is correct, but does generate the compiler error that I showed, so there is precedence for checking the dictionary content.

    It would be nice though if the compiler could at least give a warning along the lines of "unexpected key in dictionary" if anything unexpected is seen. That would have prevented my mistake.

  • Does the glance (when not part of a folder glance) display correctly?

    I would expect a runtime error when the data is passed to updateComplication since Complication.Data has a typedef, but I'll check to see whether this is something we want to try to detect at compile time. The thing is, the data dictionary could conceivably have anything in it—there's nothing wrong syntactically with your original code. The compiler would have to somehow know your intent for the data dictionary. I already talked with the compiler folks, and they think it's unlikely we'd do anything at compile time except perhaps a warning, but we'd have to somehow infer intent. I'll check with the decision-makers and see what they would like to do in this case.

  • That was it.
    face it now correctly changes the value and displays a unit abbreviation as documented based on the configuration. But the folder glance does not:
     
    Also interesting that the compiler will generate an error if an invalid unit is specified, but will not generate an error when it's shown as "units" rather than "unit". Shouldn't this have been detected?
    ERROR: fr265s: D:\Users\jbigg\VSCode\CIQ-Test\FaceComp\source\FaceCompApp.mc:24,8: Invalid '$.Toybox.Lang.Dictionary{:value as $.Toybox.Lang.String, :unit as Null}' passed as parameter 2 of type '$.Toybox.Lang.Dictionary{:shortLabel as $.Toybox.Lang.String, :value as $.Toybox.Lang.Double or $.Toybox.Lang.Float or $.Toybox.Lang.Long or $.Toybox.Lang.Number or $.Toybox.Lang.String, :unit as $.Toybox.Complications.Unit or $.Toybox.Lang.String, :ranges as $.Toybox.Lang.Array<$.Toybox.Lang.Double or $.Toybox.Lang.Float or $.Toybox.Lang.Long or $.Toybox.Lang.Number>}'.
    So, this was my mistake, but I'd have hoped the compiler would have picked this up.
    And shouldn't the glance preview do the same thing?
  • Ah, I had not noticed that. Let me change it and try again.