android: rcv & snd files progress, distinguish XFTP and SMP; ios: files UI improvements (#2096)

This commit is contained in:
spaced4ndy
2023-03-29 15:48:00 +04:00
committed by GitHub
parent 67961180c9
commit 08dd321311
11 changed files with 145 additions and 52 deletions

View File

@@ -56,7 +56,7 @@ struct CIFileView: View {
case .sndComplete: return false
case .sndCancelled: return false
case .rcvInvitation: return true
case .rcvAccepted: return file.isSMP
case .rcvAccepted: return true
case .rcvTransfer: return false
case .rcvComplete: return true
case .rcvCancelled: return false
@@ -92,7 +92,13 @@ struct CIFileView: View {
)
}
case .rcvAccepted:
if file.isSMP {
switch file.fileProtocol {
case .xftp:
AlertManager.shared.showAlertMsg(
title: "Waiting for file",
message: "File will be received when your contact completes uploading it."
)
case .smp:
AlertManager.shared.showAlertMsg(
title: "Waiting for file",
message: "File will be received when your contact is online, please wait or check later!"
@@ -112,7 +118,11 @@ struct CIFileView: View {
@ViewBuilder private func fileIndicator() -> some View {
if let file = file {
switch file.fileStatus {
case .sndStored: fileIcon("doc.fill")
case .sndStored:
switch file.fileProtocol {
case .xftp: progressView()
case .smp: fileIcon("doc.fill")
}
case let .sndTransfer(sndProgress, sndTotal):
switch file.fileProtocol {
case .xftp: progressCircle(sndProgress, sndTotal)
@@ -169,7 +179,7 @@ struct CIFileView: View {
Circle()
.trim(from: 0, to: Double(progress) / Double(total))
.stroke(
Color.accentColor,
Color(uiColor: .tertiaryLabel),
style: StrokeStyle(lineWidth: 3)
)
.rotationEffect(.degrees(-90))

View File

@@ -41,7 +41,13 @@ struct CIImageView: View {
// TODO image accepted alert?
}
case .rcvAccepted:
if file.isSMP {
switch file.fileProtocol {
case .xftp:
AlertManager.shared.showAlertMsg(
title: "Waiting for image",
message: "Image will be received when your contact completes uploading it."
)
case .smp:
AlertManager.shared.showAlertMsg(
title: "Waiting for image",
message: "Image will be received when your contact is online, please wait or check later!"
@@ -79,6 +85,11 @@ struct CIImageView: View {
@ViewBuilder private func loadingIndicator() -> some View {
if let file = chatItem.file {
switch file.fileStatus {
case .sndStored:
switch file.fileProtocol {
case .xftp: progressView()
case .smp: EmptyView()
}
case .sndTransfer:
progressView()
case .sndComplete: