CouchChat-iOS demo: The way to dismiss a message?

10 views
Skip to first unread message

Guofeng Zhang

unread,
Oct 16, 2014, 11:50:02 AM10/16/14
to mobile-c...@googlegroups.com
Hi,

My app is similar to this chat room demo, but synced doc can be modified by any users, and the modified doc would also synced to any other mobiles

I also want the user to dismiss a message on his mobile, but this operation should not affect other users. 

What I thought to deal with this requirement is to add a new property "dismissed" into the doc, and set its value to true so that the view won't allow the app to display it.

The problem with this solution is that the property "dismissed" will also be synced to other users' mobiles and make the message to be not displayed to them. This is not what I want.

What is the proper way to deal with it?

Thanks for your help.

Guofeng

Jens Alfke

unread,
Oct 16, 2014, 11:53:49 AM10/16/14
to mobile-c...@googlegroups.com

On Oct 16, 2014, at 5:00 AM, Guofeng Zhang <guof...@gmail.com> wrote:

What I thought to deal with this requirement is to add a new property "dismissed" into the doc, and set its value to true so that the view won't allow the app to display it.

You can't store this property in the document. You'll need to keep some local state that remembers which documents have been dismissed. You can store that any way you like — it could be in a doc in the database that's private to that user (so it can be synced between his/her devices), or it could be outside the database.

—Jens
Reply all
Reply to author
Forward
0 new messages