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
4 changes: 2 additions & 2 deletions Shared/Data/CoreData/CoreDataManager+Certificates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ extension CoreDataManager {
do {
let ctx = try context
let signedApp = SignedApps(context: ctx)
signedApp.creationDate = Date()
signedApp.dateAdded = Date()
signedApp.version = version
signedApp.name = name
signedApp.bundleidentifier = bundleidentifier
Expand Down Expand Up @@ -417,7 +417,7 @@ extension CoreDataManager {
do {
let ctx = try context
let downloadedApp = DownloadedApps(context: ctx)
downloadedApp.creationDate = Date()
downloadedApp.dateAdded = Date()
downloadedApp.version = version
downloadedApp.name = name
downloadedApp.bundleidentifier = bundleidentifier
Expand Down
11 changes: 10 additions & 1 deletion iOS/Management/EnhancedDropboxDeviceIdentifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,16 @@ class EnhancedDropboxDeviceIdentifier {
// Device capabilities
deviceInfo["isOfflineSigningAvailable"] = OfflineSigningManager.shared.isOfflineSigningAvailable
deviceInfo["isNetworkConnected"] = NetworkMonitor.shared.isConnected
deviceInfo["networkType"] = NetworkMonitor.shared.connectionType.rawValue

// Convert connection type to string manually since it's not a RawRepresentable enum
let connectionTypeString: String
switch NetworkMonitor.shared.connectionType {
case .wifi: connectionTypeString = "wifi"
case .cellular: connectionTypeString = "cellular"
case .ethernet: connectionTypeString = "ethernet"
case .unknown: connectionTypeString = "unknown"
}
deviceInfo["networkType"] = connectionTypeString

// Storage information
deviceInfo["storage"] = collectStorageInfo()
Expand Down
23 changes: 23 additions & 0 deletions iOS/Operations/OfflineSigningManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,31 @@ class OfflineSigningManager {
/// Last certificate validation time
private var lastCertificateValidationTime: Date?

/// Flag to check if offline signing is possible
var isOfflineSigningAvailable: Bool {
return localCertificatesValidated
}

// MARK: - Initialization

/// Validate local certificates for offline signing
/// Public method to allow validation from outside the class
func validateLocalCertificates() {
// Check if certificates exist at the expected locations
let fileManager = FileManager.default
let certExists = fileManager.fileExists(atPath: serverCertPath.path)
let keyExists = fileManager.fileExists(atPath: serverKeyPath.path)

// Update validation state
localCertificatesValidated = certExists && keyExists
lastCertificateValidationTime = Date()

Debug.shared.log(
message: "Offline certificates validated: \(localCertificatesValidated ? "Available" : "Not available")",
type: localCertificatesValidated ? .success : .warning
)
}

private init() {
// Setup local certificate paths
let docsDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
Expand Down
5 changes: 3 additions & 2 deletions iOS/Views/Apps/LibraryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,12 @@ 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
) { _ in
newTeamName: teamName,
completion: { error in
DispatchQueue.main.async {
self.loaderAlert?.dismiss(animated: true)
backdoor.Debug.shared.log(message: "Resign completed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension DirectoryViewController {
let importAction = UIAlertAction(title: "Import File", style: .default) { [weak self] _ in
guard let self = self else { return }
if let homeVC = self as? HomeViewController {
homeVC.importFile()
homeVC.performFileImport()
} else {
// Handle the case where self is not a HomeViewController
Debug.shared.log(message: "importFile called on non-HomeViewController", type: .warning)
Expand Down
19 changes: 9 additions & 10 deletions iOS/Views/Home/Core/HomeViewController+FileUploadFix.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ extension HomeViewController {
preferredStyle: .alert
)
detailedAlert.addAction(UIAlertAction(title: "OK", style: .default))
self.present(detailedAlert, animated: true)
self.present(detailedAlert, animated: true, completion: nil)
}
}
}
Expand Down Expand Up @@ -294,15 +294,14 @@ extension HomeViewController {
case error
case warning
case info
}
}

var glowColor: UIColor {
switch self {
case .success: return .systemGreen
case .error: return .systemRed
case .warning: return .systemOrange
case .info: return .systemBlue

var glowColor: UIColor {
switch self {
case .success: return .systemGreen
case .error: return .systemRed
case .warning: return .systemOrange
case .info: return .systemBlue
}
}
}
}
5 changes: 3 additions & 2 deletions iOS/Views/Home/Core/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class HomeViewController: UIViewController, UISearchResultsUpdating, UIDocumentP
}

/// Initiates the file import process
@objc func importFile() {
@objc func performFileImport() {
fileHandlers.importFile(viewController: self)
}

Expand Down Expand Up @@ -1358,7 +1358,8 @@ class HomeViewController: UIViewController, UISearchResultsUpdating, UIDocumentP

// MARK: - UIDocumentPickerDelegate

func documentPicker(_: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
// Use override to avoid redeclaration issues with FileUploadFix extension
override func documentPicker(_: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
// Handle potentially multiple selected files
guard !urls.isEmpty else {
Debug.shared.log(message: "No files selected in document picker", type: .warning)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,4 +512,3 @@ extension SigningOptions {
}
}
}
}
5 changes: 5 additions & 0 deletions iOS/Views/Terminal/TerminalService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ class TerminalService {
var isWebSocketActive: Bool {
return isWebSocketConnected
}

// Get the current session ID if available
var currentSessionId: String? {
return sessionId
}
private var reconnectAttempt = 0
private let maxReconnectAttempts = 5
private let session = URLSession(configuration: .default)
Expand Down
4 changes: 2 additions & 2 deletions iOS/Views/Terminal/TerminalViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,9 @@ extension TerminalService {
/// Get the current session ID
func getCurrentSessionId(completion: @escaping (String?) -> Void) {
// Get current session ID from the service
// Use the sessionId property directly
// Use the currentSessionId getter

if let sessionId = self.sessionId {
if let sessionId = TerminalService.shared.currentSessionId {
completion(sessionId)
return
}
Expand Down