Skip to content
Donald Chen edited this page Jun 4, 2014 · 34 revisions

Design Doc

GUI

The GUI sends messages to the Controller
When the user clicks on a different group, the Controller tells the DataManager to
	reload the messages.

Controller

The Controller receives actions from the GUI such as "send group message" and 
	tells the DataManager to send it via the ServerInterface.

DataManager

A DataManager receives a message action from the Controller and sends 
the message to the ServerInterface.

- (void)sendNewMessage:(NSString*)text toGroup:(Group*)group withAttachments:(NSArray*)attachments;
	update CoreData model with new message
	tell ServerInterface to send message to server

- (void)signIn;
- (void)logOut;
- (BOOL)isUser:(NSString*)userID;

ServerInterface

The ServerInterface receives messages from the DataManager and pushes to the
	server (RESTAPI).

- (void)sendNewMessage:(NSString*)message
           toGroup:(NSString*)groupID
   withAttachments:(NSArray*)attachments	



The ServerInterface receives messages via the web socket from the server, pulls
	the previous 20 messages, and tells the DataManager to update the CoreData.

- (void)fetch20MessagesBeforeMessageID:(NSString*)beforeID
                           inGroup:(NSString*)groupID

- (void)fetch20MostRecentMessagesSinceMessageID:(NSString*)sinceID
                                    inGroup:(NSString*)groupID

The ServerInterface receives notifications, and the _notificationCenter posts
	the notifications.

- (void)messageCentralRouter:(NSDictionary *)messageDict
	If the notification indicates that a group member has been added or removed,
		pull the members list from the server and tell the DataManager to update
		the CoreData Model

CoreData Model

The CoreData Model is bound to the GUI.  The DataManger reloads the previous 20 
	messages into the CoreData which automatically updates the GUI.
Clone this wiki locally