Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
kchro3 committed Feb 6, 2024
1 parent efb4e60 commit 8b0d4f8
Show file tree
Hide file tree
Showing 23 changed files with 200 additions and 168 deletions.
26 changes: 26 additions & 0 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,22 @@
}
}
},
"Enable Debug Mode" : {
"localizations" : {
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Activer le mode de débogage"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Abilita la modalità di debug"
}
}
}
},
"Enable Dictation" : {
"localizations" : {
"fr" : {
Expand Down Expand Up @@ -1034,6 +1050,16 @@
}
}
},
"Failed to get screenshot boundaries" : {
"localizations" : {
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Non è stato possibile ottenere i confini dello screenshot"
}
}
}
},
"Failed to register" : {
"localizations" : {
"fr" : {
Expand Down
12 changes: 8 additions & 4 deletions TypeaheadAI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
2BCF84352A9DD90F00359841 /* HistoryManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF84342A9DD90F00359841 /* HistoryManager.swift */; };
2BCF843A2A9DE6DA00359841 /* GeneralSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF84392A9DE6DA00359841 /* GeneralSettingsView.swift */; };
2BD3821E2B2C4B2E00F96C19 /* CanSimulateEnter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BD3821D2B2C4B2E00F96C19 /* CanSimulateEnter.swift */; };
2BD97C802B720496002570C1 /* ApiError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BD97C7F2B720496002570C1 /* ApiError.swift */; };
2BDA45C32ABEE840006128BC /* MessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDA45C22ABEE840006128BC /* MessageView.swift */; };
2BDDB9892B27DDE100D52BF0 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = 2BDDB9882B27DDE100D52BF0 /* SwiftSoup */; };
2BDDB98B2B27DDFF00D52BF0 /* String+XMLMarkdown.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDDB98A2B27DDFF00D52BF0 /* String+XMLMarkdown.swift */; };
Expand Down Expand Up @@ -270,6 +271,7 @@
2BCF84342A9DD90F00359841 /* HistoryManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryManager.swift; sourceTree = "<group>"; };
2BCF84392A9DE6DA00359841 /* GeneralSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralSettingsView.swift; sourceTree = "<group>"; };
2BD3821D2B2C4B2E00F96C19 /* CanSimulateEnter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanSimulateEnter.swift; sourceTree = "<group>"; };
2BD97C7F2B720496002570C1 /* ApiError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiError.swift; sourceTree = "<group>"; };
2BDA45C22ABEE840006128BC /* MessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageView.swift; sourceTree = "<group>"; };
2BDDB98A2B27DDFF00D52BF0 /* String+XMLMarkdown.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+XMLMarkdown.swift"; sourceTree = "<group>"; };
2BDDB98C2B282AFF00D52BF0 /* AppManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -654,6 +656,7 @@
2BE7BB8E2B258C7900164F88 /* UIElement.swift */,
2BDDB98E2B282B3000D52BF0 /* Application.swift */,
2B9A89902B44CBCC00041856 /* JSONAny.swift */,
2BD97C7F2B720496002570C1 /* ApiError.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -847,6 +850,7 @@
2BA7F0B52A9ABCD7003D38BA /* QuickActionManager.swift in Sources */,
2B2EF14E2AC17D4000EF2BD4 /* CustomTextField.swift in Sources */,
2B11FCF22B114C3F00325F38 /* Message.swift in Sources */,
2BD97C802B720496002570C1 /* ApiError.swift in Sources */,
2B7669AA2B5EED910071D713 /* SpecialFocusActor.swift in Sources */,
2B8CD4BB2B0AAC09003E0589 /* CopyButtonView.swift in Sources */,
2B4BDB8B2ACC281E00E55D78 /* IntentManager.swift in Sources */,
Expand Down Expand Up @@ -1098,7 +1102,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 9;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"TypeaheadAI/Preview Content\"";
DEVELOPMENT_TEAM = TZA789GZFT;
Expand All @@ -1116,7 +1120,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2.1.27;
MARKETING_VERSION = 2.1.29;
PRODUCT_BUNDLE_IDENTIFIER = ai.typeahead.TypeaheadAI;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1139,7 +1143,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 9;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"TypeaheadAI/Preview Content\"";
DEVELOPMENT_TEAM = TZA789GZFT;
Expand All @@ -1157,7 +1161,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2.1.27;
MARKETING_VERSION = 2.1.29;
PRODUCT_BUNDLE_IDENTIFIER = ai.typeahead.TypeaheadAI;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion TypeaheadAI/Actors/SpecialFocusActor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Cocoa
import Foundation
import os.log

actor SpecialFocusActor: CanGetUIElements, CanExecuteScript {
actor SpecialFocusActor: CanGetUIElements {
private let logger = Logger(
subsystem: "ai.typeahead.TypeaheadAI",
category: "SpecialFocusActor"
Expand Down
20 changes: 14 additions & 6 deletions TypeaheadAI/Actors/SpecialVisionActor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ actor SpecialVisionActor: CanGetUIElements, CanExecuteScript {
}

func specialVision() async throws {
// Clear the current state
await self.modalManager.forceRefresh()

let appInfo = try await appContextManager.getActiveAppInfo()
guard let (point, size) = await getPointAndSize(appContext: appInfo.appContext) else {
guard let (point, size) = try await getPointAndSize(appContext: appInfo.appContext) else {
await self.modalManager.showModal()
await modalManager.setError(NSLocalizedString("Failed to get screenshot boundaries", comment: ""), appContext: appInfo.appContext)

await NSApp.activate(ignoringOtherApps: true)
return
}

if let image = captureScreen(point: point, size: size) {
// Clear the current state
await self.modalManager.forceRefresh()
await self.modalManager.showModal()

// Add user image
Expand All @@ -72,15 +77,18 @@ actor SpecialVisionActor: CanGetUIElements, CanExecuteScript {

try await modalManager.replyToUserMessage()
} else {
await self.modalManager.showModal()
await modalManager.setError(NSLocalizedString("Failed to get screenshot", comment: ""), appContext: appInfo.appContext)
}

await NSApp.activate(ignoringOtherApps: true)
}

func getPointAndSize(appContext: AppContext?) async -> (CGPoint, CGSize)? {
func getPointAndSize(appContext: AppContext?) async throws -> (CGPoint, CGSize)? {
if NSWorkspace.shared.isVoiceOverEnabled {
/// If VoiceOver is enabled, then get the VO cursor bounds
if let serializedCursor = await executeScript(script: SpecialVisionActor.voCursorScript),
let data = serializedCursor.data(using: .utf8),
let serializedCursor = try await executeScript(script: SpecialVisionActor.voCursorScript)
if let data = serializedCursor.data(using: .utf8),
let cursor = try? JSONDecoder().decode(VOCursor.self, from: data) {
return (cursor.point, cursor.size)
} else {
Expand Down
2 changes: 1 addition & 1 deletion TypeaheadAI/AppContextManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AppContextManager: CanFetchAppContext, CanExecuteScript {

private func getUrl(bundleIdentifier: String?) async -> URL? {
if bundleIdentifier == "com.google.Chrome" {
if let urlString = await executeScript(script: AppContextManager.getActiveTabURLScript),
if let urlString = try? await executeScript(script: AppContextManager.getActiveTabURLScript),
let url = URL(string: urlString),
let strippedUrl = self.stripQueryParameters(from: url) {
return strippedUrl
Expand Down
27 changes: 8 additions & 19 deletions TypeaheadAI/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import UserNotifications

@MainActor
final class AppState: ObservableObject {
@Published var isLoading: Bool = false
@Published var isBlinking: Bool = false
// NOTE: This is needed for the Menu View
@Published var isMenuVisible: Bool = false

private var updateTimer: Timer?
Expand Down Expand Up @@ -128,8 +127,6 @@ final class AppState: ObservableObject {
self.settingsManager.quickActionManager = quickActionManager
self.settingsManager.supabaseManager = supabaseManager

checkAndRequestNotificationPermissions()

KeyboardShortcuts.onKeyUp(for: .specialCopy) { [self] in
Task {
do {
Expand All @@ -138,6 +135,7 @@ final class AppState: ObservableObject {
NotificationCenter.default.post(name: .smartCopyPerformed, object: nil)
}
} catch {
try? await clientManager.sendFeedback(feedback: "Failed to smart-copy\n\(error.localizedDescription)")
AudioServicesPlaySystemSoundWithCompletion(1103, nil)
}
}
Expand All @@ -151,6 +149,7 @@ final class AppState: ObservableObject {
NotificationCenter.default.post(name: .smartPastePerformed, object: nil)
}
} catch {
try? await clientManager.sendFeedback(feedback: "Failed to smart-paste\n\(error.localizedDescription)")
AudioServicesPlaySystemSoundWithCompletion(1103, nil)
}
}
Expand All @@ -161,7 +160,7 @@ final class AppState: ObservableObject {
do {
try await self.specialRecordActor?.specialRecord()
} catch {
self.logger.error("\(error.localizedDescription)")
try? await clientManager.sendFeedback(feedback: "Failed to smart-record\n\(error.localizedDescription)")
AudioServicesPlaySystemSoundWithCompletion(1103, nil)
}
}
Expand All @@ -172,7 +171,7 @@ final class AppState: ObservableObject {
do {
try await self.specialVisionActor?.specialVision()
} catch {
self.logger.error("\(error.localizedDescription)")
try? await clientManager.sendFeedback(feedback: "Failed to smart-vision\n\(error.localizedDescription)")
AudioServicesPlaySystemSoundWithCompletion(1103, nil)
}
}
Expand All @@ -183,7 +182,7 @@ final class AppState: ObservableObject {
do {
try await self.specialFocusActor?.specialFocus()
} catch {
self.logger.error("\(error.localizedDescription)")
try? await clientManager.sendFeedback(feedback: "Failed to smart-focus\n\(error.localizedDescription)")
AudioServicesPlaySystemSoundWithCompletion(1103, nil)
}
}
Expand All @@ -194,7 +193,7 @@ final class AppState: ObservableObject {
do {
try await self.specialOpenActor?.specialOpen()
} catch {
self.logger.error("\(error.localizedDescription)")
try? await clientManager.sendFeedback(feedback: "Failed to open chat\n\(error.localizedDescription)")
AudioServicesPlaySystemSoundWithCompletion(1103, nil)
}
}
Expand All @@ -205,7 +204,7 @@ final class AppState: ObservableObject {
do {
try await self.specialOpenActor?.specialOpen(forceRefresh: true)
} catch {
self.logger.error("\(error.localizedDescription)")
try? await clientManager.sendFeedback(feedback: "Failed to open new chat\n\(error.localizedDescription)")
AudioServicesPlaySystemSoundWithCompletion(1103, nil)
}
}
Expand All @@ -215,14 +214,4 @@ final class AppState: ObservableObject {
self.modalManager.cancelTasks()
}
}

private func checkAndRequestNotificationPermissions() -> Void {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { granted, error in
if granted {
self.logger.debug("Notification permission granted")
} else if let error = error {
self.logger.error("Notification permission error: \(error.localizedDescription)")
}
}
}
}
Loading

0 comments on commit 8b0d4f8

Please sign in to comment.