Update tweet message limit. Fixes #35214#35224
Update tweet message limit. Fixes #35214#35224kumarharsh wants to merge 1 commit intomicrosoft:masterfrom kumarharsh:patch-1
Conversation
Twitter has updated their message limit to 280 characters. This commit updates the message text size.
| class TwitterFeedbackService implements IFeedbackService { | ||
|
|
||
| private static TWITTER_URL: string = 'https://twitter.com/intent/tweet'; | ||
| private static TWITTER_MESSAGE_SIZE: number = 280; |
There was a problem hiding this comment.
I think this limit is only 280 for languages other than Chinese, Japanese etc. So I am not sure how to best configure it, we should probably have to check for the language that is used.
There was a problem hiding this comment.
Would checking navigator.language be enough?
There was a problem hiding this comment.
I think what twitter is doing on their web UI is counting each CJK character as double. Also, they don't show a character limit usually, but rather a circular progress bar. Only when a user approaches the character limit do they start showing the actual characters left.
There was a problem hiding this comment.
So, what we can do is implement a counter which counts double for every CJK character (would need to lookup via code-points, maybe?). Your thoughts @bpasero .
There was a problem hiding this comment.
@kumarharsh yes if that is what twitter does when they count it seems fine to do the same for us. I think checking for the code-point is a valid approach. Maybe check https://github.com/Microsoft/vscode/blob/master/src/vs/base/common/strings.ts#L574 as inspiration?
There was a problem hiding this comment.
@bpasero After digging some more, I think the solution is not so straightforward. I think with some of the new changes which twitter made (excluding urls, handles, etc from the message length), it might be better to use their own service for determining the message limit. The v2 version will support the 280 character limit.
Here is the issue tracking the release of v2 of twitter-text: twitter/twitter-text#196. Would it be ok to wait for it?
Twitter has updated their message limit to 280 characters. This commit updates the message text size.