Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions iOS/Delegates/AppDelegate+NetworkMonitoring.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 8 additions & 7 deletions iOS/Views/Apps/LibraryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 4 additions & 3 deletions iOS/Views/Home/Core/HomeViewController+FileUploadFix.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
}
}
Expand Down
11 changes: 6 additions & 5 deletions iOS/Views/Home/Core/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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)

Expand Down
6 changes: 2 additions & 4 deletions iOS/Views/Terminal/TerminalViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down Expand Up @@ -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
}

Expand Down