From d3cc7091ac8d27abed73fbd4dab67b474ba20d4c Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Sat, 9 Dec 2023 17:33:40 +0100 Subject: [PATCH 1/7] Alphabetically sort utility files --- Linphone.xcodeproj/project.pbxproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Linphone.xcodeproj/project.pbxproj b/Linphone.xcodeproj/project.pbxproj index 3636ae410..13b8a495f 100644 --- a/Linphone.xcodeproj/project.pbxproj +++ b/Linphone.xcodeproj/project.pbxproj @@ -188,15 +188,15 @@ D717071C2AC591EF0037746F /* Utils */ = { isa = PBXGroup; children = ( - D717071D2AC5922E0037746F /* ColorExtension.swift */, - D717071F2AC5989C0037746F /* TextExtension.swift */, - D76005F52B0798B00054B79A /* IntExtension.swift */, - D74C9D002ACB098C0021626A /* PermissionManager.swift */, - D7D1698B2AE66FA500109A5C /* MagicSearchSingleton.swift */, - D7C3650D2AF15BF200FE6142 /* PhotoPicker.swift */, - D7C48DF32AFA66F900D938CB /* EditContactController.swift */, - D732A9082AFD235500DB42BA /* ShareSheetController.swift */, D7ADF5FF2AFE356400212231 /* Avatar.swift */, + D717071D2AC5922E0037746F /* ColorExtension.swift */, + D7C48DF32AFA66F900D938CB /* EditContactController.swift */, + D76005F52B0798B00054B79A /* IntExtension.swift */, + D7D1698B2AE66FA500109A5C /* MagicSearchSingleton.swift */, + D74C9D002ACB098C0021626A /* PermissionManager.swift */, + D7C3650D2AF15BF200FE6142 /* PhotoPicker.swift */, + D732A9082AFD235500DB42BA /* ShareSheetController.swift */, + D717071F2AC5989C0037746F /* TextExtension.swift */, ); path = Utils; sourceTree = ""; From 50f85649818e258d00db49292f4eb7fd8c739c0d Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Sat, 9 Dec 2023 17:52:45 +0100 Subject: [PATCH 2/7] Add Extensions folder to Utils. Move 'Color', 'Int' and 'Text' extensions inside. Add ConfigExtension and new 'group.org.linphone.phone.logs' app group --- Linphone.xcodeproj/project.pbxproj | 18 +++++- .../{ => Extensions}/ColorExtension.swift | 0 .../Utils/Extensions/ConfigExtension.swift | 64 +++++++++++++++++++ .../Utils/{ => Extensions}/IntExtension.swift | 0 .../{ => Extensions}/TextExtension.swift | 0 5 files changed, 79 insertions(+), 3 deletions(-) rename Linphone/Utils/{ => Extensions}/ColorExtension.swift (100%) create mode 100644 Linphone/Utils/Extensions/ConfigExtension.swift rename Linphone/Utils/{ => Extensions}/IntExtension.swift (100%) rename Linphone/Utils/{ => Extensions}/TextExtension.swift (100%) diff --git a/Linphone.xcodeproj/project.pbxproj b/Linphone.xcodeproj/project.pbxproj index 13b8a495f..6b2d2faa9 100644 --- a/Linphone.xcodeproj/project.pbxproj +++ b/Linphone.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 66C491F92B24D25B00CEA16D /* ConfigExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */; }; D706BA822ADD72D100278F45 /* DeviceRotationViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */; }; D70C93DE2AC2D0F60063CA3B /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */; }; D717071E2AC5922E0037746F /* ColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D717071D2AC5922E0037746F /* ColorExtension.swift */; }; @@ -86,6 +87,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigExtension.swift; sourceTree = ""; }; D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceRotationViewModifier.swift; sourceTree = ""; }; D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; D717071D2AC5922E0037746F /* ColorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = ""; }; @@ -178,6 +180,17 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 66C491F72B24D25A00CEA16D /* Extensions */ = { + isa = PBXGroup; + children = ( + D717071D2AC5922E0037746F /* ColorExtension.swift */, + 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */, + D76005F52B0798B00054B79A /* IntExtension.swift */, + D717071F2AC5989C0037746F /* TextExtension.swift */, + ); + path = Extensions; + sourceTree = ""; + }; A31AF2AB8C6A3D7B7EA3B424 /* Pods */ = { isa = PBXGroup; children = ( @@ -188,15 +201,13 @@ D717071C2AC591EF0037746F /* Utils */ = { isa = PBXGroup; children = ( + 66C491F72B24D25A00CEA16D /* Extensions */, D7ADF5FF2AFE356400212231 /* Avatar.swift */, - D717071D2AC5922E0037746F /* ColorExtension.swift */, D7C48DF32AFA66F900D938CB /* EditContactController.swift */, - D76005F52B0798B00054B79A /* IntExtension.swift */, D7D1698B2AE66FA500109A5C /* MagicSearchSingleton.swift */, D74C9D002ACB098C0021626A /* PermissionManager.swift */, D7C3650D2AF15BF200FE6142 /* PhotoPicker.swift */, D732A9082AFD235500DB42BA /* ShareSheetController.swift */, - D717071F2AC5989C0037746F /* TextExtension.swift */, ); path = Utils; sourceTree = ""; @@ -570,6 +581,7 @@ D7C3650E2AF15BF200FE6142 /* PhotoPicker.swift in Sources */, D7ADF6002AFE356400212231 /* Avatar.swift in Sources */, D71707202AC5989C0037746F /* TextExtension.swift in Sources */, + 66C491F92B24D25B00CEA16D /* ConfigExtension.swift in Sources */, D719ABB92ABC67BF00B41C10 /* ContentView.swift in Sources */, D71FCA832AE14D6E00D2E43E /* ContactFragment.swift in Sources */, D7C3650C2AF0084000FE6142 /* EditContactViewModel.swift in Sources */, diff --git a/Linphone/Utils/ColorExtension.swift b/Linphone/Utils/Extensions/ColorExtension.swift similarity index 100% rename from Linphone/Utils/ColorExtension.swift rename to Linphone/Utils/Extensions/ColorExtension.swift diff --git a/Linphone/Utils/Extensions/ConfigExtension.swift b/Linphone/Utils/Extensions/ConfigExtension.swift new file mode 100644 index 000000000..6576798f3 --- /dev/null +++ b/Linphone/Utils/Extensions/ConfigExtension.swift @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2010-2023 Belledonne Communications SARL. +* +* This file is part of linphone +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + + + +import Foundation +import linphonesw + +// Singleton that manages the Shared Config between app and app extension. + +extension Config { + + private static var _instance : Config? + + public func getDouble(section:String, key:String, defaultValue:Double) -> Double { + if (self.hasEntry(section: section, key: key) != 1) { + return defaultValue + } + let stringValue = self.getString(section: section, key: key, defaultString: "") + return Double(stringValue) ?? defaultValue + } + + public static func get() -> Config { + if _instance == nil { + let factoryPath = FileUtil.bundleFilePath(Core.runsInsideExtension() ? "linphonerc-factory-appex" : "linphonerc-factory-app")! + _instance = Config.newForSharedCore(appGroupId: Config.appGroupName, configFilename: "linphonerc", factoryConfigFilename: factoryPath)! + } + return _instance! + } + + public func getString(section: String, key: String) -> String? { + return hasEntry(section: section, key: key) == 1 ? getString(section: section, key: key, defaultString: "") : nil + } + + // Apple related + static let appGroupName = "group.org.linphone.phone.logs" + // Needs to be the same name in App Group (capabilities in ALL targets - app & extensions - content + service), can't be stored in the Config itself the Config needs this value to get created + static let teamID = Config.get().getString(section: "app", key: "team_id", defaultString: "") + static let earlymediaContentExtensionCagetoryIdentifier = Config.get().getString(section: "app", key: "extension_category", defaultString: "") + + // Default values in app + static let serveraddress = Config.get().getString(section: "app", key: "server", defaultString: "") + static let defaultUsername = Config.get().getString(section: "app", key: "user", defaultString: "") + static let defaultPass = Config.get().getString(section: "app", key: "pass", defaultString: "") + + static let pushNotificationsInterval = Config.get().getInt(section: "net", key: "pn-call-remote-push-interval", defaultValue: 3) + +} diff --git a/Linphone/Utils/IntExtension.swift b/Linphone/Utils/Extensions/IntExtension.swift similarity index 100% rename from Linphone/Utils/IntExtension.swift rename to Linphone/Utils/Extensions/IntExtension.swift diff --git a/Linphone/Utils/TextExtension.swift b/Linphone/Utils/Extensions/TextExtension.swift similarity index 100% rename from Linphone/Utils/TextExtension.swift rename to Linphone/Utils/Extensions/TextExtension.swift From 8e6df8867a7dc3bfcc54181ec82a8b33c720e728 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Sat, 9 Dec 2023 17:54:27 +0100 Subject: [PATCH 3/7] Add CoreExtension --- Linphone.xcodeproj/project.pbxproj | 4 +++ Linphone/Core/CoreExtension.swift | 48 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Linphone/Core/CoreExtension.swift diff --git a/Linphone.xcodeproj/project.pbxproj b/Linphone.xcodeproj/project.pbxproj index 6b2d2faa9..849a2ef13 100644 --- a/Linphone.xcodeproj/project.pbxproj +++ b/Linphone.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 66C491F92B24D25B00CEA16D /* ConfigExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */; }; + 66C491FB2B24D32600CEA16D /* CoreExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FA2B24D32600CEA16D /* CoreExtension.swift */; }; D706BA822ADD72D100278F45 /* DeviceRotationViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */; }; D70C93DE2AC2D0F60063CA3B /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */; }; D717071E2AC5922E0037746F /* ColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D717071D2AC5922E0037746F /* ColorExtension.swift */; }; @@ -88,6 +89,7 @@ /* Begin PBXFileReference section */ 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigExtension.swift; sourceTree = ""; }; + 66C491FA2B24D32600CEA16D /* CoreExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreExtension.swift; sourceTree = ""; }; D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceRotationViewModifier.swift; sourceTree = ""; }; D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; D717071D2AC5922E0037746F /* ColorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = ""; }; @@ -283,6 +285,7 @@ isa = PBXGroup; children = ( D719ABC82ABC6FD700B41C10 /* CoreContext.swift */, + 66C491FA2B24D32600CEA16D /* CoreExtension.swift */, ); path = Core; sourceTree = ""; @@ -627,6 +630,7 @@ D7C48DF62AFCDF4700D938CB /* ContactInnerActionsFragment.swift in Sources */, D72343322ACEFF58009AA24E /* QRScannerController.swift in Sources */, D72343342ACEFFC3009AA24E /* QRScanner.swift in Sources */, + 66C491FB2B24D32600CEA16D /* CoreExtension.swift in Sources */, D726E43D2B19E4FE0083C415 /* StartCallFragment.swift in Sources */, D72343302ACEFEF8009AA24E /* QrCodeScannerFragment.swift in Sources */, D726E43F2B19E56F0083C415 /* StartCallViewModel.swift in Sources */, diff --git a/Linphone/Core/CoreExtension.swift b/Linphone/Core/CoreExtension.swift new file mode 100644 index 000000000..0b0b9f94c --- /dev/null +++ b/Linphone/Core/CoreExtension.swift @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2010-2023 Belledonne Communications SARL. + * + * This file is part of linphone + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + + + +// Core Extension provides a set of utilies to manage automatically a LinphoneCore no matter if it is from App or an extension. +// It is based on a singleton pattern and adds. + +import UIKit +import linphonesw + +struct CoreError: Error { + let message: String + init(_ message: String) { + self.message = message + } + public var localizedDescription: String { + return message + } +} + +extension Core { + + public static func runsInsideExtension() -> Bool { // Tells wether it is run inside app extension or the main app. + let bundleUrl: URL = Bundle.main.bundleURL + let bundlePathExtension: String = bundleUrl.pathExtension + return bundlePathExtension == "appex" + } + +} + From 5b3176c0314641c24b72a6bc06bbcc5f72753a8c Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Sat, 9 Dec 2023 17:55:39 +0100 Subject: [PATCH 4/7] Add AudioRouteUtils --- Linphone.xcodeproj/project.pbxproj | 4 + Linphone/Utils/AudioRouteUtils.swift | 197 +++++++++++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 Linphone/Utils/AudioRouteUtils.swift diff --git a/Linphone.xcodeproj/project.pbxproj b/Linphone.xcodeproj/project.pbxproj index 849a2ef13..2c20f5320 100644 --- a/Linphone.xcodeproj/project.pbxproj +++ b/Linphone.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 66C491F92B24D25B00CEA16D /* ConfigExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */; }; 66C491FB2B24D32600CEA16D /* CoreExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FA2B24D32600CEA16D /* CoreExtension.swift */; }; + 66C491FD2B24D36500CEA16D /* AudioRouteUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */; }; D706BA822ADD72D100278F45 /* DeviceRotationViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */; }; D70C93DE2AC2D0F60063CA3B /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */; }; D717071E2AC5922E0037746F /* ColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D717071D2AC5922E0037746F /* ColorExtension.swift */; }; @@ -90,6 +91,7 @@ /* Begin PBXFileReference section */ 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigExtension.swift; sourceTree = ""; }; 66C491FA2B24D32600CEA16D /* CoreExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreExtension.swift; sourceTree = ""; }; + 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRouteUtils.swift; sourceTree = ""; }; D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceRotationViewModifier.swift; sourceTree = ""; }; D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; D717071D2AC5922E0037746F /* ColorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = ""; }; @@ -204,6 +206,7 @@ isa = PBXGroup; children = ( 66C491F72B24D25A00CEA16D /* Extensions */, + 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */, D7ADF5FF2AFE356400212231 /* Avatar.swift */, D7C48DF32AFA66F900D938CB /* EditContactController.swift */, D7D1698B2AE66FA500109A5C /* MagicSearchSingleton.swift */, @@ -593,6 +596,7 @@ D706BA822ADD72D100278F45 /* DeviceRotationViewModifier.swift in Sources */, D732A9132B04C7A300DB42BA /* HistoryListFragment.swift in Sources */, D719ABC92ABC6FD700B41C10 /* CoreContext.swift in Sources */, + 66C491FD2B24D36500CEA16D /* AudioRouteUtils.swift in Sources */, D7EAACCF2AD6ED8000AA6A8A /* PermissionsFragment.swift in Sources */, D777DBB32AE12C5900565A99 /* ContactsManager.swift in Sources */, D796F2002B0BB61A0041115F /* ToastViewModel.swift in Sources */, diff --git a/Linphone/Utils/AudioRouteUtils.swift b/Linphone/Utils/AudioRouteUtils.swift new file mode 100644 index 000000000..b5812a0e8 --- /dev/null +++ b/Linphone/Utils/AudioRouteUtils.swift @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2010-2023 Belledonne Communications SARL. + * + * This file is part of linphone-android + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +// swiftlint:disable line_length + +import Foundation +import AVFoundation +import linphonesw + +class AudioRouteUtils { + + static private func applyAudioRouteChange( core: Core, call: Call?, types: [AudioDevice.Kind], output: Bool = true) { + let typesNames = types.map { String(describing: $0) }.joined(separator: "/") + + let currentCall = core.callsNb > 0 ? (call != nil) ? call : core.currentCall != nil ? core.currentCall : core.calls[0] : nil + if currentCall == nil { + print("[Audio Route Helper] No call found, setting audio route on Core") + } + let conference = call?.conference + let capability = output ? AudioDevice.Capabilities.CapabilityPlay : AudioDevice.Capabilities.CapabilityRecord + + var found = false + + core.audioDevices.forEach { (audioDevice) in + print("[Audio Route Helper] registered core audio devices are : [\(audioDevice.deviceName)] [\(audioDevice.type)] [\(audioDevice.capabilities)] ") + } + + core.audioDevices.forEach { (audioDevice) in + if !found && types.contains(audioDevice.type) && audioDevice.hasCapability(capability: capability) { + if conference != nil && conference?.isIn == true { + print("[Audio Route Helper] Found [\(audioDevice.type)] \(output ? "playback" : "recorder") audio device [\(audioDevice.deviceName)], routing conference audio to it") + if output { + conference?.outputAudioDevice = audioDevice + } else { + conference?.inputAudioDevice = audioDevice + } + } else if currentCall != nil { + print("[Audio Route Helper] Found [\(audioDevice.type)] \(output ? "playback" : "recorder") audio device [\(audioDevice.deviceName)], routing call audio to it") + if output { + currentCall?.outputAudioDevice = audioDevice + } else { + currentCall?.inputAudioDevice = audioDevice + } + } else { + print("[Audio Route Helper] Found [\(audioDevice.type)] \(output ? "playback" : "recorder") audio device [\(audioDevice.deviceName)], changing core default audio device") + if output { + core.outputAudioDevice = audioDevice + } else { + core.inputAudioDevice = audioDevice + } + } + found = true + } + } + if !found { + print("[Audio Route Helper] Couldn't find \(typesNames) audio device") + } + } + + static private func changeCaptureDeviceToMatchAudioRoute(core: Core, call: Call?, types: [AudioDevice.Kind]) { + switch types.first { + case .Bluetooth: if isBluetoothAudioRecorderAvailable(core: core) { + print("[Audio Route Helper] Bluetooth device is able to record audio, also change input audio device") + applyAudioRouteChange(core: core, call: call, types: [AudioDevice.Kind.Bluetooth], output: false) + } + case .Headset, .Headphones: if isHeadsetAudioRecorderAvailable(core: core) { + print("[Audio Route Helper] Headphones/headset device is able to record audio, also change input audio device") + applyAudioRouteChange(core: core, call: call, types: [AudioDevice.Kind.Headphones, AudioDevice.Kind.Headset], output: false) + } + default: applyAudioRouteChange(core: core, call: call, types: [AudioDevice.Kind.Microphone], output: false) + } + } + + static private func routeAudioTo(core: Core, call: Call?, types: [AudioDevice.Kind]) { + let currentCall = call != nil ? call : core.currentCall != nil ? core.currentCall : (core.callsNb > 0 ? core.calls[0] : nil) + if call != nil || currentCall != nil { + let callToUse = call != nil ? call : currentCall + applyAudioRouteChange(core: core, call: callToUse, types: types) + changeCaptureDeviceToMatchAudioRoute(core: core, call: callToUse, types: types) + } else { + applyAudioRouteChange(core: core, call: call, types: types) + changeCaptureDeviceToMatchAudioRoute(core: core, call: call, types: types) + } + } + + static func routeAudioToEarpiece(core: Core, call: Call? = nil) { + routeAudioTo(core: core, call: call, types: [AudioDevice.Kind.Microphone]) // on iOS Earpiece = Microphone + } + + static func routeAudioToSpeaker(core: Core, call: Call? = nil) { + routeAudioTo(core: core, call: call, types: [AudioDevice.Kind.Speaker]) + } + + static func routeAudioToSpeaker(core: Core) { + routeAudioTo(core: core, call: nil, types: [AudioDevice.Kind.Speaker]) + } + + static func routeAudioToBluetooth(core: Core, call: Call? = nil) { + routeAudioTo(core: core, call: call, types: [AudioDevice.Kind.Bluetooth]) + } + + static func routeAudioToHeadset(core: Core, call: Call? = nil) { + routeAudioTo(core: core, call: call, types: [AudioDevice.Kind.Headphones, AudioDevice.Kind.Headset]) + } + + static func isSpeakerAudioRouteCurrentlyUsed(core: Core, call: Call? = nil) -> Bool { + + let currentCall = core.callsNb > 0 ? (call != nil) ? call : core.currentCall != nil ? core.currentCall : core.calls[0] : nil + if currentCall == nil { + print("[Audio Route Helper] No call found, setting audio route on Core") + } + + let conference = core.conference + let audioDevice = conference != nil && conference?.isIn == true ? conference!.outputAudioDevice : currentCall != nil ? currentCall!.outputAudioDevice : core.outputAudioDevice + print("[Audio Route Helper] Playback audio currently in use is [\(audioDevice?.deviceName ?? "n/a")] with type (\(audioDevice?.type ?? .Unknown)") + return audioDevice?.type == AudioDevice.Kind.Speaker + } + + static func isBluetoothAudioRouteCurrentlyUsed(core: Core, call: Call? = nil) -> Bool { + if core.callsNb == 0 { + print("[Audio Route Helper] No call found, so bluetooth audio route isn't used") + return false + } + let currentCall = call != nil ? call : core.currentCall != nil ? core.currentCall : core.calls[0] + let conference = core.conference + + let audioDevice = conference != nil && conference?.isIn == true ? conference!.outputAudioDevice : currentCall?.outputAudioDevice + print("[Audio Route Helper] Playback audio device currently in use is [\(audioDevice?.deviceName ?? "n/a")] with type (\(audioDevice?.type ?? .Unknown)") + return audioDevice?.type == AudioDevice.Kind.Bluetooth + } + + static func isBluetoothAudioRouteAvailable(core: Core) -> Bool { + if let device = core.audioDevices.first(where: { $0.type == AudioDevice.Kind.Bluetooth && $0.hasCapability(capability: .CapabilityPlay) }) { + print("[Audio Route Helper] Found bluetooth audio device [\(device.deviceName)]") + return true + } + return false + } + + static private func isBluetoothAudioRecorderAvailable(core: Core) -> Bool { + if let device = core.audioDevices.first(where: { $0.type == AudioDevice.Kind.Bluetooth && $0.hasCapability(capability: .CapabilityRecord) }) { + print("[Audio Route Helper] Found bluetooth audio recorder [\(device.deviceName)]") + return true + } + return false + } + + static func isHeadsetAudioRouteAvailable(core: Core) -> Bool { + if let device = core.audioDevices.first(where: { ($0.type == AudioDevice.Kind.Headset||$0.type == AudioDevice.Kind.Headphones) && $0.hasCapability(capability: .CapabilityPlay) }) { + print("[Audio Route Helper] Found headset/headphones audio device [\(device.deviceName)]") + return true + } + return false + } + + static private func isHeadsetAudioRecorderAvailable(core: Core) -> Bool { + if let device = core.audioDevices.first(where: { ($0.type == AudioDevice.Kind.Headset||$0.type == AudioDevice.Kind.Headphones) && $0.hasCapability(capability: .CapabilityRecord) }) { + print("[Audio Route Helper] Found headset/headphones audio recorder [\(device.deviceName)]") + return true + } + return false + } + + static func isReceiverEnabled(core: Core) -> Bool { + if let outputDevice = core.outputAudioDevice { + return outputDevice.type == AudioDevice.Kind.Microphone + } + return false + } + + static func isBluetoothAvailable(core: Core) -> Bool { + for device in core.audioDevices { + if device.type == AudioDevice.Kind.Bluetooth || device.type == AudioDevice.Kind.BluetoothA2DP { + return true + } + } + return false + } + +} +// swiftlint:enable line_length From 52b4bd9f56b35e5d3f0bafdcc3f1fe1242a06b3f Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Sat, 9 Dec 2023 18:16:45 +0100 Subject: [PATCH 5/7] Add FileUtils --- Linphone.xcodeproj/project.pbxproj | 4 + Linphone/Utils/FileUtils.swift | 125 +++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 Linphone/Utils/FileUtils.swift diff --git a/Linphone.xcodeproj/project.pbxproj b/Linphone.xcodeproj/project.pbxproj index 2c20f5320..fca904b83 100644 --- a/Linphone.xcodeproj/project.pbxproj +++ b/Linphone.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 66C491F92B24D25B00CEA16D /* ConfigExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */; }; 66C491FB2B24D32600CEA16D /* CoreExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FA2B24D32600CEA16D /* CoreExtension.swift */; }; 66C491FD2B24D36500CEA16D /* AudioRouteUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */; }; + 66C491FF2B24D4AC00CEA16D /* FileUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FE2B24D4AC00CEA16D /* FileUtils.swift */; }; D706BA822ADD72D100278F45 /* DeviceRotationViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */; }; D70C93DE2AC2D0F60063CA3B /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */; }; D717071E2AC5922E0037746F /* ColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D717071D2AC5922E0037746F /* ColorExtension.swift */; }; @@ -92,6 +93,7 @@ 66C491F82B24D25A00CEA16D /* ConfigExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigExtension.swift; sourceTree = ""; }; 66C491FA2B24D32600CEA16D /* CoreExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreExtension.swift; sourceTree = ""; }; 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRouteUtils.swift; sourceTree = ""; }; + 66C491FE2B24D4AC00CEA16D /* FileUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileUtils.swift; sourceTree = ""; }; D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceRotationViewModifier.swift; sourceTree = ""; }; D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; D717071D2AC5922E0037746F /* ColorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = ""; }; @@ -209,6 +211,7 @@ 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */, D7ADF5FF2AFE356400212231 /* Avatar.swift */, D7C48DF32AFA66F900D938CB /* EditContactController.swift */, + 66C491FE2B24D4AC00CEA16D /* FileUtils.swift */, D7D1698B2AE66FA500109A5C /* MagicSearchSingleton.swift */, D74C9D002ACB098C0021626A /* PermissionManager.swift */, D7C3650D2AF15BF200FE6142 /* PhotoPicker.swift */, @@ -610,6 +613,7 @@ D7B5066D2AEFA9B900CEB4E9 /* ContactInnerFragment.swift in Sources */, D7E6D04D2AEBD77600A57AAF /* CustomBottomSheet.swift in Sources */, D7C48DF42AFA66F900D938CB /* EditContactController.swift in Sources */, + 66C491FF2B24D4AC00CEA16D /* FileUtils.swift in Sources */, D74C9D012ACB098C0021626A /* PermissionManager.swift in Sources */, D7702EF22AC7205000557C00 /* WelcomeView.swift in Sources */, D732A9152B04C7FE00DB42BA /* HistoryListViewModel.swift in Sources */, diff --git a/Linphone/Utils/FileUtils.swift b/Linphone/Utils/FileUtils.swift new file mode 100644 index 000000000..d923462ed --- /dev/null +++ b/Linphone/Utils/FileUtils.swift @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2010-2023 Belledonne Communications SARL. +* +* This file is part of linhome +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +import UIKit +import linphonesw + +class FileUtil: NSObject { + public class func bundleFilePath(_ file: NSString) -> String? { + return Bundle.main.path(forResource: file.deletingPathExtension, ofType: file.pathExtension) + } + + public class func bundleFilePathAsUrl(_ file: NSString) -> URL? { + if let bPath = bundleFilePath(file) { + return URL.init(fileURLWithPath: bPath) + } + return nil + } + + public class func documentsDirectory() -> URL { + let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) + let documentsDirectory = paths[0] + return documentsDirectory + } + + public class func libraryDirectory() -> URL { + let paths = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask) + let documentsDirectory = paths[0] + return documentsDirectory + } + + public class func sharedContainerUrl() -> URL { + return FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Config.appGroupName)! + } + + public class func ensureDirectoryExists(path: String) { + if !FileManager.default.fileExists(atPath: path) { + do { + try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) + } catch { + print(error) + } + } + } + + public class func ensureFileExists(path: String) { + if !FileManager.default.fileExists(atPath: path) { + FileManager.default.createFile(atPath: path, contents: nil, attributes: nil) + } + } + + public class func fileExists(path: String) -> Bool { + return FileManager.default.fileExists(atPath: path) + } + + public class func fileExistsAndIsNotEmpty(path: String) -> Bool { + guard FileManager.default.fileExists(atPath: path) else {return false} + do { + let attribute = try FileManager.default.attributesOfItem(atPath: path) + if let size = attribute[FileAttributeKey.size] as? NSNumber { + return size.doubleValue > 0 + } else { + return false + } + } catch { + print(error) + return false + } + } + + public class func write(string: String, toPath: String) { + do { + try string.write(to: URL(fileURLWithPath: toPath), atomically: true, encoding: String.Encoding.utf8) + } catch { + print(error) + } + } + + public class func delete(path: String) { + do { + try FileManager.default.removeItem(atPath: path) + } catch { + print(error) + } + } + + public class func copy(_ fromPath: String, _ toPath: String, overWrite: Bool) { + do { + if overWrite && fileExists(path: toPath) { + delete(path: toPath) + } + try FileManager.default.copyItem(at: URL(fileURLWithPath: fromPath), to: URL(fileURLWithPath: toPath)) + } catch { + print(error) + } + } + + // For debugging + + public class func showListOfFilesInSharedDir() { + let fileManager = FileManager.default + do { + let fileURLs = try fileManager.contentsOfDirectory(at: FileUtil.sharedContainerUrl(), includingPropertiesForKeys: nil) + fileURLs.forEach { print($0) } + } catch { + print("Error while enumerating files \(error.localizedDescription)") + } + } + +} From 26dd731f84c4ef797a19761417494eeea7b85559 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Sat, 9 Dec 2023 18:34:04 +0100 Subject: [PATCH 6/7] Add Log --- Linphone.xcodeproj/project.pbxproj | 4 + Linphone/Utils/Log.swift | 115 +++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 Linphone/Utils/Log.swift diff --git a/Linphone.xcodeproj/project.pbxproj b/Linphone.xcodeproj/project.pbxproj index fca904b83..e7976994a 100644 --- a/Linphone.xcodeproj/project.pbxproj +++ b/Linphone.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 66C491FB2B24D32600CEA16D /* CoreExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FA2B24D32600CEA16D /* CoreExtension.swift */; }; 66C491FD2B24D36500CEA16D /* AudioRouteUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */; }; 66C491FF2B24D4AC00CEA16D /* FileUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C491FE2B24D4AC00CEA16D /* FileUtils.swift */; }; + 66C492012B24DB6900CEA16D /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66C492002B24DB6900CEA16D /* Log.swift */; }; D706BA822ADD72D100278F45 /* DeviceRotationViewModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */; }; D70C93DE2AC2D0F60063CA3B /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */; }; D717071E2AC5922E0037746F /* ColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D717071D2AC5922E0037746F /* ColorExtension.swift */; }; @@ -94,6 +95,7 @@ 66C491FA2B24D32600CEA16D /* CoreExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreExtension.swift; sourceTree = ""; }; 66C491FC2B24D36500CEA16D /* AudioRouteUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRouteUtils.swift; sourceTree = ""; }; 66C491FE2B24D4AC00CEA16D /* FileUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileUtils.swift; sourceTree = ""; }; + 66C492002B24DB6900CEA16D /* Log.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = ""; }; D706BA812ADD72D100278F45 /* DeviceRotationViewModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceRotationViewModifier.swift; sourceTree = ""; }; D70C93DD2AC2D0F60063CA3B /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; D717071D2AC5922E0037746F /* ColorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = ""; }; @@ -212,6 +214,7 @@ D7ADF5FF2AFE356400212231 /* Avatar.swift */, D7C48DF32AFA66F900D938CB /* EditContactController.swift */, 66C491FE2B24D4AC00CEA16D /* FileUtils.swift */, + 66C492002B24DB6900CEA16D /* Log.swift */, D7D1698B2AE66FA500109A5C /* MagicSearchSingleton.swift */, D74C9D002ACB098C0021626A /* PermissionManager.swift */, D7C3650D2AF15BF200FE6142 /* PhotoPicker.swift */, @@ -629,6 +632,7 @@ D7A03FC62ACC458A0081A588 /* SplashScreen.swift in Sources */, D7A03FC02ACC2E390081A588 /* HistoryView.swift in Sources */, D748BF2E2ACD82E7004844EB /* ThirdPartySipAccountWarningFragment.swift in Sources */, + 66C492012B24DB6900CEA16D /* Log.swift in Sources */, D748BF2C2ACD82D2004844EB /* ThirdPartySipAccountLoginFragment.swift in Sources */, D74C9CF82ACACECE0021626A /* WelcomePage1Fragment.swift in Sources */, D7E6D0552AEBFCCE00A57AAF /* ContactsInnerFragment.swift in Sources */, diff --git a/Linphone/Utils/Log.swift b/Linphone/Utils/Log.swift new file mode 100644 index 000000000..25aecc8e5 --- /dev/null +++ b/Linphone/Utils/Log.swift @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2010-2023 Belledonne Communications SARL. +* +* This file is part of linphone +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ +// swiftlint:disable line_length + +// Singleton instance that logs both info from the App and from the core, using the core log level. ([app] log_level parameter in linphonerc-factory-app + +import UIKit +import os +import linphonesw +import linphone + +class Log: LoggingServiceDelegate { + + static let instance = Log() + + var debugEnabled = true // Todo : bind to app parameters + var service = LoggingService.Instance + + private init() { + service.domain = Bundle.main.bundleIdentifier! + Core.setLogCollectionPath(path: Factory.Instance.getDownloadDir(context: UnsafeMutablePointer(mutating: (Config.appGroupName as NSString).utf8String))) + Core.enableLogCollection(state: LogCollectionState.Enabled) + setMask() + LoggingService.Instance.addDelegate(delegate: self) + + } + + func setMask() { + if debugEnabled { + LoggingService.Instance.logLevelMask = UInt(LogLevel.Fatal.rawValue + LogLevel.Error.rawValue + LogLevel.Warning.rawValue + LogLevel.Message.rawValue + LogLevel.Trace.rawValue + LogLevel.Debug.rawValue) + } else { + LoggingService.Instance.logLevelMask = UInt(LogLevel.Fatal.rawValue + LogLevel.Error.rawValue + LogLevel.Warning.rawValue) + } + } + + let levelToStrings: [Int: String] = + [LogLevel.Debug.rawValue: "Debug" + , LogLevel.Trace.rawValue: "Trace" + , LogLevel.Message.rawValue: "Message" + , LogLevel.Warning.rawValue: "Warning" + , LogLevel.Error.rawValue: "Error" + , LogLevel.Fatal.rawValue: "Fatal"] + + let levelToOSleLogLevel: [Int: OSLogType] = + [LogLevel.Debug.rawValue: .debug, + LogLevel.Trace.rawValue: .info, + LogLevel.Message.rawValue: .info, + LogLevel.Warning.rawValue: .error, + LogLevel.Error.rawValue: .error, + LogLevel.Fatal.rawValue: .fault] + + public class func debug(_ message: String) { + instance.service.debug(message: message) + } + public class func info(_ message: String) { + instance.service.message(message: message) + } + public class func warn(_ message: String) { + instance.service.warning(message: message) + } + public class func error(_ message: String) { + instance.service.error(message: message) + } + public class func fatal(_ message: String) { + instance.service.fatal(message: message) + } + + private func output(_ message: String, _ level: Int, _ domain: String = Bundle.main.bundleIdentifier!) { + let log = "[\(domain)][\(levelToStrings[level] ?? "Unkown")] \(message)\n" + if #available(iOS 10.0, *) { + os_log("%{public}@", type: levelToOSleLogLevel[level] ?? .info,log) + } else { + NSLog(log) + } + } + + + func onLogMessageWritten(logService: linphonesw.LoggingService, domain: String, level: linphonesw.LogLevel, message: String) { + output(message, level.rawValue, domain) + } + + public class func stackTrace() { + Thread.callStackSymbols.forEach{ print($0) } + } + + // Debug + public class func cdlog(_ message: String) { + info("cdes>\(message)") + } + public class func bmlog(_ message: String) { + info("bmar>\(message)") + } + public class func qelog(_ message: String) { + info("qarg>\(message)") + } + +} + +// swiftlint:enable line_length From 8523f110d7f72117ef04f5faa52b6d51be5cd70b Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Sat, 9 Dec 2023 19:27:34 +0100 Subject: [PATCH 7/7] Disable log file collection because of crash, to be fixed --- Linphone/Core/CoreExtension.swift | 4 ---- Linphone/Utils/Extensions/ConfigExtension.swift | 1 - Linphone/Utils/Log.swift | 3 ++- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Linphone/Core/CoreExtension.swift b/Linphone/Core/CoreExtension.swift index 0b0b9f94c..2a448aef4 100644 --- a/Linphone/Core/CoreExtension.swift +++ b/Linphone/Core/CoreExtension.swift @@ -17,9 +17,6 @@ * along with this program. If not, see . */ - - - // Core Extension provides a set of utilies to manage automatically a LinphoneCore no matter if it is from App or an extension. // It is based on a singleton pattern and adds. @@ -45,4 +42,3 @@ extension Core { } } - diff --git a/Linphone/Utils/Extensions/ConfigExtension.swift b/Linphone/Utils/Extensions/ConfigExtension.swift index 6576798f3..3659c3eae 100644 --- a/Linphone/Utils/Extensions/ConfigExtension.swift +++ b/Linphone/Utils/Extensions/ConfigExtension.swift @@ -48,7 +48,6 @@ extension Config { return hasEntry(section: section, key: key) == 1 ? getString(section: section, key: key, defaultString: "") : nil } - // Apple related static let appGroupName = "group.org.linphone.phone.logs" // Needs to be the same name in App Group (capabilities in ALL targets - app & extensions - content + service), can't be stored in the Config itself the Config needs this value to get created static let teamID = Config.get().getString(section: "app", key: "team_id", defaultString: "") diff --git a/Linphone/Utils/Log.swift b/Linphone/Utils/Log.swift index 25aecc8e5..37a088142 100644 --- a/Linphone/Utils/Log.swift +++ b/Linphone/Utils/Log.swift @@ -34,7 +34,8 @@ class Log: LoggingServiceDelegate { private init() { service.domain = Bundle.main.bundleIdentifier! - Core.setLogCollectionPath(path: Factory.Instance.getDownloadDir(context: UnsafeMutablePointer(mutating: (Config.appGroupName as NSString).utf8String))) + // CRASH TO BE FIXED ?? + //Core.setLogCollectionPath(path: Factory.Instance.getDownloadDir(context: UnsafeMutablePointer(mutating: (Config.appGroupName as NSString).utf8String))) Core.enableLogCollection(state: LogCollectionState.Enabled) setMask() LoggingService.Instance.addDelegate(delegate: self)