android: UI for pending contact connections, ios: translations, show profile picture in contact requests (#571)

* android: UI for pending contact connections, ios: translations, show profile picture in contact requests

* update translations

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>

* update translation

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
This commit is contained in:
Evgeny Poberezkin
2022-04-26 07:41:08 +01:00
committed by GitHub
parent cd2eb9c88e
commit 44de6297ee
20 changed files with 505 additions and 67 deletions

View File

@@ -713,8 +713,10 @@ func processReceivedMsg(_ res: ChatResponse) {
m.terminalItems.append(.resp(.now, res))
logger.debug("processReceivedMsg: \(res.responseType)")
switch res {
case let .newContactConnection(contactConnection):
m.updateContactConnection(contactConnection)
case let .newContactConnection(connection):
m.updateContactConnection(connection)
case let .contactConnectionDeleted(connection):
m.removeChat(connection.id)
case let .contactConnected(contact):
m.updateContact(contact)
m.removeChat(contact.activeConn.id)
@@ -961,6 +963,7 @@ enum StoreError: Decodable {
case fileNotFound(fileId: Int64)
case rcvFileInvalid(fileId: Int64)
case connectionNotFound(agentConnId: String)
case pendingConnectionNotFound(connId: Int64)
case introNotFound
case uniqueID
case internalError(message: String)
@@ -969,6 +972,7 @@ enum StoreError: Decodable {
case chatItemNotFound(itemId: Int64)
case quotedChatItemNotFound
case chatItemSharedMsgIdNotFound(sharedMsgId: String)
case chatItemNotFoundByFileId(fileId: Int64)
}
enum AgentErrorType: Decodable {

View File

@@ -108,7 +108,7 @@ struct ChatListNavLink: View {
}
private func contactRequestNavLink(_ contactRequest: UserContactRequest) -> some View {
ContactRequestView(contactRequest: contactRequest)
ContactRequestView(contactRequest: contactRequest, chat: chat)
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
Button { Task { await acceptContactRequest(contactRequest) } }
label: { Label("Accept", systemImage: "checkmark") }

View File

@@ -10,14 +10,12 @@ import SwiftUI
struct ContactRequestView: View {
var contactRequest: UserContactRequest
@ObservedObject var chat: Chat
var body: some View {
return HStack(spacing: 8) {
Image(systemName: "person.crop.circle.fill")
.resizable()
.foregroundColor(Color(uiColor: .secondarySystemBackground))
ChatInfoImage(chat: chat)
.frame(width: 63, height: 63)
.padding(.leading, 4)
VStack(alignment: .leading, spacing: 4) {
HStack(alignment: .top) {
Text(contactRequest.chatViewName)
@@ -47,7 +45,7 @@ struct ContactRequestView: View {
struct ContactRequestView_Previews: PreviewProvider {
static var previews: some View {
ContactRequestView(contactRequest: UserContactRequest.sampleData)
ContactRequestView(contactRequest: UserContactRequest.sampleData, chat: Chat(chatInfo: ChatInfo.sampleData.contactRequest , chatItems: []))
.previewLayout(.fixed(width: 360, height: 80))
}
}

View File

@@ -17,6 +17,7 @@ struct ChatInfoImage: View {
switch chat.chatInfo {
case .direct: iconName = "person.crop.circle.fill"
case .group: iconName = "person.2.circle.fill"
case .contactRequest: iconName = "person.crop.circle.fill"
default: iconName = "circle.fill"
}
return ProfileImage(