ios: group chat preview (#235)
This commit is contained in:
parent
8425be0612
commit
7e2f365c1c
@ -45,13 +45,13 @@ struct ChatPreview: Identifiable, Codable {
|
||||
|
||||
enum ChatInfo: Identifiable, Codable {
|
||||
case direct(contact: Contact)
|
||||
// case group()
|
||||
case group(groupInfo: GroupInfo)
|
||||
|
||||
var displayName: String {
|
||||
get {
|
||||
switch self {
|
||||
case let .direct(contact): return "@\(contact.localDisplayName)"
|
||||
// case let .group(groupInfo, _): return "#\(groupInfo.localDisplayName)"
|
||||
case let .group(groupInfo): return "#\(groupInfo.localDisplayName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ enum ChatInfo: Identifiable, Codable {
|
||||
get {
|
||||
switch self {
|
||||
case let .direct(contact): return "@\(contact.contactId)"
|
||||
// case let .group(contact): return group.id
|
||||
case let .group(groupInfo): return "#\(groupInfo.groupId)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ enum ChatInfo: Identifiable, Codable {
|
||||
get {
|
||||
switch self {
|
||||
case .direct(_): return "direct"
|
||||
// case let .group(_): return "group"
|
||||
case .group(_): return "group"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ enum ChatInfo: Identifiable, Codable {
|
||||
get {
|
||||
switch self {
|
||||
case let .direct(contact): return contact.contactId
|
||||
// case let .group(contact): return group.id
|
||||
case let .group(groupInfo): return groupInfo.groupId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,16 +18,30 @@ struct ChatPreviewView: View {
|
||||
|
||||
struct ChatPreviewView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ChatPreviewView(chatPreview: ChatPreview(
|
||||
chatInfo: .direct(contact: Contact(
|
||||
contactId: 123,
|
||||
localDisplayName: "ep",
|
||||
profile: Profile(
|
||||
displayName: "ep",
|
||||
fullName: "Ep"
|
||||
),
|
||||
viaGroup: nil
|
||||
Group{
|
||||
ChatPreviewView(chatPreview: ChatPreview(
|
||||
chatInfo: .direct(contact: Contact(
|
||||
contactId: 123,
|
||||
localDisplayName: "ep",
|
||||
profile: Profile(
|
||||
displayName: "ep",
|
||||
fullName: "Ep"
|
||||
),
|
||||
viaGroup: nil
|
||||
))
|
||||
))
|
||||
))
|
||||
|
||||
ChatPreviewView(chatPreview: ChatPreview(
|
||||
chatInfo: .group(groupInfo: GroupInfo(
|
||||
groupId: 123,
|
||||
localDisplayName: "team",
|
||||
groupProfile: GroupProfile(
|
||||
displayName: "team",
|
||||
fullName: "My Team"
|
||||
)
|
||||
))
|
||||
))
|
||||
}
|
||||
.previewLayout(.fixed(width: 300, height: 70))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user