Migrate to directory mode
This commit is contained in:
@@ -1,40 +0,0 @@
|
|||||||
import Libbox
|
|
||||||
import Library
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
public struct MenuLabel: View {
|
|
||||||
@EnvironmentObject private var environments: ExtensionEnvirnments
|
|
||||||
|
|
||||||
public init() {}
|
|
||||||
public var body: some View {
|
|
||||||
// if let profile = environments.extensionProfile {
|
|
||||||
// MenuLabel0().environmentObject(profile)
|
|
||||||
// } else {
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct MenuLabel0: View {
|
|
||||||
@EnvironmentObject private var environments: ExtensionEnvirnments
|
|
||||||
@EnvironmentObject private var extensionProfile: ExtensionProfile
|
|
||||||
@StateObject private var commandClient = CommandClient(.status)
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
HStack {
|
|
||||||
if extensionProfile.status.isConnectedStrict, let message = commandClient.status {
|
|
||||||
Image("MenuIcon")
|
|
||||||
Text(" ↑ \(LibboxFormatBytes(message.uplink))/s ↓ \(LibboxFormatBytes(message.downlink))/s")
|
|
||||||
} else {
|
|
||||||
Image("MenuIcon")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onAppear {
|
|
||||||
commandClient.connect()
|
|
||||||
}
|
|
||||||
.onChangeCompat(of: extensionProfile.status) { newValue in
|
|
||||||
if newValue.isConnectedStrict {
|
|
||||||
commandClient.connect()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import ApplicationLibrary
|
|
||||||
import Library
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct ContentView: View {
|
|
||||||
@Environment(\.selection) private var selection
|
|
||||||
@Environment(\.extensionProfile) private var extensionProfile
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
viewBuilder {
|
|
||||||
if let profile = extensionProfile.wrappedValue {
|
|
||||||
ContentView0().environmentObject(profile)
|
|
||||||
} else {
|
|
||||||
ContentView1()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ContentView0: View {
|
|
||||||
@Environment(\.selection) private var selection
|
|
||||||
@EnvironmentObject private var extensionProfile: ExtensionProfile
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
TabView(selection: selection) {
|
|
||||||
ForEach(NavigationPage.allCases.filter { it in
|
|
||||||
it.visible(extensionProfile)
|
|
||||||
}, id: \.self) { page in
|
|
||||||
NavigationStackCompat {
|
|
||||||
page.contentView
|
|
||||||
}
|
|
||||||
.tag(page)
|
|
||||||
.tabItem { page.label }
|
|
||||||
}
|
|
||||||
}.onChangeCompat(of: extensionProfile.status) {
|
|
||||||
if !selection.wrappedValue.visible(extensionProfile) {
|
|
||||||
selection.wrappedValue = NavigationPage.dashboard
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ContentView1: View {
|
|
||||||
@Environment(\.selection) private var selection
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
TabView(selection: selection) {
|
|
||||||
ForEach(NavigationPage.allCases.filter { it in
|
|
||||||
it.visible(nil)
|
|
||||||
}, id: \.self) { page in
|
|
||||||
NavigationStackCompat {
|
|
||||||
page.contentView
|
|
||||||
}
|
|
||||||
.tag(page)
|
|
||||||
.tabItem { page.label }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
import ApplicationLibrary
|
|
||||||
import Library
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct ContentView: View {
|
|
||||||
@Environment(\.selection) private var selection
|
|
||||||
@Environment(\.extensionProfile) private var extensionProfile
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
viewBuilder {
|
|
||||||
if let profile = extensionProfile.wrappedValue {
|
|
||||||
ContentView0().environmentObject(profile)
|
|
||||||
} else {
|
|
||||||
ContentView1()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ContentView0: View {
|
|
||||||
@Environment(\.selection) private var selection
|
|
||||||
@EnvironmentObject private var extensionProfile: ExtensionProfile
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
TabView(selection: selection) {
|
|
||||||
ForEach(NavigationPage.allCases.filter { it in
|
|
||||||
it.visible(extensionProfile)
|
|
||||||
}, id: \.self) { page in
|
|
||||||
NavigationStackCompat {
|
|
||||||
page.contentView
|
|
||||||
.focusSection()
|
|
||||||
}
|
|
||||||
.tag(page)
|
|
||||||
.tabItem { page.label }
|
|
||||||
}
|
|
||||||
}.onChangeCompat(of: extensionProfile.status) {
|
|
||||||
if !selection.wrappedValue.visible(extensionProfile) {
|
|
||||||
selection.wrappedValue = NavigationPage.dashboard
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ContentView1: View {
|
|
||||||
@Environment(\.selection) private var selection
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
TabView(selection: selection) {
|
|
||||||
ForEach(NavigationPage.allCases.filter { it in
|
|
||||||
it.visible(nil)
|
|
||||||
}, id: \.self) { page in
|
|
||||||
NavigationStackCompat {
|
|
||||||
page.contentView
|
|
||||||
.focusSection()
|
|
||||||
}
|
|
||||||
.tag(page)
|
|
||||||
.tabItem { page.label }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+174
-709
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user