MESSENGER Release 1.24.0

This commit is contained in:
Frank Rotermund
2022-09-19 12:43:14 +02:00
parent a194ac2fe7
commit 1550ee2a9a
17 changed files with 143 additions and 13 deletions
@@ -70,6 +70,11 @@ class VoiceMessagePlaybackController: VoiceMessageAudioPlayerDelegate, VoiceMess
NotificationCenter.default.addObserver(self, selector: #selector(updateTheme), name: .themeServiceDidChangeTheme, object: nil)
updateTheme()
updateUI()
if BwiBuildSettings.bwiResignPlayingVoiceMessageInBackground {
NotificationCenter.default.addObserver(self, selector: #selector(appMovedToBackground), name: UIApplication.willResignActiveNotification, object: nil)
}
}
var attachment: MXKAttachment? {
@@ -219,4 +224,17 @@ class VoiceMessagePlaybackController: VoiceMessageAudioPlayerDelegate, VoiceMess
@objc private func updateTheme() {
playbackView.update(theme: ThemeService.shared().theme)
}
// bwi: resign voice playing in background
@objc func appMovedToBackground() {
guard let audioPlayer = audioPlayer else {
return
}
if audioPlayer.url != nil {
if audioPlayer.isPlaying {
audioPlayer.stop()
}
}
}
}