mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Prevent Audio memo download in service extension + auto download them in app if configured as such
This commit is contained in:
parent
abea256244
commit
776be65518
2 changed files with 35 additions and 1 deletions
|
|
@ -646,6 +646,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource,
|
|||
recordingDurationTextView.text = recordingDuration(filePathRecording)
|
||||
|
||||
recordingPlayButton.onClickAction = {
|
||||
self.downloadAudioMemoIfNeeded(message: message)
|
||||
self.playRecordedMessage(voiceRecorder: filePathRecording, recordingPlayButton: recordingPlayButton, recordingStopButton: recordingStopButton, recordingWaveView: recordingWaveView, message: message)
|
||||
}
|
||||
recordingStopButton.onClickAction = {
|
||||
|
|
@ -661,9 +662,27 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource,
|
|||
NSLayoutConstraint.activate(recordingWaveConstraints)
|
||||
}
|
||||
|
||||
if (Core.get().autoDownloadVoiceRecordingsEnabled) {
|
||||
downloadAudioMemoIfNeeded(message: message)
|
||||
}
|
||||
|
||||
recordingView.isHidden = false
|
||||
}
|
||||
|
||||
func downloadAudioMemoIfNeeded(message: ChatMessage) {
|
||||
if let audioContent = message.contents.filter({$0.isVoiceRecording}).first {
|
||||
if (audioContent.filePath == nil || !FileUtil.fileExistsAndIsNotEmpty(path: audioContent.filePath!)) {
|
||||
audioContent.filePath = LinphoneManager.imagesDirectory() + audioContent.name!;
|
||||
if message.downloadContent(content: audioContent) {
|
||||
Log.i("Started downloading voice memo")
|
||||
} else {
|
||||
Log.i("An error occured downloading voice memo")
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func initReplyView(){
|
||||
//Reply - Contents
|
||||
|
||||
|
|
@ -1806,7 +1825,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource,
|
|||
AudioPlayer.sharedModel.fileChanged.value = voiceRecorder
|
||||
recordingPlayButton.isHidden = true
|
||||
recordingStopButton.isHidden = false
|
||||
|
||||
|
||||
AudioPlayer.startSharedPlayer(voiceRecorder)
|
||||
isPlayingVoiceRecording = true
|
||||
|
||||
|
|
|
|||
|
|
@ -233,6 +233,21 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
NotificationService.logDelegate = try! LinphoneLoggingServiceManager(config: config!, log: NotificationService.log, domain: "msgNotificationService")
|
||||
}
|
||||
lc = try! Factory.Instance.createSharedCoreWithConfig(config: config!, systemContext: nil, appGroupId: APP_GROUP_ID, mainCore: false)
|
||||
|
||||
|
||||
// Disable auto downloads in service extension
|
||||
|
||||
// Save config values
|
||||
let configMaxSizeForAutoDownloadIncomingFiles = config?.getInt(section: "app", key: "auto_download_incoming_files_max_size", defaultValue: -1)
|
||||
let configAutoDownloadVoiceRecordingsEnabled = config?.getBool(section: "app", key: "auto_download_incoming_voice_recordings", defaultValue: true)
|
||||
|
||||
// Disable downloads in service extension (API calls below will set the core attributes value + config)
|
||||
lc?.maxSizeForAutoDownloadIncomingFiles = -1
|
||||
lc?.autoDownloadVoiceRecordingsEnabled = false
|
||||
|
||||
// restore the config values for the app
|
||||
config?.setInt(section: "app", key: "auto_download_incoming_files_max_size", value: configMaxSizeForAutoDownloadIncomingFiles!)
|
||||
config?.setBool(section: "app", key: "auto_download_incoming_voice_recordings", value: configAutoDownloadVoiceRecordingsEnabled!)
|
||||
}
|
||||
|
||||
func stopCore() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue