Remove all prints (replaced by Logs)

This commit is contained in:
Benoit Martins 2023-05-09 15:18:46 +02:00 committed by QuentinArguillere
parent 01fe584083
commit cd9778b3a1
9 changed files with 37 additions and 39 deletions

View file

@ -72,7 +72,7 @@ enum NetworkType: Int {
Log.directLog(BCTBX_LOG_MESSAGE, text: "File :\(file) removed")
} catch {
print("Could not remove file : \(file) \(error)")
Log.e("Could not remove file : \(file) \(error)")
}
}

View file

@ -272,7 +272,7 @@ import AVFoundation
// for outgoing call. There is not yet callId
@objc func startCall(addr: OpaquePointer?, isSas: Bool, isVideo: Bool, isConference: Bool = false) {
if (addr == nil) {
print("Can not start a call with null address!")
Log.i("Can not start a call with null address!")
return
}

View file

@ -322,7 +322,7 @@ class ChatConversationViewModel: ControlsViewModel {
result = formattedDuration(linphonePlayer.duration)!
linphonePlayer.close()
}catch{
print(error)
Log.e(error.localizedDescription)
}
return result
}
@ -440,7 +440,7 @@ class ChatConversationViewModel: ControlsViewModel {
ChatConversationViewModel.sharedModel.urlFile.append(url)
DispatchQueue.main.async(execute: ChatConversationViewModel.sharedModel.workItem!)
}catch let error{
print(error.localizedDescription)
Log.e(error.localizedDescription)
}
}
}
@ -466,7 +466,7 @@ class ChatConversationViewModel: ControlsViewModel {
return otherFileImage!
}
}catch let error{
print(error.localizedDescription)
Log.e(error.localizedDescription)
}
}
return UIImage(named: "chat_error")!
@ -493,7 +493,7 @@ class ChatConversationViewModel: ControlsViewModel {
p.fileFormat = RecorderFileFormat.Mkv
ChatConversationViewModel.sharedModel.voiceRecorder = try core.createRecorder(params: p)
}catch{
print(error)
Log.e(error.localizedDescription)
}
}
@ -511,11 +511,11 @@ class ChatConversationViewModel: ControlsViewModel {
let filename = "\(String(describing: LinphoneManager.imagesDirectory()))/voice-recording-\(UUID().uuidString).mkv"
linphone_recorder_open(voiceRecorder?.getCobject, filename)
linphone_recorder_start(voiceRecorder?.getCobject)
print("[Chat Message Sending] Recorder is closed opening it with \(filename)")
Log.i("[Chat Message Sending] Recorder is closed opening it with \(filename)")
case LinphoneRecorderRunning:
print("[Chat Message Sending] Recorder is already recording")
Log.i("[Chat Message Sending] Recorder is already recording")
case LinphoneRecorderPaused:
print("[Chat Message Sending] Recorder isn't closed, resuming recording")
Log.i("[Chat Message Sending] Recorder isn't closed, resuming recording")
linphone_recorder_start(voiceRecorder?.getCobject)
default:
break
@ -524,7 +524,7 @@ class ChatConversationViewModel: ControlsViewModel {
func stopVoiceRecording() {
if (ChatConversationViewModel.sharedModel.voiceRecorder != nil) && linphone_recorder_get_state(ChatConversationViewModel.sharedModel.voiceRecorder?.getCobject) == LinphoneRecorderRunning {
print("[Chat Message Sending] Pausing / closing voice recorder")
Log.i("[Chat Message Sending] Pausing / closing voice recorder")
linphone_recorder_pause(ChatConversationViewModel.sharedModel.voiceRecorder?.getCobject)
linphone_recorder_close(ChatConversationViewModel.sharedModel.voiceRecorder?.getCobject)
}
@ -559,10 +559,10 @@ class ChatConversationViewModel: ControlsViewModel {
if (filePath != nil) {
if (filePath != "") {
do {
print("[vfs] remove item at \(filePath)")
Log.i("[vfs] remove item at \(filePath)")
try FileManager.default.removeItem(atPath: filePath!)
}catch{
print("[vfs] remove item error")
Log.e("[vfs] remove item error")
}
}
}

View file

@ -270,7 +270,6 @@ class ChatConversationTableViewSwift: UIViewController, UICollectionViewDataSour
menu!.show()
menu!.selectionAction = { [weak self] (index: Int, item: String) in
guard let _ = self else { return }
print(item)
switch item {
case VoipTexts.bubble_chat_dropDown_resend:
self!.resendMessage(message: event.chatMessage!)
@ -287,7 +286,7 @@ class ChatConversationTableViewSwift: UIViewController, UICollectionViewDataSour
case VoipTexts.bubble_chat_dropDown_delete:
self!.deleteMessage(message: event.chatMessage!)
default:
print("Error Default")
Log.e("Error Default tapChooseMenuItemMessage ChatConversationTableViewSwift")
}
self!.menu!.clearSelection()
}
@ -446,7 +445,7 @@ class ChatConversationTableViewSwift: UIViewController, UICollectionViewDataSour
let state = chatMessage.state
if (state.rawValue == LinphoneChatMessageStateNotDelivered.rawValue) {
print("Messsage not delivered")
Log.i("Messsage not delivered")
} else {
if (VFSUtil.vfsEnabled(groupName: kLinphoneMsgNotificationAppGroupId) || ConfigManager.instance().lpConfigBoolForKey(key: "use_in_app_file_viewer_for_non_encrypted_files", section: "app")){
let view: ImageView = VIEW(ImageView.compositeViewDescription())
@ -497,7 +496,7 @@ class ChatConversationTableViewSwift: UIViewController, UICollectionViewDataSour
let chatMessage = ChatConversationTableViewModel.sharedModel.getMessage(index: indexMessage)?.chatMessage
let state = chatMessage!.state
if (state.rawValue == LinphoneChatMessageStateNotDelivered.rawValue) {
print("Messsage not delivered")
Log.i("Messsage not delivered")
} else {
if (VFSUtil.vfsEnabled(groupName: kLinphoneMsgNotificationAppGroupId) || ConfigManager.instance().lpConfigBoolForKey(key: "use_in_app_file_viewer_for_non_encrypted_files", section: "app")){
let view: ImageView = VIEW(ImageView.compositeViewDescription())

View file

@ -304,7 +304,6 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll
menu.show()
menu.selectionAction = { [weak self] (index: Int, item: String) in
guard let _ = self else { return }
print(item)
switch item {
case VoipTexts.dropdown_menu_chat_conversation_add_to_contact:
self!.addOrGoToContact()
@ -739,7 +738,7 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll
@objc class func writeFileInImagesDirectory(_ data: Data?, name: String?) {
let filePath = URL(fileURLWithPath: LinphoneManager.imagesDirectory()).appendingPathComponent(name ?? "").path
if name != nil || (name == "") {
print("try to write file in \(filePath)")
Log.i("try to write file in \(filePath)")
}
FileManager.default.createFile(
atPath: filePath,
@ -1150,7 +1149,7 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll
ChatConversationViewModel.sharedModel.createCollectionViewItem(urlFile: videoUrl, type: "public.movie")
default:
print("Mismatched type: \(mediaType)")
Log.i("Mismatched type: \(mediaType)")
}
picker.dismiss(animated: true, completion: nil)
}
@ -1240,7 +1239,7 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll
try startFileUpload(data, withName: fileName, rootMessage: ChatConversationViewModel.sharedModel.chatRoom?.createEmptyMessage())
}
}catch{
print(error)
Log.e(error.localizedDescription)
}
}
@ -1309,7 +1308,7 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll
func voiceRecordTimerUpdate() {
let recorderDuration = linphone_recorder_get_duration(ChatConversationViewModel.sharedModel.voiceRecorder?.getCobject)
if recorderDuration > LinphoneManager.instance().lpConfigInt(forKey: "voice_recording_max_duration", withDefault: 59999) {
print("[Chat Message Sending] Max duration for voice recording exceeded, stopping. (max = %d)", LinphoneManager.instance().lpConfigInt(forKey: "voice_recording_max_duration", withDefault: 59999))
Log.i("[Chat Message Sending] Max duration for voice recording exceeded, stopping. (max = %d)", LinphoneManager.instance().lpConfigInt(forKey: "voice_recording_max_duration", withDefault: 59999))
stopVoiceRecording()
} else {
recordingDurationTextView.text = ChatConversationViewModel.sharedModel.formattedDuration(Int(linphone_recorder_get_duration(ChatConversationViewModel.sharedModel.voiceRecorder?.getCobject)))

View file

@ -1181,7 +1181,7 @@ class MultilineMessageCell: UICollectionViewCell, UICollectionViewDataSource, UI
result = formattedDuration(linphonePlayer.duration)!
linphonePlayer.close()
}catch{
print(error)
Log.e(error.localizedDescription)
}
return result
}

View file

@ -54,7 +54,7 @@ import linphonesw
do {
try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)
} catch {
print(error)
Log.e(error.localizedDescription)
}
}
}
@ -79,7 +79,7 @@ import linphonesw
return false
}
} catch {
print(error)
Log.e(error.localizedDescription)
return false
}
}
@ -88,25 +88,25 @@ import linphonesw
do {
try string.write(to: URL(fileURLWithPath:toPath), atomically: true, encoding: String.Encoding.utf8)
} catch {
print(error)
Log.e(error.localizedDescription)
}
}
public class func delete(path:String) {
do {
try FileManager.default.removeItem(atPath: path)
print("FIle \(path) was removed")
Log.i("FIle \(path) was removed")
} catch {
print("Error deleting file at path \(path) error is \(error)")
Log.e("Error deleting file at path \(path) error is \(error)")
}
}
public class func mkdir(path:String) {
do {
try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)
print("Dir \(path) was created")
Log.i("Dir \(path) was created")
} catch {
print("Error creating dir at path \(path) error is \(error)")
Log.e("Error creating dir at path \(path) error is \(error)")
}
}
@ -119,7 +119,7 @@ import linphonesw
}
try FileManager.default.copyItem(at: URL(fileURLWithPath:fromPath), to: URL(fileURLWithPath:toPath))
} catch {
print(error)
Log.e(error.localizedDescription)
}
}
@ -132,7 +132,7 @@ import linphonesw
let fileURLs = try fileManager.contentsOfDirectory(at: FileUtil.sharedContainerUrl(appGroupName: appGroupName), includingPropertiesForKeys: nil)
fileURLs.forEach{print($0)}
} catch {
print("Error while enumerating files \(error.localizedDescription)")
Log.e("Error while enumerating files \(error.localizedDescription)")
}
}

View file

@ -21,7 +21,7 @@ class AudioPlayer: ControlsViewModel {
}
static func initSharedPlayer(){
print("[Voice Message] Creating shared player")
Log.i("[Voice Message] Creating shared player")
let core = Core.getSwiftObject(cObject: LinphoneManager.getLc())
do{
@ -29,14 +29,14 @@ class AudioPlayer: ControlsViewModel {
linphonePlayer = try core.createLocalPlayer(soundCardName: CallManager.instance().getSpeakerSoundCard(), videoDisplayName: nil, windowId: nil)
}
}catch{
print(error)
Log.e(error.localizedDescription)
}
}
static func startSharedPlayer(_ path: String?) {
print("[Voice Message] Starting shared player path = \(String(describing: path))")
Log.i("[Voice Message] Starting shared player path = \(String(describing: path))")
if ((linphonePlayer!.userData) != nil) {
print("[Voice Message] a play was requested (\(String(describing: path)), but there is already one going (\(String(describing: linphonePlayer?.userData))")
Log.i("[Voice Message] a play was requested (\(String(describing: path)), but there is already one going (\(String(describing: linphonePlayer?.userData))")
let userInfo = [
"path": linphonePlayer!.userData
]
@ -47,7 +47,7 @@ class AudioPlayer: ControlsViewModel {
try linphonePlayer?.open(filename: path!)
try linphonePlayer?.start()
}catch{
print("error")
Log.e(error.localizedDescription)
}
}
@ -59,14 +59,14 @@ class AudioPlayer: ControlsViewModel {
}
static func stopSharedPlayer() {
print("[Voice Message] Stopping shared player path = \(String(describing: linphonePlayer?.userData))")
Log.i("[Voice Message] Stopping shared player path = \(String(describing: linphonePlayer?.userData))")
do{
try linphonePlayer?.pause()
try linphonePlayer?.seek(timeMs: 0)
//linphonePlayer?.close()
linphonePlayer?.userData = nil
}catch{
print(error)
Log.e(error.localizedDescription)
}
}
}

View file

@ -104,7 +104,7 @@ import os
}
var error: Unmanaged<CFError>?
guard let clearTextData = SecKeyCreateDecryptedData(key,algorithm,Data(base64Encoded: encryptedText)! as CFData,&error) as Data? else {
print("[VFS] failed deciphering data \(String(describing: error))")
Log.e("[VFS] failed deciphering data \(String(describing: error))")
return nil
}
return String(decoding: clearTextData, as: UTF8.self)