Open PanderMusubi opened 10 years ago
I don't understand what you mean. Can you show the difference in practice?
One contact of mine has in Webogram a default image with a red background while in the Telegram app he has a default image with a green background. Another contact of mine has on Webogram a default blue image and in the app a green image.
This means that the algorithms are not only different but also have a different overlap. Hence the request to consolidate how a default image is being chosen with Telegram. An example could be the MD5 checksum of the telephonenumer of simply the last digit of the telephone number.
I've found the function, which selects color for user id on Android app: https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java#L586
I'm not going to calculate md5 hash for every user. This is overkill for this task, especially for Javascript based version.
Hope, that soon the default profile pics logic will change a little and they will come to some more simple solution.
Would be nice if they become the same. MD5 you could cache on the browser's local storage so you only have to calculate it whenever a new user without an avatar has to be shown.
Please ask the maintainers of the API how you would like it to change if you have some ideas about this.
Best would be if upon registration a default avatar was created and used until replaced. That way we'd get around the continuous md5 calculation, and it would be in the API too (and I don't think it'd require any huge API changes either).
+1 for the last comment. How do we get this up to the Telegram team? Would @zhukov do this since he's the "owner" and spokesperson (I guess) of Webogram? :)
Please use the same default avatar such as https://zhukov.github.io/webogram/img/placeholders/UserAvatar4@2x.png and https://zhukov.github.io/webogram/img/placeholders/UserAvatar1@2x.png for a contact without a custom avatar in at least Webogram and the official mobile app https://play.google.com/store/apps/details?id=org.telegram.messenger
In this way it is easy to find the same contact in different clients because they have the same default avatar. At the moment this is not the case.
If needed, please contact Telegram to either make this part of the API or to agree on one algorthm to determine from a contact's telephone number on how to select which default avatar.