Fix retranscribe functionality in history window
- Pass WhisperState to HistoryWindowController for transcription services - Update MenuBarManager to store and pass WhisperState reference - Ensure all transcription providers work in separate history window
This commit is contained in:
parent
d2dd506a94
commit
ebad2c42d0
@ -13,22 +13,23 @@ class HistoryWindowController: NSObject, NSWindowDelegate {
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
func showHistoryWindow(modelContainer: ModelContainer) {
|
func showHistoryWindow(modelContainer: ModelContainer, whisperState: WhisperState) {
|
||||||
if let existingWindow = historyWindow, existingWindow.isVisible {
|
if let existingWindow = historyWindow, existingWindow.isVisible {
|
||||||
existingWindow.makeKeyAndOrderFront(nil)
|
existingWindow.makeKeyAndOrderFront(nil)
|
||||||
NSApplication.shared.activate(ignoringOtherApps: true)
|
NSApplication.shared.activate(ignoringOtherApps: true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let window = createHistoryWindow(modelContainer: modelContainer)
|
let window = createHistoryWindow(modelContainer: modelContainer, whisperState: whisperState)
|
||||||
historyWindow = window
|
historyWindow = window
|
||||||
window.makeKeyAndOrderFront(nil)
|
window.makeKeyAndOrderFront(nil)
|
||||||
NSApplication.shared.activate(ignoringOtherApps: true)
|
NSApplication.shared.activate(ignoringOtherApps: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func createHistoryWindow(modelContainer: ModelContainer) -> NSWindow {
|
private func createHistoryWindow(modelContainer: ModelContainer, whisperState: WhisperState) -> NSWindow {
|
||||||
let historyView = TranscriptionHistoryView()
|
let historyView = TranscriptionHistoryView()
|
||||||
.modelContainer(modelContainer)
|
.modelContainer(modelContainer)
|
||||||
|
.environmentObject(whisperState)
|
||||||
.frame(minWidth: 800, minHeight: 600)
|
.frame(minWidth: 800, minHeight: 600)
|
||||||
|
|
||||||
let hostingController = NSHostingController(rootView: historyView)
|
let hostingController = NSHostingController(rootView: historyView)
|
||||||
|
|||||||
@ -11,14 +11,16 @@ class MenuBarManager: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var modelContainer: ModelContainer?
|
private var modelContainer: ModelContainer?
|
||||||
|
private var whisperState: WhisperState?
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
self.isMenuBarOnly = UserDefaults.standard.bool(forKey: "IsMenuBarOnly")
|
self.isMenuBarOnly = UserDefaults.standard.bool(forKey: "IsMenuBarOnly")
|
||||||
updateAppActivationPolicy()
|
updateAppActivationPolicy()
|
||||||
}
|
}
|
||||||
|
|
||||||
func configure(modelContainer: ModelContainer) {
|
func configure(modelContainer: ModelContainer, whisperState: WhisperState) {
|
||||||
self.modelContainer = modelContainer
|
self.modelContainer = modelContainer
|
||||||
|
self.whisperState = whisperState
|
||||||
}
|
}
|
||||||
|
|
||||||
func toggleMenuBarOnly() {
|
func toggleMenuBarOnly() {
|
||||||
@ -84,10 +86,14 @@ class MenuBarManager: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func openHistoryWindow() {
|
func openHistoryWindow() {
|
||||||
guard let modelContainer = modelContainer else {
|
guard let modelContainer = modelContainer,
|
||||||
print("MenuBarManager: ModelContainer not configured")
|
let whisperState = whisperState else {
|
||||||
|
print("MenuBarManager: Dependencies not configured")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
HistoryWindowController.shared.showHistoryWindow(modelContainer: modelContainer)
|
HistoryWindowController.shared.showHistoryWindow(
|
||||||
|
modelContainer: modelContainer,
|
||||||
|
whisperState: whisperState
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,10 +107,10 @@ struct ContentView: View {
|
|||||||
ForEach(visibleViewTypes) { viewType in
|
ForEach(visibleViewTypes) { viewType in
|
||||||
Section {
|
Section {
|
||||||
if viewType == .history {
|
if viewType == .history {
|
||||||
// History opens in separate window instead of inline
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
HistoryWindowController.shared.showHistoryWindow(
|
HistoryWindowController.shared.showHistoryWindow(
|
||||||
modelContainer: modelContext.container
|
modelContainer: modelContext.container,
|
||||||
|
whisperState: whisperState
|
||||||
)
|
)
|
||||||
}) {
|
}) {
|
||||||
HStack(spacing: 12) {
|
HStack(spacing: 12) {
|
||||||
@ -175,9 +175,9 @@ struct ContentView: View {
|
|||||||
case "VoiceInk Pro":
|
case "VoiceInk Pro":
|
||||||
selectedView = .license
|
selectedView = .license
|
||||||
case "History":
|
case "History":
|
||||||
// Open History in separate window instead of inline
|
|
||||||
HistoryWindowController.shared.showHistoryWindow(
|
HistoryWindowController.shared.showHistoryWindow(
|
||||||
modelContainer: modelContext.container
|
modelContainer: modelContext.container,
|
||||||
|
whisperState: whisperState
|
||||||
)
|
)
|
||||||
case "Permissions":
|
case "Permissions":
|
||||||
selectedView = .permissions
|
selectedView = .permissions
|
||||||
@ -206,7 +206,6 @@ struct ContentView: View {
|
|||||||
case .transcribeAudio:
|
case .transcribeAudio:
|
||||||
AudioTranscribeView()
|
AudioTranscribeView()
|
||||||
case .history:
|
case .history:
|
||||||
// History now opens in separate window, not shown inline
|
|
||||||
Text("History")
|
Text("History")
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
case .audioInput:
|
case .audioInput:
|
||||||
|
|||||||
@ -108,9 +108,7 @@ struct VoiceInkApp: App {
|
|||||||
|
|
||||||
let menuBarManager = MenuBarManager()
|
let menuBarManager = MenuBarManager()
|
||||||
_menuBarManager = StateObject(wrappedValue: menuBarManager)
|
_menuBarManager = StateObject(wrappedValue: menuBarManager)
|
||||||
|
menuBarManager.configure(modelContainer: container, whisperState: whisperState)
|
||||||
// Configure MenuBarManager with ModelContainer for window management
|
|
||||||
menuBarManager.configure(modelContainer: container)
|
|
||||||
|
|
||||||
let activeWindowService = ActiveWindowService.shared
|
let activeWindowService = ActiveWindowService.shared
|
||||||
activeWindowService.configure(with: enhancementService)
|
activeWindowService.configure(with: enhancementService)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user