Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
3007805011
commit
905d439b81
@ -1,5 +1,6 @@
|
||||
import SwiftUI
|
||||
import SwiftData
|
||||
import Bedrock
|
||||
|
||||
@main
|
||||
struct BusinessCardApp: App {
|
||||
@ -26,7 +27,7 @@ struct BusinessCardApp: App {
|
||||
do {
|
||||
container = try ModelContainer(for: schema, configurations: [config])
|
||||
} catch {
|
||||
print("Failed to create container with App Group: \(error)")
|
||||
Design.debugLog("Failed to create container with App Group: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,13 +43,13 @@ struct BusinessCardApp: App {
|
||||
do {
|
||||
container = try ModelContainer(for: schema, configurations: [config])
|
||||
} catch {
|
||||
print("Failed to create container in Application Support: \(error)")
|
||||
Design.debugLog("Failed to create container in Application Support: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// Last resort: In-memory (data won't persist but app will work)
|
||||
if container == nil {
|
||||
print("WARNING: Using in-memory store - data will not persist!")
|
||||
Design.debugLog("WARNING: Using in-memory store - data will not persist!")
|
||||
let config = ModelConfiguration(
|
||||
schema: schema,
|
||||
isStoredInMemoryOnly: true,
|
||||
|
||||
@ -19,8 +19,6 @@ extension UIImage {
|
||||
|
||||
// Create a smaller sample size for performance
|
||||
let sampleSize = 50
|
||||
let scaleX = max(1, width / sampleSize)
|
||||
let scaleY = max(1, height / sampleSize)
|
||||
|
||||
guard let context = CGContext(
|
||||
data: nil,
|
||||
@ -139,3 +137,4 @@ private extension Color {
|
||||
return rDiff < threshold && gDiff < threshold && bDiff < threshold
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ private struct FieldRow: View {
|
||||
|
||||
ScrollView {
|
||||
AddedContactFieldsView(fields: $fields) { field in
|
||||
print("Edit: \(field.fieldType.displayName)")
|
||||
Design.debugLog("Edit: \(field.fieldType.displayName)")
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ struct CameraWithCropper: View {
|
||||
|
||||
#Preview {
|
||||
CameraWithCropper(
|
||||
onSave: { _ in print("Saved") },
|
||||
onCancel: { print("Cancelled") }
|
||||
onSave: { _ in Design.debugLog("Saved") },
|
||||
onCancel: { Design.debugLog("Cancelled") }
|
||||
)
|
||||
}
|
||||
|
||||
@ -71,6 +71,6 @@ private struct FieldTypeButton: View {
|
||||
|
||||
#Preview {
|
||||
ContactFieldPickerView { fieldType in
|
||||
print("Selected: \(fieldType.displayName)")
|
||||
Design.debugLog("Selected: \(fieldType.displayName)")
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ private struct OptionRow: View {
|
||||
imageType: .profile,
|
||||
hasExistingImage: false
|
||||
) { data in
|
||||
print(data != nil ? "Got image" : "Cancelled")
|
||||
Design.debugLog(data != nil ? "Got image" : "Cancelled")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,8 +89,8 @@ struct PhotoPickerWithCropper: View {
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
PhotoPickerWithCropper(
|
||||
onSave: { _ in print("Saved") },
|
||||
onCancel: { print("Cancelled") }
|
||||
onSave: { _ in Design.debugLog("Saved") },
|
||||
onCancel: { Design.debugLog("Cancelled") }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,9 +207,9 @@ extension PhotoSourceOption {
|
||||
title: "Add profile picture",
|
||||
hasExistingPhoto: true,
|
||||
additionalOptions: [],
|
||||
onSelectFromLibrary: { print("Library") },
|
||||
onTakePhoto: { print("Camera") },
|
||||
onRemovePhoto: { print("Remove") }
|
||||
onSelectFromLibrary: { Design.debugLog("Library") },
|
||||
onTakePhoto: { Design.debugLog("Camera") },
|
||||
onRemovePhoto: { Design.debugLog("Remove") }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ private struct FlowLayout: Layout {
|
||||
|
||||
#Preview("Add Email") {
|
||||
ContactFieldEditorSheet(fieldType: .email) { value, title in
|
||||
print("Saved: \(value), \(title)")
|
||||
Design.debugLog("Saved: \(value), \(title)")
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,15 +286,15 @@ private struct FlowLayout: Layout {
|
||||
initialValue: "linkedin.com/in/mattbruce",
|
||||
initialTitle: "Connect with me"
|
||||
) { value, title in
|
||||
print("Saved: \(value), \(title)")
|
||||
Design.debugLog("Saved: \(value), \(title)")
|
||||
} onDelete: {
|
||||
print("Deleted")
|
||||
Design.debugLog("Deleted")
|
||||
}
|
||||
}
|
||||
|
||||
#Preview("Add Address") {
|
||||
ContactFieldEditorSheet(fieldType: .address) { value, title in
|
||||
print("Saved address: \(value), title: \(title)")
|
||||
Design.debugLog("Saved address: \(value), title: \(title)")
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,8 +311,8 @@ private struct FlowLayout: Layout {
|
||||
initialValue: existingAddress.encode(),
|
||||
initialTitle: "Work"
|
||||
) { value, title in
|
||||
print("Saved: \(value), title: \(title)")
|
||||
Design.debugLog("Saved: \(value), title: \(title)")
|
||||
} onDelete: {
|
||||
print("Deleted")
|
||||
Design.debugLog("Deleted")
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,6 +334,6 @@ private struct CustomColorPickerSheet: View {
|
||||
LogoEditorSheet(
|
||||
logoImage: UIImage(systemName: "building.2.fill")!
|
||||
) { data in
|
||||
print(data != nil ? "Saved logo" : "Cancelled")
|
||||
Design.debugLog(data != nil ? "Saved logo" : "Cancelled")
|
||||
}
|
||||
}
|
||||
|
||||
@ -582,6 +582,6 @@ private struct CropGridLines: View {
|
||||
let sampleData = sampleImage.pngData()!
|
||||
|
||||
return PhotoCropperSheet(imageData: sampleData) { data in
|
||||
print(data != nil ? "Saved" : "Cancelled")
|
||||
Design.debugLog(data != nil ? "Saved" : "Cancelled")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user