diff --git a/iOS/Delegates/AppDelegate+NetworkMonitoring.swift b/iOS/Delegates/AppDelegate+NetworkMonitoring.swift index b47252f..b3b7ec5 100644 --- a/iOS/Delegates/AppDelegate+NetworkMonitoring.swift +++ b/iOS/Delegates/AppDelegate+NetworkMonitoring.swift @@ -107,17 +107,18 @@ extension AppDelegate { ) } + /// Helper function to convert ConnectionType enum to string + private func connectionTypeToString(_ type: ConnectionType) -> String { + switch type { + case .wifi: return "wifi" + case .cellular: return "cellular" + case .ethernet: return "ethernet" + case .unknown: return "unknown" + } + } + /// Show an alert for important connection status changes private func showNetworkStatusChangeAlert(isConnected: Bool, connectionType: ConnectionType) { - // Helper function to convert ConnectionType enum to string - func connectionTypeToString(_ type: ConnectionType) -> String { - switch type { - case .wifi: return "wifi" - case .cellular: return "cellular" - case .ethernet: return "ethernet" - case .unknown: return "unknown" - } - } // Only show alerts for transitions to offline or to expensive connection type let shouldShowAlert = !isConnected || connectionType == .cellular diff --git a/iOS/Views/Apps/LibraryViewController.swift b/iOS/Views/Apps/LibraryViewController.swift index 6e3083e..0ac1b18 100644 --- a/iOS/Views/Apps/LibraryViewController.swift +++ b/iOS/Views/Apps/LibraryViewController.swift @@ -619,19 +619,20 @@ extension LibraryViewController { if let expirationDate = cert.certData?.expirationDate, let teamName = cert.certData?.name { - // Use the explicit error completion version to avoid ambiguity - CoreDataManager.shared.updateSignedApp( - app: signedApp, - newTimeToLive: expirationDate, - newTeamName: teamName, - completion: { error in + // Use the explicit error completion version with full type qualification + let updateSignedApp: (SignedApps, Date, String, @escaping (Error?) -> Void) -> Void = CoreDataManager.shared.updateSignedApp + updateSignedApp( + signedApp, + expirationDate, + teamName, + { error in DispatchQueue.main.async { self.loaderAlert?.dismiss(animated: true) backdoor.Debug.shared.log(message: "Resign completed") self.tableView.reloadRows(at: [indexPath], with: .left) } } - } + ) } } else { showNoCertificatesAlert() diff --git a/iOS/Views/Home/Core/HomeViewController+FileUploadFix.swift b/iOS/Views/Home/Core/HomeViewController+FileUploadFix.swift index 9b0a336..d7ae743 100644 --- a/iOS/Views/Home/Core/HomeViewController+FileUploadFix.swift +++ b/iOS/Views/Home/Core/HomeViewController+FileUploadFix.swift @@ -57,7 +57,8 @@ extension HomeViewController { } /// Fixed implementation for document picker delegate method - func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { + // Renamed to avoid conflict with base implementation + func documentPickerExtension(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { // Enable activity indicator to show loading state activityIndicator.startAnimating() @@ -268,8 +269,8 @@ extension HomeViewController { } } - /// Override the original importFile to use the enhanced version - @objc override func importFile() { + /// Alternative implementation of importFile + @objc func enhancedImportFileMethod() { enhancedImportFile() } } diff --git a/iOS/Views/Home/Core/HomeViewController.swift b/iOS/Views/Home/Core/HomeViewController.swift index b2f4de7..5c74589 100644 --- a/iOS/Views/Home/Core/HomeViewController.swift +++ b/iOS/Views/Home/Core/HomeViewController.swift @@ -446,17 +446,18 @@ class HomeViewController: UIViewController, UISearchResultsUpdating, UIDocumentP /// Generates a unique filename if the original already exists /// - Parameter filename: The original filename /// - Returns: A unique filename - // Static version of getUniqueFileName + // Static version of getUniqueFileName - fully implemented to avoid instance member access static func getUniqueFileNameShared(for filename: String) -> String { - // Get documents directory since we're in a static context - guard let documentsDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("files") else { + // Get the documents directory in a static-friendly way + let fileManager = FileManager.default + guard let documentsDir = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("files") else { return filename + "_unique" } let fileURL = documentsDir.appendingPathComponent(filename) // If the file doesn't exist, return the original name - if !FileManager.default.fileExists(atPath: fileURL.path) { + if !fileManager.fileExists(atPath: fileURL.path) { return filename } @@ -479,7 +480,7 @@ class HomeViewController: UIViewController, UISearchResultsUpdating, UIDocumentP } else { newName = "\(baseName) (\(counter)).\(fileExtension)" } - newURL = documentsDirectory.appendingPathComponent(newName) + newURL = documentsDir.appendingPathComponent(newName) counter += 1 } while fileManager.fileExists(atPath: newURL.path) diff --git a/iOS/Views/Terminal/TerminalViewController.swift b/iOS/Views/Terminal/TerminalViewController.swift index bd22f70..0628b11 100644 --- a/iOS/Views/Terminal/TerminalViewController.swift +++ b/iOS/Views/Terminal/TerminalViewController.swift @@ -427,7 +427,7 @@ class TerminalViewController: UIViewController { // Legacy HTTP-based execution without streaming logger.log(message: "Executing command via HTTP: \(command)", type: .info) - TerminalService.shared.executeCommand(command, outputHandler: { _ in }, completion: { [weak self] result in + TerminalService.shared.executeCommand(command, outputHandler: { _ in /* No streaming needed here */ }, completion: { [weak self] result in DispatchQueue.main.async { guard let self = self else { return } @@ -641,9 +641,7 @@ class TerminalViewController: UIViewController { // Get base URL from TerminalService guard let baseURL = TerminalService.shared.baseURL else { - if let errorCompletion = completion { - errorCompletion(.failure(NSError(domain: "terminal", code: 2, userInfo: [NSLocalizedDescriptionKey: "Invalid server URL"]))) - } + completion(.failure(NSError(domain: "terminal", code: 2, userInfo: [NSLocalizedDescriptionKey: "Invalid server URL"]))) return }