-
Notifications
You must be signed in to change notification settings - Fork 1
fix(avatar): change avatar seed algorithm to sync with android #1182
Conversation
Thanks for contributing to Dialtone Vue! Please read below for some important info regarding Vue 3 compatibility. Currently we need to maintain two branches in Dialtone Vue, one for Vue 2, one for Vue 3. This means you must create two PRs for every feature change you make. One into Many times the change you have made in Vue 2 will be identical to the change you need to make in Vue 3. To make this easier we have made a script that can copy your changes from this branch to a new branch off of staging-vue3 suffixed with -vue3. run Once the new branch is created, you will need to look at your code to make sure it still makes sense and test that your changes all work in vue 3. If everything is good you can push it and create a PR into It is a required check for every PR to have a corresponding branch called I got "commit SHA is a merge but no -m option was given."This happens if there are merge commits in your branch. It's no problem, you can simply skip them with What if I make more changes to my vue 2 branch after running ./copy_pr_vue3.sh?You can copy these to the existing -vue3 branch by running the script with a git SHA param like so:
where 2a78db7 is the last commit from your branch that was copied to the other branch (all commits after this will be copied) If it's just one or two commits, you may prefer to just manually use What if I get a conflict?It's possible to get a conflict when running |
✔️ Deploy Preview ready! |
const hash = fnv.hash(seed); | ||
return array[hash.value % array.length]; | ||
const hash = javaHashCode(seed); | ||
return array[Math.abs(hash) % array.length]; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this function only used for Avatar or are there any other components that make use of it? If not, maybe we can rename it to getAvatarBackgroundColor
or something more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was it could be used for any array I don't think it needs to be specific to avatar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, having one algo for deciding coloring would be great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
# [2.97.0](v2.96.0...v2.97.0) (2023-09-20) ### Bug Fixes * add virtual "prompt" for visual tests on PR ([#1192](#1192)) ([4a41d02](4a41d02)) * **Avatar:** change avatar seed algorithm to sync with android ([#1182](#1182)) ([53a09f3](53a09f3)) * **Contact Info, Feed Item Row, Item Layout:** alignment issues ([#1186](#1186)) ([bdaa355](bdaa355)) * feed pill not exported ([#1180](#1180)) ([792b838](792b838)) * **Item Layout:** selected slot alignment ([#1194](#1194)) ([09c37c4](09c37c4)) * **Recipe Callbar Button With Popover:** change event name and sync open state ([#1183](#1183)) ([b91dc02](b91dc02)) ### Features * **Avatar:** add clickable behavior ([#1176](#1176)) ([2b80018](2b80018)) * **Callbox:** add clickable behavior ([#1196](#1196)) ([bf5ac2b](bf5ac2b))
🎉 This PR is included in version 2.97.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
fix(avatar): change avatar seed algorithm to sync with android
🛠️ Type Of Change
📖 Description
Meant to do this a while back but forgot. Updated our avatar random generation algorithm to sync with android.
💡 Context
Our previous hashing algo FNV was not easy to implement on android, so I've updated our code to use the same algo as java's "hashCode". Our user avatar colors on web and mobile will be in sync after this change.
The exact same tests I've implemented here are also implemented on android, so we should be able to remain in sync.
📝 Checklist
🔮 Next Steps
Needs to be updated in Dialpad
🔗 Sources
https://www.w3schools.com/java/ref_string_hashcode.asp