Video avatar fixes

This commit is contained in:
Ilya Laktyushin
2020-07-10 15:41:51 +03:00
parent 688d692993
commit ab41dbe22a
10 changed files with 104 additions and 64 deletions

View File

@@ -625,12 +625,10 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId]
context.account.postbox.mediaBox.storeResourceData(photoResource.id, data: data)
}
updateState { state in
var state = state
state.avatar = .image(representation, false)
return state
if let timestamp = videoStartTimestamp {
videoStartTimestamp = max(0.0, min(timestamp, result.duration))
}
var value = stat()
if stat(result.fileURL.path, &value) == 0 {
if let data = try? Data(contentsOf: result.fileURL) {
@@ -671,6 +669,14 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId]
} else {
return .single(nil)
}
} |> afterNext { next in
if let next = next, next.isCompleted {
updateState { state in
var state = state
state.avatar = .image(representation, false)
return state
}
}
})
uploadedVideoAvatar = (promise, videoStartTimestamp)
}