Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate shorter expression animation strings from ExpressionNode #4112

Conversation

arcadiogarcia
Copy link
Member

Fixes

#4049

PR Type

What kind of change does this PR introduce?

Bugfix

What is the current behavior?

When ExpressionNodes are converted to expression animation strings, guids are used as the unique name for each parameter. While this guarantees uniqueness and works fine in theory, it makes it relatively easy to hit the 1000-character limit imposed on animation strings, which makes it impossible to express more complex animations.

What is the new behavior?

Instead of generating a random guid, we use sequential alphabetic identifiers, e.g.

A,B,C..., Z, AA , AB..., ZZ, AAA, AAB....

which also guarantees uniqueness and scales to provide any number of identifiers (well beyond what will fit in the 1000 character animation string), while outputting more compact strings. Virtually all animations willl have <25 parameters, so this changes the average parameter name length from 36 characters to 1, which is a big deal if your animation needs to repeat the same parameters in a few places.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • [ N/A ] Pull Request has been submitted to the documentation repository instructions. Link:
  • [ N/A ] Sample in sample app has been added / updated (for bug fixes / features)
  • [ N/A ] New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • [ N/A ] Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Other information

@michael-hawker
Copy link
Member

Had to re-trigger PR build with org name change

Rosuavio
Rosuavio previously approved these changes Jul 19, 2021
@Rosuavio Rosuavio dismissed their stale review July 19, 2021 19:46

Miss read status.

@michael-hawker
Copy link
Member

FYI @Sergio0694 as he did the previous PR called out in the linked issue. I feel like there was another place or two we used this same pattern, do we need to update things there as well?

Copy link
Member

@Sergio0694 Sergio0694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @arcadiogarcia! 🙌
Just left a small suggestion performance-wise, but the change makes sense! 😄

@michael-hawker To answer your question about potentially using this elsewhere, that's doable but since those cases aren't using expression animations there's less value in doing so, plus we'd have to slightly refactor code to enable this as we don't have a loop like this where we can just iteratively increment a local counter to produce all inputs. I think we can do that in a follow up PR if we wanted to make the behavior consistent, but I don't think that should be considered blocking for this PR 🙂

Copy link
Member

@Sergio0694 Sergio0694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks again @arcadiogarcia for the idea and the fix! 😄

@Sergio0694 Sergio0694 force-pushed the user/arcadiog/shorterExpressionStrings branch from c5fc961 to 50008c0 Compare July 22, 2021 22:39
@ghost
Copy link

ghost commented Aug 3, 2021

Hello @michael-hawker!

Because this pull request has the auto merge :zap: label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@michael-hawker michael-hawker added the next preview ✈️ Label for marking what we want to include in the next preview release for developers to try. label Aug 3, 2021
@arcadiogarcia
Copy link
Member Author

Looks like the CI failed, but I don't have the right permissions to see the log. Is there a way to request access to that ADO tenant?

@michael-hawker
Copy link
Member

@arcadiogarcia it should be public if you use incognito? DevOps is weird with credentials for some reason. 🙁

Should have checked and merged this in earlier, meant it to be part of our preview. Looks like it got confused again, we've had a lot of troubles with the SmokeTests picking up the wrong version still. FYI @azchohfi

 D:\a\1\s\SmokeTests\SmokeTest.csproj : warning NU1603: SmokeTest.Microsoft.Toolkit depends on Microsoft.Toolkit (>= 7.0.0-build.1410.g68f4350973) but Microsoft.Toolkit 7.0.0-build.1410.g68f4350973 was not found. An approximate best match of Microsoft.Toolkit 7.0.0-preview1 was resolved.

Which causes a problem as this was moved in the older bits (but it's good that it fails in this case to let us know).

 D:\a\1\s\SmokeTests\Microsoft.Toolkit\MainPage.xaml.cs(18,43): error CS1061: 'string' does not contain a definition for 'IsEmail' and no accessible extension method 'IsEmail' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\SmokeTests\SmokeTest.csproj]

I'll re-run the smoke tests.

@michael-hawker
Copy link
Member

I just ran the CI clean, not sure why it's not reporting properly on GitHub:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
animations 🏮 auto merge ⚡ improvements ✨ next preview ✈️ Label for marking what we want to include in the next preview release for developers to try.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants