Merge pull request #96 from loki-project/files

Show Activity Indicator for Proxied File Uploads
pull/98/head
gmbnt 5 years ago committed by GitHub
commit 42a153e6bf

@ -176,7 +176,6 @@ public class ConversationMediaView: UIView {
}
private func addUploadProgressIfNecessary(_ subview: UIView) -> Bool {
guard !isProxied else { return false } // Loki: Due to the way proxying works we can't get upload progress for those attachments right now
guard isOutgoing else { return false }
guard let attachmentStream = attachment as? TSAttachmentStream else { return false }
guard let attachmentId = attachmentStream.uniqueId else {
@ -184,12 +183,18 @@ public class ConversationMediaView: UIView {
configure(forError: .invalid)
return false
}
guard !attachmentStream.isUploaded else {
return false
guard !attachmentStream.isUploaded else { return false }
let view: UIView
if isProxied { // Loki: Due to the way proxying works we can't get upload progress for those attachments
let activityIndicatorView = UIActivityIndicatorView(style: .white)
activityIndicatorView.isHidden = false
activityIndicatorView.startAnimating()
view = activityIndicatorView
} else {
view = MediaUploadView(attachmentId: attachmentId, radius: maxMessageWidth * 0.1)
}
let progressView = MediaUploadView(attachmentId: attachmentId, radius: maxMessageWidth * 0.1)
self.addSubview(progressView)
progressView.autoPinEdgesToSuperviewEdges()
addSubview(view)
view.autoPinEdgesToSuperviewEdges()
return true
}

@ -101,6 +101,8 @@ public class LokiDotNetAPI : NSObject {
}
let isProxyingRequired = (server == LokiFileServerAPI.server) // Don't proxy open group requests for now
if isProxyingRequired {
attachment.isUploaded = false
attachment.save()
let _ = LokiFileServerProxy(for: server).performLokiFileServerNSURLRequest(request as NSURLRequest).done { responseObject in
parseResponse(responseObject)
}.catch { error in

Loading…
Cancel
Save