mirror of
https://github.com/Ferrite-iOS/Ferrite.git
synced 2026-01-11 20:10:27 +00:00
If a debrid is authorized, a Published variable needs to be notified since SwiftUI can't read computed properties on the fly (they are getters). Therefore, it's better to maintain a single source of truth of which services are logged in. Signed-off-by: kingbri <bdashore3@proton.me>
31 lines
978 B
Swift
31 lines
978 B
Swift
//
|
|
// LibraryPickerView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 2/13/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct LibraryPickerView: View {
|
|
@Environment(\.verticalSizeClass) var verticalSizeClass
|
|
|
|
@EnvironmentObject var debridManager: DebridManager
|
|
@EnvironmentObject var navModel: NavigationViewModel
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Picker("Segments", selection: $navModel.libraryPickerSelection) {
|
|
Text("Bookmarks").tag(NavigationViewModel.LibraryPickerSegment.bookmarks)
|
|
Text("History").tag(NavigationViewModel.LibraryPickerSegment.history)
|
|
|
|
if !debridManager.enabledDebrids.isEmpty {
|
|
Text("Cloud").tag(NavigationViewModel.LibraryPickerSegment.debridCloud)
|
|
}
|
|
}
|
|
}
|
|
.pickerStyle(.segmented)
|
|
.padding(.horizontal, verticalSizeClass == .compact && UIDevice.current.hasNotch ? 65 : 18)
|
|
.padding(.vertical, 5)
|
|
}
|
|
}
|