Re:WhatsApp is blocking Telegram links
by newjersey on Tuesday December 01, 2015 @06:26PM
(#10659699)
Would it be better they set it to string.empty or ""?
Re:WhatsApp is blocking Telegram links
by ones_and_zeros on Wednesday December 02, 2015 @01:42PM
(#10664883)
Comment 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.
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/74def22213846b1f90a26...