@rodrigo: good idea about the 50+ display
Perhaps we could mark the 950 messages as "read" in our client-side DB. Then display "50+" on the client. When any of the 50 unread messages are displayed on screen we mark them as "read"
IMHO, I think the best approach will be to have a DB locally that we can fill up and then experiment with different display options.
We have two states that we need to deal with:
1. never logged into bc on this web client before
- create a new indexedDB on the client
- get the 51 most recent messages for each channel they follow
- all channels with >50 unread messages get the "50+" unread counter.
- infinite scroll and pull in messages from history
2. has logged in before and there is some history (for that user account) in the indexedDB.
(this one is more tricky: if sync-ing fails half way through we will never know what timestamp to resync from again)
aim: show the user's home channel first with posts
aim: pull in other channels posts in the background
- request messages newer than most recent
- store these messages with an extra flag "sync"
- when we have a complete archive for that channel remove the "sync" flag from the new messages (is this the best way to protect against a failure mid-sync?)
- update the user's personal channel with the new posts
- … somehow get other posts but not the user's personal channel posts?
So thinking through this, perhaps we need an API call like "give me all new posts since $timestamp AND first send me my personal channel's posts"
This all seems very clunky… Perhaps someone else have a cleaner more elegant solution to quickly display new data to us when we log in.
S.