Skip to content
Draft
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
103 changes: 101 additions & 2 deletions NotebookSaver.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
7F3764E12DC566A20038F019 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F3764E02DC566A20038F019 /* WidgetKit.framework */; };
7F3764E32DC566A20038F019 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F3764E22DC566A20038F019 /* SwiftUI.framework */; };
7F3764F22DC566A40038F019 /* Cat NoteWidgetsExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 7F3764DE2DC566A20038F019 /* Cat NoteWidgetsExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
7FNEW100000000000000030 /* NotebookSaverShareExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 7FNEW100000000000000001 /* NotebookSaverShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
7FNEW100000000000000031 /* ShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FNEW100000000000000002 /* ShareView.swift */; };
7FNEW100000000000000032 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FNEW100000000000000003 /* ShareViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -30,13 +33,24 @@
dstSubfolderSpec = 13;
files = (
7F3764F22DC566A40038F019 /* Cat NoteWidgetsExtension.appex in Embed Foundation Extensions */,
7FNEW100000000000000030 /* NotebookSaverShareExtension.appex in Embed Foundation Extensions */,
);
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
7FNEW100000000000000001 /* NotebookSaverShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotebookSaverShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
7FNEW100000000000000002 /* ShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = "<group>"; };
7FNEW100000000000000003 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
7FNEW100000000000000004 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7FNEW100000000000000005 /* NotebookSaverShareExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotebookSaverShareExtension.entitlements; sourceTree = "<group>"; };
7FNEW200000000000000001 /* NotebookSaver.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotebookSaver.entitlements; sourceTree = "<group>"; };
7FNEW300000000000000001 /* SharedDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedDefaults.swift; sourceTree = "<group>"; };
7FNEW300000000000000002 /* NotebookSaverPipeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotebookSaverPipeline.swift; sourceTree = "<group>"; };
7FNEW300000000000000003 /* ProcessPhotoIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcessPhotoIntent.swift; sourceTree = "<group>"; };
7FNEW300000000000000004 /* NotebookSaverAppIntents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotebookSaverAppIntents.swift; sourceTree = "<group>"; };
7F3764AA2DC45A9C0038F019 /* Cat Scribe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Cat Scribe.app"; sourceTree = BUILT_PRODUCTS_DIR; };
7F3764DE2DC566A20038F019 /* Cat NoteWidgetsExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Cat NoteWidgetsExtension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
7F3764E02DC566A20038F019 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -68,6 +82,12 @@
);
path = NotebookSaver;
sourceTree = "<group>";
children = (
7FNEW300000000000000001 /* SharedDefaults.swift */,
7FNEW300000000000000002 /* NotebookSaverPipeline.swift */,
7FNEW300000000000000003 /* ProcessPhotoIntent.swift */,
7FNEW300000000000000004 /* NotebookSaverAppIntents.swift */,
);
};
7F3764E42DC566A20038F019 /* NotebookSaverWidgets */ = {
isa = PBXFileSystemSynchronizedRootGroup;
Expand All @@ -80,9 +100,8 @@
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
7F3764A72DC45A9C0038F019 /* Frameworks */ = {
7FNEW100000000000000012 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -103,6 +122,7 @@
isa = PBXGroup;
children = (
7F3764AC2DC45A9C0038F019 /* NotebookSaver */,
7FNEW100000000000000000 /* NotebookSaverShareExtension */,
7F3764E42DC566A20038F019 /* NotebookSaverWidgets */,
7F3764DF2DC566A20038F019 /* Frameworks */,
7F3764AB2DC45A9C0038F019 /* Products */,
Expand All @@ -114,6 +134,7 @@
children = (
7F3764AA2DC45A9C0038F019 /* Cat Scribe.app */,
7F3764DE2DC566A20038F019 /* Cat NoteWidgetsExtension.appex */,
7FNEW100000000000000001 /* NotebookSaverShareExtension.appex */,
);
name = Products;
sourceTree = "<group>";
Expand All @@ -127,6 +148,17 @@
name = Frameworks;
sourceTree = "<group>";
};
7FNEW100000000000000000 /* NotebookSaverShareExtension */ = {
isa = PBXGroup;
children = (
7FNEW100000000000000002 /* ShareView.swift */,
7FNEW100000000000000003 /* ShareViewController.swift */,
7FNEW100000000000000004 /* Info.plist */,
7FNEW100000000000000005 /* NotebookSaverShareExtension.entitlements */,
);
path = NotebookSaverShareExtension;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -176,6 +208,21 @@
productReference = 7F3764DE2DC566A20038F019 /* Cat NoteWidgetsExtension.appex */;
productType = "com.apple.product-type.app-extension";
};
7FNEW100000000000000010 /* NotebookSaverShareExtension */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7FNEW100000000000000020 /* Build configuration list for PBXNativeTarget "NotebookSaverShareExtension" */;
buildPhases = (
7FNEW100000000000000011 /* Sources */,
7FNEW100000000000000012 /* Frameworks */,
7FNEW100000000000000013 /* Resources */,
);
dependencies = (
);
name = NotebookSaverShareExtension;
productName = NotebookSaverShareExtension;
productReference = 7FNEW100000000000000001 /* NotebookSaverShareExtension.appex */;
productType = "com.apple.product-type.app-extension";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
Expand Down Expand Up @@ -213,6 +260,7 @@
targets = (
7F3764A92DC45A9C0038F019 /* Cat Scribe */,
7F3764DD2DC566A20038F019 /* Cat NoteWidgetsExtension */,
7FNEW100000000000000010 /* NotebookSaverShareExtension */,
);
};
/* End PBXProject section */
Expand All @@ -232,6 +280,12 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
7FNEW100000000000000013 /* Resources */ = {
isa = PBXResourcesBuildPhase;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -249,6 +303,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
7FNEW100000000000000011 /* Sources */ = {
isa = PBXSourcesBuildPhase;
files = (
7FNEW100000000000000031 /* ShareView.swift in Sources */,
7FNEW100000000000000032 /* ShareViewController.swift in Sources */,
);
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
Expand Down Expand Up @@ -408,6 +469,7 @@
INFOPLIST_KEY_UIStatusBarHidden = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
CODE_SIGN_ENTITLEMENTS = NotebookSaver/NotebookSaver.entitlements;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -451,6 +513,7 @@
INFOPLIST_KEY_UIStatusBarHidden = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
CODE_SIGN_ENTITLEMENTS = NotebookSaver/NotebookSaver.entitlements;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -522,6 +585,34 @@
};
name = Release;
};
7FNEW100000000000000021 /* Debug */ = {isa = XCBuildConfiguration; buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = Q26G342EEL;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = NotebookSaverShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = ("$(inherited)", "@executable_path/Frameworks", "@executable_path/../../Frameworks");
PRODUCT_BUNDLE_IDENTIFIER = com.daviddegner.NotebookSaver.ShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 1;
INFOPLIST_KEY_NSExtensionPrincipalClass = "$(PRODUCT_MODULE_NAME).ShareViewController";
CODE_SIGN_ENTITLEMENTS = NotebookSaverShareExtension/NotebookSaverShareExtension.entitlements;
}; name = Debug; };
7FNEW100000000000000022 /* Release */ = {isa = XCBuildConfiguration; buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = Q26G342EEL;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = NotebookSaverShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
LD_RUNPATH_SEARCH_PATHS = ("$(inherited)", "@executable_path/Frameworks", "@executable_path/../../Frameworks");
PRODUCT_BUNDLE_IDENTIFIER = com.daviddegner.NotebookSaver.ShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 1;
INFOPLIST_KEY_NSExtensionPrincipalClass = "$(PRODUCT_MODULE_NAME).ShareViewController";
CODE_SIGN_ENTITLEMENTS = NotebookSaverShareExtension/NotebookSaverShareExtension.entitlements;
}; name = Release; };
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand Down Expand Up @@ -552,6 +643,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7FNEW100000000000000020 /* Build configuration list for PBXNativeTarget "NotebookSaverShareExtension" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7FNEW100000000000000021 /* Debug */,
7FNEW100000000000000022 /* Release */,
);
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 7F3764A22DC45A9C0038F019 /* Project object */;
Expand Down
2 changes: 1 addition & 1 deletion NotebookSaver/AppDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import Foundation
/// Centralized app defaults to ensure consistency across the app
enum AppDefaults {
/// Default text extractor service - set to Vision (Local) since it works without setup
/// The onboarding flow will change this to Gemini when user provides API key
/// The onboarding flow will change this to Cloud when user provides API key
static let textExtractorService = TextExtractorType.vision.rawValue
}
16 changes: 8 additions & 8 deletions NotebookSaver/CameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ extension CameraView {
} catch let error as CameraManager.CameraError {
await handleError(error.localizedDescription)
} catch let error as APIError {
await handleError("Gemini Error: \(error.localizedDescription)")
await handleError("Cloud Error: \(error.localizedDescription)")
} catch let error as VisionError {
await handleError("Vision Error: \(error.localizedDescription)")
} catch let error as DraftsError {
Expand All @@ -326,14 +326,14 @@ extension CameraView {

private func extractTextFromProcessedImage(_ processedImage: UIImage) async throws -> String {
let defaults = UserDefaults.standard
let selectedServiceRaw = defaults.string(forKey: "textExtractorService") ?? TextExtractorType.gemini.rawValue
var selectedService = TextExtractorType(rawValue: selectedServiceRaw) ?? .gemini
let selectedServiceRaw = defaults.string(forKey: "textExtractorService") ?? TextExtractorType.cloud.rawValue
var selectedService = TextExtractorType(rawValue: selectedServiceRaw) ?? .cloud

// Check if Gemini is properly configured, fallback to Vision if not
if selectedService == .gemini {
// Check if Cloud is properly configured, fallback to Vision if not
if selectedService == .cloud {
let apiKey = KeychainService.loadAPIKey()
if apiKey?.isEmpty ?? true {
print("Gemini selected but API key is missing, falling back to Vision")
print("Cloud selected but API key is missing, falling back to Vision")
selectedService = .vision
}
}
Expand All @@ -342,9 +342,9 @@ extension CameraView {

let textExtractor: ImageTextExtractor
switch selectedService {
case .gemini:
case .cloud:
textExtractor = GeminiService()
print("Using Gemini Service with processed image")
print("Using Cloud Service with processed image")
case .vision:
textExtractor = VisionService()
print("Using Vision Service with processed image")
Expand Down
Loading