Skip to content

Commit 6f727ce

Browse files
author
Nasim Bondar Sahebi
committed
create a chat Interactor instead of chat viewmodel
1 parent 060ccd3 commit 6f727ce

File tree

2 files changed

+37
-44
lines changed

2 files changed

+37
-44
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package chatlinitation;
2+
3+
4+
5+
import entities.PrivateChat;
6+
7+
/**
8+
* Chatinteractor connects our ChatView UI to our Entities.
9+
* It provide data to the view, so that view can put that data on the screen.
10+
* this class contain Privatchat and methods to update the Private chat.
11+
*/
12+
13+
public class ChatInteractor{
14+
15+
PrivateChat privatechat;
16+
17+
18+
// constructor containing the private chat
19+
public ChatInteractor(PrivateChat privatechat) {
20+
this.privatechat = privatechat;
21+
}
22+
23+
24+
//Update the Recipientusername when the user type in the username text field and click add button.
25+
public void setRecipientUsername(String recipientUsername) {
26+
this.privatechat.setRecipientUsername(recipientUsername) ;
27+
}
28+
29+
30+
// Update the message history when the type in put in message txtfieled and click send button.
31+
public void setMessage(String content) {
32+
MsgFactory msgfactory = new MsgFactory("text");
33+
privatechat.addtoconvHist(msgfactory.createMsg(privatechat.getSendertUsername(), content));
34+
}
35+
36+
37+
}

src/main/java/chatlinitation/ChatViewmodel.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)