4 ms·
> but Telegram is not even sending messages that are shared from WhatsApp This is wrong. If you follow the logic (which is admittedly difficult) you'll see the
by ones_and_zeros 11y ago
> but Telegram is not even sending messages that are shared from WhatsApp
This is wrong. If you follow the logic (which is admittedly difficult) you'll see they are stripping out the "sent from WhatsApp" tagline WhatsApp adds when you share a photo, etc from WhatsApp to Telegram.
You'll still get the photo, it just won't have the tagline indicating where it came from. Still a bit shady but I also dislike the "Sent from ..." taglines.
EDIT: Parent is a WhatsApp employee... now this seems like sort of a lame attempt to justify their own unethical behavior. This makes me pretty bummed.
- Wingman4l7 11y ago"Sent from" is basically using my mobile messaging activities as advertising, which is why it's highly annoying to me. This is a nice internal fix.
- cheez 11y agoThat is some horrifying code...
- ones_and_zeros 11y agoIndeed, and unsurprisingly, this results in a bug. It's not that it strips out the text, it's that it sets that variable to null which is then used for flow control. So you will run in to issues (not sure how it would manifest itself) if you share photo or video that does have text, but just doesn't contain "WhatsApp" ("Sent from FooBar"). It looks like it'll send a text and then send the photo[0] but who knows what kind of state will be modified when you send the text first. [0] https://github.com/DrKLO/Telegram/blob/74def22213846b1f90a26c86670035079dea032c/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java#L1315 https://github.com/DrKLO/Telegram/blob/74def22213846b1f90a26...
- newjersey 11y agoWould it be better they set it to string.empty or ""?
- ones_and_zeros 11y agoComment is now dead but I'd significantly refactor this code where I wouldn't be using nulls or empty strings as program flow control. At the very least I'd have an enum that was very explicit of what action I should be taking ie TEXT, PHOTO, VIDEO, etc. The logic is too mixed up and this method does too many things. Off the top of my head you might refactor it so that inspection, classification, validation, preparation, etc all happen separately, right now this method does them all and then some.
- newjersey 11y agoOh wow you sound like Uncle Bob (and I say that as a compliment). I think you're right. There is a lot of room for refactoring here. A few more (business/model) classes would not hurt here.