threedy icon indicating copy to clipboard operation
threedy copied to clipboard

Animation not showing on homeassistant ios app

Open aee74 opened this issue 3 years ago • 15 comments

The animation works perfectly on my pc. But on the IOS app it's empty. even after clearing the frontend cache.

aee74 avatar Feb 15 '21 13:02 aee74

To add to this, it also doesn't seem to be working in Safari on MacOS. My assumption is that this is a webkit compatibility issue.

RobertD502 avatar Feb 17 '21 19:02 RobertD502

This is a strange issue. The library I'm using for the animation, Framer Motion seems to support all browser variants. I have tested this (with success) on a webkit browser, but perhaps Apple's Safari does things differently. I'm going to borrow some Apple devices to test this on.

dangreco avatar Feb 18 '21 05:02 dangreco

Uploading 995D73F2-EDB0-46A8-B47B-36F1774A6F99.jpeg…

aee74 avatar Feb 18 '21 06:02 aee74

This with latest version on homeassistant ios app

aee74 avatar Feb 18 '21 06:02 aee74

@dangreco I’ll investigate it with Dev tools on my Mac and iPhone in the AM and will report back any useful info that I find.

RobertD502 avatar Feb 18 '21 07:02 RobertD502

@dangreco For some reason Safari on MacOS started displaying the card correctly. However, the card is throwing up the warning seen in the attached image. The warning appears whenever I load a lovelace dashboard that contains the card and also repeats itself every time I expand/collapse the card when the status of the printer is idle (when the card icon is blue).

MacOS Safari Dev Tools

iOS Companion App:

Your card is completely fine. This is purely a user error- in order for the card to work properly, iOS companion app users need to "Reset the frontend cache". Once that is done, the card works. The attached image is of the card viewed within the iOS companion app. It may be useful to add this to the instructions to avoid further issues of the same nature being opened. In order to reset the frontend cache, iOS users need to click on "App Configuration" in the sidebar from within the iOS Companion App --> then click on "Reset frontend cache" located at the bottom of the page. I do want to note that while debugging the card from within Mobile Safari on my iPhone, I received the same error as seen in the screenshot above- this doesn't cause the card to not work, so, it isn't really a pressing issue.

Threedy iOS

RobertD502 avatar Feb 18 '21 08:02 RobertD502

I did a frontend reset. And still no animation Uploading 2EFCEB6F-D08D-481A-A823-76A5E2A8408D.jpeg…

aee74 avatar Feb 18 '21 15:02 aee74

Uploading 3DA3174E-F918-445F-8347-83BBA6492803.png…

aee74 avatar Feb 18 '21 15:02 aee74

@aee74 I’m not sure if I’m the only one, but none of your uploaded images are showing.

RobertD502 avatar Feb 18 '21 16:02 RobertD502

I’m also not seeing them. Try again 810AC2A1-E032-43EE-96D1-8934EEA3FCAD 8C1E8B0F-DD98-4A37-8D64-CEB7F5F2884B

aee74 avatar Feb 18 '21 17:02 aee74

I can see the image when idle but not while printing

BE4EA403-A6F1-40AD-96D5-91DB4329DA3F

aee74 avatar Feb 18 '21 17:02 aee74

@aee74 Did you force quit the HA companion app after resetting the frontend cache?

RobertD502 avatar Feb 18 '21 17:02 RobertD502

@dangreco For some reason Safari on MacOS started displaying the card correctly. However, the card is throwing up the warning seen in the attached image. The warning appears whenever I load a lovelace dashboard that contains the card and also repeats itself every time I expand/collapse the card when the status of the printer is idle (when the card icon is blue).

MacOS Safari Dev Tools

Digging around in the webpacked code revealed that the function e.match is part of the framer-motion library (or to my best judgement). I'll see if I can find a workaround by testing on Safari myself today + looking at the source code for framer-motion.

dangreco avatar Feb 18 '21 19:02 dangreco

@aee74 Did you force quit the HA companion app after resetting the frontend cache?

Yes I did

aee74 avatar Feb 19 '21 12:02 aee74

Updates on hunting down the bug

framer-motion depends on popmotion which contains the e.match(P) code responsible for the bug. I found two roots of this in the source code (marked by /* HERE */, but I can't tell which is the correct one:

Area 1

...
function analyse(v: string) {
  const values: Array<Color | number> = [];
  let numColors = 0;

  const colors = v.match(colorRegex); /* HERE */
  if (colors) {
    numColors = colors.length;
    // Strip colors from input so they're not picked up by number regex.
    // There's a better way to combine these regex searches, but its beyond my regex skills
    v = v.replace(colorRegex, colorToken);
    values.push(...colors.map(color.parse));
  }

  const numbers = v.match(floatRegex);
  if (numbers) {
    v = v.replace(floatRegex, numberToken);
    values.push(...numbers.map(number.parse));
  }

  return { values, numColors, tokenised: v };
}
...

Area 2

...
function test(v: any) {
  return (
    isNaN(v) &&
    isString(v) &&                               /* HERE */
    (v.match(floatRegex)?.length ?? 0) + (v.match(colorRegex)?.length ?? 0) > 0
  );
}
...

I'm guessing v is undefined at runtime when trying to be tested.

By the way, this is just me keeping a log while I go -- I'll be updating this thread with more findings.

dangreco avatar Feb 19 '21 21:02 dangreco