mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 04:25:21 +00:00
Gesture-based photo access: Tap for library, long-press for camera
UX improvements: - Tap camera icon → Photo library (common use case) - Long press camera icon (0.3s) → Direct camera (quick photos) - Removed action sheet entirely for cleaner flow - Power users can long-press for instant camera access This is more discoverable and eliminates an extra step in the UI.
This commit is contained in:
@@ -71,7 +71,6 @@ struct ContentView: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@State private var showImagePicker = false
|
@State private var showImagePicker = false
|
||||||
@State private var imagePickerSourceType: UIImagePickerController.SourceType = .camera
|
@State private var imagePickerSourceType: UIImagePickerController.SourceType = .camera
|
||||||
@State private var showImageSourcePicker = false
|
|
||||||
#endif
|
#endif
|
||||||
@ScaledMetric(relativeTo: .body) private var headerHeight: CGFloat = 44
|
@ScaledMetric(relativeTo: .body) private var headerHeight: CGFloat = 44
|
||||||
@ScaledMetric(relativeTo: .subheadline) private var headerPeerIconSize: CGFloat = 11
|
@ScaledMetric(relativeTo: .subheadline) private var headerPeerIconSize: CGFloat = 11
|
||||||
@@ -223,17 +222,6 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.confirmationDialog("Add Photo", isPresented: $showImageSourcePicker, titleVisibility: .visible) {
|
|
||||||
Button("Take Photo") {
|
|
||||||
imagePickerSourceType = .camera
|
|
||||||
showImagePicker = true
|
|
||||||
}
|
|
||||||
Button("Choose from Library") {
|
|
||||||
imagePickerSourceType = .photoLibrary
|
|
||||||
showImagePicker = true
|
|
||||||
}
|
|
||||||
Button("Cancel", role: .cancel) {}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
.sheet(isPresented: Binding(
|
.sheet(isPresented: Binding(
|
||||||
get: { imagePreviewURL != nil },
|
get: { imagePreviewURL != nil },
|
||||||
@@ -1816,18 +1804,29 @@ private extension ContentView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var attachmentButton: some View {
|
var attachmentButton: some View {
|
||||||
Button(action: {
|
#if os(iOS)
|
||||||
#if os(iOS)
|
Image(systemName: "camera.circle.fill")
|
||||||
showImageSourcePicker = true
|
.font(.bitchatSystem(size: 24))
|
||||||
#endif
|
.foregroundColor(composerAccentColor)
|
||||||
}) {
|
.frame(width: 36, height: 36)
|
||||||
Image(systemName: "camera.circle.fill")
|
.contentShape(Circle())
|
||||||
.font(.bitchatSystem(size: 24))
|
.onTapGesture {
|
||||||
.foregroundColor(composerAccentColor)
|
// Tap = Photo Library
|
||||||
.frame(width: 36, height: 36)
|
imagePickerSourceType = .photoLibrary
|
||||||
}
|
showImagePicker = true
|
||||||
.buttonStyle(.plain)
|
}
|
||||||
.accessibilityLabel("Add photo")
|
.onLongPressGesture(minimumDuration: 0.3) {
|
||||||
|
// Long press = Camera
|
||||||
|
imagePickerSourceType = .camera
|
||||||
|
showImagePicker = true
|
||||||
|
}
|
||||||
|
.accessibilityLabel("Tap for library, long press for camera")
|
||||||
|
#else
|
||||||
|
Image(systemName: "camera.circle.fill")
|
||||||
|
.font(.bitchatSystem(size: 24))
|
||||||
|
.foregroundColor(composerAccentColor)
|
||||||
|
.frame(width: 36, height: 36)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
var sendOrMicButton: some View {
|
var sendOrMicButton: some View {
|
||||||
|
|||||||
Reference in New Issue
Block a user