This commit is contained in:
fmodf 2024-07-13 15:58:38 +02:00
parent 37936b9903
commit d2b536509a
7 changed files with 22 additions and 22 deletions

View file

@ -1,6 +1,6 @@
import SwiftUI
struct AttachmentContactsPickerView: View {
struct SharingContactsPickerView: View {
@EnvironmentObject var store: AppStore
@State private var selectedContact: Roster?

View file

@ -1,7 +1,7 @@
import SwiftUI
import UIKit
struct AttachmentFilesPickerView: View {
struct SharingFilesPickerView: View {
@EnvironmentObject var store: AppStore
var body: some View {

View file

@ -1,6 +1,6 @@
import SwiftUI
struct AttachmentHeader: View {
struct SharingHeader: View {
@EnvironmentObject var store: AppStore
var body: some View {

View file

@ -1,7 +1,7 @@
import MapKit
import SwiftUI
struct AttachmentLocationPickerView: View {
struct SharingLocationPickerView: View {
@StateObject var locationManager = LocationManager()
@State private var region = MKCoordinateRegion()

View file

@ -3,7 +3,7 @@ import MobileCoreServices
import Photos
import SwiftUI
struct AttachmentMediaPickerView: View {
struct SharingMediaPickerView: View {
@EnvironmentObject var store: AppStore
@State private var showCameraPicker = false
@State private var cameraReady = false

View file

@ -3,7 +3,7 @@ import SwiftUI
struct AttachmentPickerScreen: View {
@EnvironmentObject var store: AppStore
@State private var selectedTab: AttachmentTab = .media
@State private var selectedTab: SharingTab = .media
var body: some View {
ZStack {
@ -14,25 +14,25 @@ struct AttachmentPickerScreen: View {
// Content
VStack(spacing: 0) {
// Header
AttachmentHeader()
SharingHeader()
// Pickers
switch selectedTab {
case .media:
AttachmentMediaPickerView()
SharingMediaPickerView()
case .files:
AttachmentFilesPickerView()
SharingFilesPickerView()
case .location:
AttachmentLocationPickerView()
SharingLocationPickerView()
case .contacts:
AttachmentContactsPickerView()
SharingContactsPickerView()
}
// Tab bar
AttachmentTabBar(selectedTab: $selectedTab)
SharingTabBar(selectedTab: $selectedTab)
}
}
}

View file

@ -1,14 +1,14 @@
import SwiftUI
enum AttachmentTab: Int, CaseIterable {
enum SharingTab: Int, CaseIterable {
case media
case files
case location
case contacts
}
struct AttachmentTabBar: View {
@Binding var selectedTab: AttachmentTab
struct SharingTabBar: View {
@Binding var selectedTab: SharingTab
var body: some View {
VStack(spacing: 0) {
@ -17,10 +17,10 @@ struct AttachmentTabBar: View {
.frame(height: 0.2)
.foregroundColor(.Material.Shape.separator)
HStack(spacing: 0) {
AttachmentTabBarButton(tab: .media, selected: $selectedTab)
AttachmentTabBarButton(tab: .files, selected: $selectedTab)
AttachmentTabBarButton(tab: .location, selected: $selectedTab)
AttachmentTabBarButton(tab: .contacts, selected: $selectedTab)
SharingTabBarButton(tab: .media, selected: $selectedTab)
SharingTabBarButton(tab: .files, selected: $selectedTab)
SharingTabBarButton(tab: .location, selected: $selectedTab)
SharingTabBarButton(tab: .contacts, selected: $selectedTab)
}
.background(Color.Material.Background.dark)
}
@ -28,9 +28,9 @@ struct AttachmentTabBar: View {
}
}
private struct AttachmentTabBarButton: View {
let tab: AttachmentTab
@Binding var selected: AttachmentTab
private struct SharingTabBarButton: View {
let tab: SharingTab
@Binding var selected: SharingTab
var body: some View {
ZStack {