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
8 changes: 4 additions & 4 deletions iOS/Views/AI Assistant/AIViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}

Expand Down Expand Up @@ -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()
}
Expand Down
10 changes: 5 additions & 5 deletions iOS/Views/AI Assistant/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading