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 import SwiftUI
struct AttachmentContactsPickerView: View { struct SharingContactsPickerView: View {
@EnvironmentObject var store: AppStore @EnvironmentObject var store: AppStore
@State private var selectedContact: Roster? @State private var selectedContact: Roster?

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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