title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
x
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
|
Thursday, March 02, 2017 | |
One last lesson in QuickBlox's JavaScript SDK before I call the client-side alpha I'm working on ready for testing... Unread counts. One of the first things I do when someone logs in is pull back their active dialogs and then, on callback, get 10 messages for each of those dialogs. Then I have pretty much everything I need to display to the user as they switch from dialog to dialog. As new messages come in to the active conversation (where "conversation" here is a synonym for a QuickBlox "dialog"), they're displayed and marked read. If they come into a backgrounded conversation, I put them into a separate array and add the count to the unread count for that conversation. If the user foregrounds that previously backgrounded conversation, I iterate through that "new but unread" array and let QB know they've been read now, because, at the very least, they've been displayed. The snafu comes when you reload conversations who have unread messages in their ten most recent messages. That's the state you're in if new messages come into a backgrounded conversation, and the user never makes that conversation active. By default, simply calling That much is easy-ish. The problem now is splitting up which are read and which aren't when I load up the conversation. I want to take the unread ones and put them into the "new but unread" array I use for newly received messages. Then, if they make that conversation active, I can let the server know that now they should be marked read. Here's an example unread message that
That's right. The sender has had the message marked read for them, but not the receiver. Yet I'm retrieving as the receiver here. My id is not in the That means the message's I guess I'll just wrap this the way I talked about wrapping properties before, and add Yuck. Labels: javascript, noteToSelf, quickblox posted by ruffin at 3/02/2017 09:33:00 AM |
|
| |
All posts can be accessed here: Just the last year o' posts: |
||||||||||||||||||||||
|