File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed
use_cases/chat_initiation_use_case Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
1
package entities .chat ;
2
2
import entities .message .Message ;
3
3
4
+ import java .time .LocalDateTime ;
4
5
import java .util .ArrayList ;
5
6
// Chat is an abstract class
6
7
public class Chat {
@@ -53,5 +54,17 @@ public void addtoconvHist(Message message){
53
54
this .convHist .add (message );
54
55
}
55
56
57
+ /**
58
+ * Return of the timestamp of a chat's last updated to conversation history. If conversation
59
+ * history is empty, return null
60
+ * @return timestamp of last update (or null if empty)
61
+ */
62
+ public LocalDateTime getLastUpdated (){
63
+ if (this .convHist .size () != 0 ) {
64
+ return this .convHist .get (this .convHist .size () - 1 ).getTimestamp ();
65
+ }
66
+ return null ;
67
+ }
68
+
56
69
57
70
}
Original file line number Diff line number Diff line change @@ -45,10 +45,10 @@ public void setRecipientUsername(String recipientUsername) {
45
45
this .recipientUsername = recipientUsername ;
46
46
}
47
47
48
- public String getSendertUsername (){
48
+ public String getSenderUsername (){
49
49
return this .senderUsername ;
50
50
}
51
- public void setSendertUsername (String recipientUsername ){
51
+ public void setSenderUsername (String recipientUsername ){
52
52
this .recipientUsername = recipientUsername ;
53
53
}
54
54
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public void setRecipientUsername(String recipientUsername) {
31
31
// Update the message history when the type in put in message txtfieled and click send button.
32
32
public void setMessage (String content ) {
33
33
MsgFactory msgfactory = new MsgFactory ("text" );
34
- privatechat .addtoconvHist (msgfactory .createMsg (privatechat .getSendertUsername (), content ));
34
+ privatechat .addtoconvHist (msgfactory .createMsg (privatechat .getSenderUsername (), content ));
35
35
}
36
36
37
37
You can’t perform that action at this time.
0 commit comments