Fix swiftlint warnings

This commit is contained in:
QuentinArguillere 2024-01-02 17:33:54 +01:00
parent d0ae11c880
commit bcf4eefe35
12 changed files with 20 additions and 26 deletions

View file

@ -262,7 +262,7 @@ final class ContactsManager: ObservableObject {
return imagePath return imagePath
} }
func awaitDataWrite(data: Data, name: String, prefix: String,completion: @escaping ((), String) -> Void) { func awaitDataWrite(data: Data, name: String, prefix: String, completion: @escaping ((), String) -> Void) {
let directory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first let directory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
if directory != nil { if directory != nil {

View file

@ -272,7 +272,7 @@ extension ProviderDelegate: CXProviderDelegate {
// attempt to resume another one. // attempt to resume another one.
action.fulfill() action.fulfill()
} else { } else {
if call?.conference != nil && core.callsNb ?? 0 > 1 {/* if call?.conference != nil && core.callsNb > 1 {/*
try TelecomManager.shared.lc?.enterConference() try TelecomManager.shared.lc?.enterConference()
action.fulfill() action.fulfill()
NotificationCenter.default.post(name: Notification.Name("LinphoneCallUpdate"), object: self) NotificationCenter.default.post(name: Notification.Name("LinphoneCallUpdate"), object: self)

View file

@ -89,7 +89,7 @@ class TelecomManager: ObservableObject {
return return
} }
if TelecomManager.callKitEnabled(core: core) {//&& !nextCallIsTransfer != true { if TelecomManager.callKitEnabled(core: core) {// && !nextCallIsTransfer != true {
let uuid = UUID() let uuid = UUID()
let name = "outgoingTODO" // FastAddressBook.displayName(for: addr) ?? "unknow" let name = "outgoingTODO" // FastAddressBook.displayName(for: addr) ?? "unknow"
let handle = CXHandle(type: .generic, value: addr?.asStringUriOnly() ?? "") let handle = CXHandle(type: .generic, value: addr?.asStringUriOnly() ?? "")
@ -521,9 +521,9 @@ class TelecomManager: ObservableObject {
break break
} }
//AudioRouteUtils.isBluetoothAvailable(core: core) // AudioRouteUtils.isBluetoothAvailable(core: core)
//AudioRouteUtils.isHeadsetAudioRouteAvailable(core: core) // AudioRouteUtils.isHeadsetAudioRouteAvailable(core: core)
//AudioRouteUtils.isBluetoothAudioRouteAvailable(core: core) // AudioRouteUtils.isBluetoothAudioRouteAvailable(core: core)
/* /*
let readyForRoutechange = callkitAudioSessionActivated == nil || (callkitAudioSessionActivated == true) let readyForRoutechange = callkitAudioSessionActivated == nil || (callkitAudioSessionActivated == true)

View file

@ -98,10 +98,8 @@ struct CallView: View {
Button { Button {
options = callViewModel.getAudioRoute() options = callViewModel.getAudioRoute()
print("audioRouteIsSpeakeraudioRouteIsSpeaker output \(AVAudioSession.sharedInstance().currentRoute.outputs)") print("audioRouteIsSpeakeraudioRouteIsSpeaker output \(AVAudioSession.sharedInstance().currentRoute.outputs)")
print("audioRouteIsSpeakeraudioRouteIsSpeaker inputs \(AVAudioSession.sharedInstance().availableInputs?.count)") print("audioRouteIsSpeakeraudioRouteIsSpeaker inputs \(AVAudioSession.sharedInstance().availableInputs?.count)")
if AVAudioSession.sharedInstance().availableInputs != nil if AVAudioSession.sharedInstance().availableInputs != nil
&& !AVAudioSession.sharedInstance().availableInputs!.filter({ $0.portType.rawValue.contains("Bluetooth") }).isEmpty { && !AVAudioSession.sharedInstance().availableInputs!.filter({ $0.portType.rawValue.contains("Bluetooth") }).isEmpty {

View file

@ -98,5 +98,5 @@ struct ContactsListFragment: View {
} }
#Preview { #Preview {
ContactsListFragment(contactViewModel: ContactViewModel(), contactsListViewModel: ContactsListViewModel(), showingSheet: .constant(false), startCallFunc: {addr in }) ContactsListFragment(contactViewModel: ContactViewModel(), contactsListViewModel: ContactsListViewModel(), showingSheet: .constant(false), startCallFunc: {_ in })
} }

View file

@ -66,7 +66,7 @@ class ContactAvatarModel: ObservableObject {
func addSubscription() { func addSubscription() {
friendSuscription = self.friend?.publisher?.onPresenceReceived?.postOnMainQueue { (cbValue: (Friend)) in friendSuscription = self.friend?.publisher?.onPresenceReceived?.postOnMainQueue { (cbValue: (Friend)) in
print("publisherpublisher onLogCollectionUploadStateChanged \(cbValue.address?.asStringUriOnly())") print("publisherpublisher onLogCollectionUploadStateChanged \(cbValue.address?.asStringUriOnly() ?? "")")
self.presenceStatus = cbValue.consolidatedPresence self.presenceStatus = cbValue.consolidatedPresence
if cbValue.consolidatedPresence == .Online || cbValue.consolidatedPresence == .Busy { if cbValue.consolidatedPresence == .Online || cbValue.consolidatedPresence == .Busy {

View file

@ -527,7 +527,7 @@ struct ContentView: View {
showingDialer: $showingDialer showingDialer: $showingDialer
) )
.presentationDetents([.medium]) .presentationDetents([.medium])
//.interactiveDismissDisabled() // .interactiveDismissDisabled()
.presentationBackgroundInteraction(.enabled(upThrough: .medium)) .presentationBackgroundInteraction(.enabled(upThrough: .medium))
} }
} else { } else {
@ -666,10 +666,10 @@ struct ContentView: View {
.transition(.scale.combined(with: .move(edge: .top))) .transition(.scale.combined(with: .move(edge: .top)))
} }
//if sharedMainViewModel.displayToast { // if sharedMainViewModel.displayToast {
ToastView() ToastView()
.zIndex(3) .zIndex(3)
//} // }
} }
} }
.overlay { .overlay {

View file

@ -28,7 +28,7 @@ class HistoryListViewModel: ObservableObject {
var callLogsTmp: [CallLog] = [] var callLogsTmp: [CallLog] = []
var callLogsAddressToDelete = "" var callLogsAddressToDelete = ""
var callLogSubscription : AnyCancellable? var callLogSubscription: AnyCancellable?
init() { init() {
computeCallLogsList() computeCallLogsList()
} }

View file

@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import Foundation import Foundation
import linphonesw import linphonesw
@ -26,10 +24,10 @@ import linphonesw
extension Config { extension Config {
private static var _instance : Config? private static var _instance: Config?
public func getDouble(section:String, key:String, defaultValue:Double) -> Double { public func getDouble(section: String, key: String, defaultValue: Double) -> Double {
if (self.hasEntry(section: section, key: key) != 1) { if self.hasEntry(section: section, key: key) != 1 {
return defaultValue return defaultValue
} }
let stringValue = self.getString(section: section, key: key, defaultString: "") let stringValue = self.getString(section: section, key: key, defaultString: "")
@ -51,7 +49,7 @@ extension Config {
static let appGroupName = "group.org.linphone.phone.logs" 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 // 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 teamID = Config.get().getString(section: "app", key: "team_id", defaultString: "")
static let earlymediaContentExtensionCagetoryIdentifier = Config.get().getString(section: "app", key: "extension_category", defaultString: "") static let earlymediaContentExtCatIdentifier = Config.get().getString(section: "app", key: "extension_category", defaultString: "")
// Default values in app // Default values in app
static let serveraddress = Config.get().getString(section: "app", key: "server", defaultString: "") static let serveraddress = Config.get().getString(section: "app", key: "server", defaultString: "")

View file

@ -84,19 +84,18 @@ class Log: LoggingServiceDelegate {
private func output(_ message: String, _ level: Int, _ domain: String = Bundle.main.bundleIdentifier!) { private func output(_ message: String, _ level: Int, _ domain: String = Bundle.main.bundleIdentifier!) {
let log = "[\(domain)][\(levelToStrings[level] ?? "Unkown")] \(message)\n" let log = "[\(domain)][\(levelToStrings[level] ?? "Unkown")] \(message)\n"
if #available(iOS 10.0, *) { if #available(iOS 10.0, *) {
os_log("%{public}@", type: levelToOSleLogLevel[level] ?? .info,log) os_log("%{public}@", type: levelToOSleLogLevel[level] ?? .info, log)
} else { } else {
NSLog(log) NSLog(log)
} }
} }
func onLogMessageWritten(logService: linphonesw.LoggingService, domain: String, level: linphonesw.LogLevel, message: String) { func onLogMessageWritten(logService: linphonesw.LoggingService, domain: String, level: linphonesw.LogLevel, message: String) {
output(message, level.rawValue, domain) output(message, level.rawValue, domain)
} }
public class func stackTrace() { public class func stackTrace() {
Thread.callStackSymbols.forEach{ print($0) } Thread.callStackSymbols.forEach { print($0) }
} }
// Debug // Debug

View file

@ -41,7 +41,7 @@ final class MagicSearchSingleton: ObservableObject {
@Published var allContact = false @Published var allContact = false
private var domainDefaultAccount = "" private var domainDefaultAccount = ""
var searchSubscription : AnyCancellable? var searchSubscription: AnyCancellable?
private init() { private init() {
coreContext.doOnCoreQueue { core in coreContext.doOnCoreQueue { core in

View file

@ -31,8 +31,7 @@ class PermissionManager: ObservableObject {
private init() {} private init() {}
func getPermissions() {
func getPermissions(){
photoLibraryRequestPermission() photoLibraryRequestPermission()
cameraRequestPermission() cameraRequestPermission()
contactsRequestPermission() contactsRequestPermission()