diff --git a/iOS/Views/AI Assistant/AIViewController.swift b/iOS/Views/AI Assistant/AIViewController.swift index 0a0e279..eec18eb 100644 --- a/iOS/Views/AI Assistant/AIViewController.swift +++ b/iOS/Views/AI Assistant/AIViewController.swift @@ -7,7 +7,7 @@ class AIViewController: UIViewController { private let welcomeLabel = UILabel() private let startChatButton = UIButton(type: .system) - private let recentChatsTableView = UITableView(style: .insetGrouped) + private let recentChatsTableView = UITableView(frame: .zero, style: .insetGrouped) private let emptyStateView = UIView() // MARK: - Data @@ -103,8 +103,8 @@ class AIViewController: UIViewController { recentChatsTableView.dataSource = self recentChatsTableView.delegate = self recentChatsTableView.register(UITableViewCell.self, forCellReuseIdentifier: "ChatSessionCell") - recentChatsTableView.backgroundColor = .systemGroupedBackground - recentChatsTableView.separatorStyle = .singleLine + recentChatsTableView.backgroundColor = UIColor.systemGroupedBackground + recentChatsTableView.separatorStyle = UITableViewCell.SeparatorStyle.singleLine recentChatsTableView.tableFooterView = UIView() } @@ -375,7 +375,7 @@ extension AIViewController: UITableViewDelegate { // MARK: - View Controller Refreshable extension AIViewController: ViewControllerRefreshable { - func refreshContent() { + override func refreshContent() { // Reload data when tab is selected loadRecentSessions() } diff --git a/iOS/Views/AI Assistant/ChatViewController.swift b/iOS/Views/AI Assistant/ChatViewController.swift index e82e2dd..4ae9d46 100644 --- a/iOS/Views/AI Assistant/ChatViewController.swift +++ b/iOS/Views/AI Assistant/ChatViewController.swift @@ -25,7 +25,7 @@ class ChatViewController: UIViewController, UITableViewDataSource, UITableViewDe stateQueue.sync { _isProcessingMessage = newValue } // Update UI based on processing state - DispatchQueue.main.async(execute: { [weak self] in + DispatchQueue.main.async { [weak self] in if let self = self { self.updateProcessingState(isProcessing: newValue) } @@ -158,7 +158,7 @@ class ChatViewController: UIViewController, UITableViewDataSource, UITableViewDe Debug.shared.log(message: "Chat view controller becoming active after background", type: .debug) // Refresh messages to ensure we're in sync with CoreData - DispatchQueue.main.async(execute: { [weak self] in + DispatchQueue.main.async { [weak self] in self?.loadMessages() // Re-enable UI if it was left in a processing state @@ -677,7 +677,7 @@ class ChatViewController: UIViewController, UITableViewDataSource, UITableViewDe // Call AI service with proper error handling OpenAIService.shared.getAIResponse(messages: apiMessages, context: context) { [weak self] result in // Ensure UI updates happen on main thread - DispatchQueue.main.async(execute: { + DispatchQueue.main.async { guard let self = self else { return } // Reset UI state @@ -784,7 +784,7 @@ class ChatViewController: UIViewController, UITableViewDataSource, UITableViewDe /// Handle timeout of message processing (e.g., when app is backgrounded for too long) private func handleMessageProcessingTimeout() { - DispatchQueue.main.async(execute: { [weak self] in + DispatchQueue.main.async { [weak self] in guard let self = self, self.isProcessingMessage else { return } // Reset UI state @@ -821,7 +821,7 @@ class ChatViewController: UIViewController, UITableViewDataSource, UITableViewDe // Use weak self to prevent retain cycles AppContextManager.shared.executeCommand(command, parameter: parameter) { [weak self] commandResult in // Ensure UI updates happen on main thread - DispatchQueue.main.async(execute: { + DispatchQueue.main.async { guard let self = self else { return } let systemMessageContent: String