Merge branch 'develop' into SendMessage

# Conflicts:
#	src/main/java/org/to/telegramfinalproject/Client/ActionHandler.java
#	src/main/java/org/to/telegramfinalproject/Database/MessageDatabase.java
#	src/main/java/org/to/telegramfinalproject/Models/ContactEntry.java
#	src/main/java/org/to/telegramfinalproject/Models/Message.java
This commit is contained in:
2025-08-11 17:06:57 +03:30
22 changed files with 1523 additions and 213 deletions
@@ -14,6 +14,7 @@ public class ChatEntry {
private LocalDateTime lastMessageTime;
private boolean archived = false;
private UUID otherUser;
private boolean savedMessages = false;
private boolean isOwner = false;
@@ -140,4 +141,12 @@ public class ChatEntry {
public UUID getOtherUserId(){
return otherUser;
}
public boolean isSavedMessages() {
return savedMessages;
}
public void setSavedMessages(boolean savedMessages) {
this.savedMessages = savedMessages;
}
}
@@ -1,7 +1,7 @@
package org.to.telegramfinalproject.Models;
import java.time.LocalDateTime;
import org.json.JSONObject;
import java.util.UUID;
public class ContactEntry {
@@ -10,8 +10,10 @@ public class ContactEntry {
private String profileName;
private String imageUrl;
private boolean isBlocked;
private LocalDateTime lastSeenTime;
private String contact_displayId;
public ContactEntry(UUID contactId, String userId, String profileName, String imageUrl, boolean isBlocked) {
this.contactId = contactId;
this.userId = userId;
@@ -20,13 +22,14 @@ public class ContactEntry {
this.isBlocked = isBlocked;
}
public ContactEntry(UUID contactId, String userId,String contact_displayId , String profileName, String imageUrl, boolean isBlocked){
public ContactEntry(UUID contactId, String userId,String contact_displayId , String profileName, String imageUrl, boolean isBlocked, LocalDateTime lastSeenTime){
this.contactId = contactId;
this.userId = userId;
this.contact_displayId = contact_displayId;
this.profileName = profileName;
this.imageUrl = imageUrl;
this.isBlocked = isBlocked;
this.lastSeenTime = lastSeenTime;
}
public UUID getContactId() {
@@ -49,9 +52,25 @@ public class ContactEntry {
return isBlocked;
}
public LocalDateTime getLastSeenTime() {
return lastSeenTime;
}
public void setLastSeenTime(LocalDateTime lastSeenTime) {
this.lastSeenTime = lastSeenTime;
}
public String getContact_displayId() {
return contact_displayId;
}
public void setContact_displayId(String contact_displayId) {
this.contact_displayId = contact_displayId;
}
@Override
public String toString() {
return profileName + " ( @" + contact_displayId + ")" + (isBlocked ? " [Blocked]" : "");
return profileName + " (@" + contact_displayId + ")" + (isBlocked ? " [Blocked]" : "") + " Last Seen:" + (lastSeenTime != null ? " " + lastSeenTime.toString() : "");
}
@@ -185,7 +185,7 @@ public class JsonUtil {
obj.put("last_message_time", entry.getLastMessageTime() == null ? JSONObject.NULL : entry.getLastMessageTime().toString());
obj.put("is_owner", entry.isOwner());
obj.put("is_admin", entry.isAdmin());
obj.put("is_saved_messages", entry.isSavedMessages());
jsonArray.put(obj);
}
@@ -16,15 +16,14 @@ public class Message {
private String status;
private UUID reply_to_id;
private boolean is_edited;
private boolean is_deleted_globally;
private UUID original_message_id;
private UUID forwarded_by;
private UUID forwarded_from;
private List<FileAttachment> attachments;
private boolean is_deleted_globally;
private LocalDateTime edited_at;
private transient String sender_name;
private transient String receiver_name;
private LocalDateTime edited_at;
// ✅ Full Constructor
@@ -69,6 +68,7 @@ public class Message {
this.edited_at = edited_at;
}
// ✅ Short Constructors
//for normal messages
public Message(UUID messageId, UUID senderId, UUID receiverId, String receiverType,
@@ -190,13 +190,24 @@ public class Message {
this.receiver_name = receiver_name;
}
public LocalDateTime getEdited_at() {
return edited_at;
}
public LocalDateTime getEdited_at() {
return edited_at;
}
public void setEdited_at(LocalDateTime edited_at) {
this.edited_at = edited_at;
}
public boolean getIs_deleted_globally() {
return is_deleted_globally;
}
//
// public void setEdited_at(LocalDateTime edited_at) {
// this.edited_at = edited_at;
// }
//
// public LocalDateTime getEdited_at() {
// return edited_at;
// }
}
@@ -2,7 +2,7 @@ package org.to.telegramfinalproject.Models;
public class SearchResultModel {
private final String type;
private final String id; // ← UUID واقعی برای عملیات
private final String id; // ← UUID
private final String displayId; // ← user_id یا group_id برای نمایش
private String name;
private final String content;
@@ -22,12 +22,14 @@ public class User {
private List<Message> unreadMessages;
private List<ChatEntry> chatList;
public User(String user_id, UUID internal_uuid, String username, String password, String profile_name) {
public User(String user_id, UUID internal_uuid, String username, String password, String profile_name, String bio, String image_url) {
this.user_id = user_id;
this.internal_uuid = internal_uuid;
this.username = username;
this.password = password;
this.profile_name = profile_name;
this.bio = bio;
this.image_url = image_url;
}
public void setUser_id(String user_id) {