Merge branch '1.11.19' into voice-calls-2

pull/560/head
Ryan Zhao 3 years ago
commit a8dd010b06

@ -794,6 +794,8 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
requestMicrophonePermissionIfNeeded() { [weak self] in
self?.cancelVoiceMessageRecording()
}
// Keep screen on
UIApplication.shared.isIdleTimerDisabled = false
guard AVAudioSession.sharedInstance().recordPermission == .granted else { return }
// Cancel any current audio playback
audioPlayer?.stop()
@ -842,6 +844,7 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
}
func endVoiceMessageRecording() {
UIApplication.shared.isIdleTimerDisabled = true
// Hide the UI
snInputView.hideVoiceMessageUI()
// Cancel the timer

@ -593,7 +593,11 @@ class PhotoCaptureOutputAdaptee: NSObject, ImageCaptureOutput {
@available(iOS 11.0, *)
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
let data = photo.fileDataRepresentation()!
var data = photo.fileDataRepresentation()!
// Call normalized here to fix the orientation
if let srcImage = UIImage(data: data) {
data = srcImage.normalized().jpegData(compressionQuality: 1.0)!
}
DispatchQueue.main.async {
self.delegate?.captureOutputDidFinishProcessing(photoData: data, error: error)
}

@ -233,12 +233,12 @@ extension MessageReceiver {
// MARK: - Unsend Requests
public static func handleUnsendRequest(_ message: UnsendRequest, using transaction: Any) {
guard message.sender == message.author else { return }
let userPublicKey = getUserHexEncodedPublicKey()
guard message.sender == message.author || userPublicKey == message.sender else { return }
let transaction = transaction as! YapDatabaseReadWriteTransaction
if let author = message.author, let timestamp = message.timestamp {
let localMessage: TSMessage?
if userPublicKey == message.sender {
if userPublicKey == author {
localMessage = TSOutgoingMessage.find(withTimestamp: timestamp)
} else {
localMessage = TSIncomingMessage.find(withAuthorId: author, timestamp: timestamp, transaction: transaction)
@ -251,10 +251,14 @@ extension MessageReceiver {
UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: [notificationIdentifier])
}
}
if let serverHash = messageToDelete.serverHash {
SnodeAPI.deleteMessage(publicKey: author, serverHashes: [serverHash]).retainUntilComplete()
if author == message.sender {
if let serverHash = messageToDelete.serverHash {
SnodeAPI.deleteMessage(publicKey: author, serverHashes: [serverHash]).retainUntilComplete()
}
messageToDelete.updateForDeletion(with: transaction)
} else {
messageToDelete.remove(with: transaction)
}
messageToDelete.updateForDeletion(with: transaction)
}
}
}
@ -362,10 +366,12 @@ extension MessageReceiver {
if isMainAppAndActive {
cancelTypingIndicatorsIfNeeded(for: message.sender!)
}
// Keep track of the open group server message ID message ID relationship
if let serverID = message.openGroupServerMessageID, let tsMessage = TSMessage.fetch(uniqueId: tsMessageID, transaction: transaction) {
tsMessage.openGroupServerMessageID = serverID
tsMessage.save(with: transaction)
if let tsMessage = TSMessage.fetch(uniqueId: tsMessageID, transaction: transaction) {
// Keep track of the open group server message ID message ID relationship
if let serverID = message.openGroupServerMessageID { tsMessage.openGroupServerMessageID = serverID }
// Keep track of server hash
if let serverHash = message.serverHash { tsMessage.serverHash = serverHash }
tsMessage.save(with: transaction)
}
if let tsOutgoingMessage = TSMessage.fetch(uniqueId: tsMessageID, transaction: transaction) as? TSOutgoingMessage,
let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) {

@ -166,7 +166,7 @@ public class ImageEditorCanvasView: UIView {
// of code simplicity. We could modify the image layer's
// transform to handle the normalization, which would
// have perf benefits.
return srcImage.normalized()
return srcImage
}
// MARK: - Content

Loading…
Cancel
Save