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