mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-21 04:56:06 +00:00
wip
This commit is contained in:
@@ -27,7 +27,16 @@ struct NetworkAndServers: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
presetServersSection()
|
||||
let smpServers = [ServerCfg.sampleData.preset, ServerCfg.sampleData.preset]
|
||||
let xftpServers = [ServerCfg.sampleData.xftpPreset, ServerCfg.sampleData.xftpPreset]
|
||||
Section {
|
||||
ForEach($serverOperators) { srvOperator in
|
||||
serverOperatorView(srvOperator, smpServers, xftpServers)
|
||||
}
|
||||
} header: {
|
||||
Text("Preset servers")
|
||||
.foregroundColor(theme.colors.secondary)
|
||||
}
|
||||
|
||||
Section {
|
||||
NavigationLink {
|
||||
@@ -79,19 +88,6 @@ struct NetworkAndServers: View {
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder private func presetServersSection() -> some View {
|
||||
let smpServers = [ServerCfg.sampleData.preset, ServerCfg.sampleData.preset]
|
||||
let xftpServers = [ServerCfg.sampleData.xftpPreset, ServerCfg.sampleData.xftpPreset]
|
||||
Section {
|
||||
ForEach($serverOperators) { srvOperator in
|
||||
serverOperatorView(srvOperator, smpServers, xftpServers)
|
||||
}
|
||||
} header: {
|
||||
Text("Preset servers")
|
||||
.foregroundColor(theme.colors.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder private func serverOperatorView(
|
||||
_ serverOperator: Binding<ServerOperator>,
|
||||
_ smpServers: [ServerCfg],
|
||||
|
||||
@@ -32,9 +32,6 @@ struct OperatorView: View {
|
||||
Section {
|
||||
infoViewLink()
|
||||
useOperatorToggle()
|
||||
if serverOperatorToEdit.enabled || serverOperatorToEdit.conditionsAcceptance.conditionsAccepted {
|
||||
viewConditionsButton()
|
||||
}
|
||||
} header: {
|
||||
Text("Operator")
|
||||
.foregroundColor(theme.colors.secondary)
|
||||
@@ -42,9 +39,11 @@ struct OperatorView: View {
|
||||
switch (serverOperatorToEdit.conditionsAcceptance) {
|
||||
case let .accepted(date):
|
||||
Text("Conditions accepted on: \(conditionsTimestamp(date)).")
|
||||
.foregroundColor(theme.colors.secondary)
|
||||
case let .reviewAvailable(deadline):
|
||||
if serverOperatorToEdit.enabled {
|
||||
Text("Review conditions until: \(conditionsTimestamp(deadline)).")
|
||||
.foregroundColor(theme.colors.secondary)
|
||||
}
|
||||
case .reviewRequired:
|
||||
EmptyView()
|
||||
@@ -142,18 +141,6 @@ struct OperatorView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func viewConditionsButton() -> some View {
|
||||
Button {
|
||||
showConditionsSheet = true
|
||||
} label: {
|
||||
if case .accepted = serverOperatorToEdit.conditionsAcceptance {
|
||||
Text("Conditions accepted")
|
||||
} else {
|
||||
Text("Review conditions")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func usageRolesSection() -> some View {
|
||||
Section(header: Text("Use operator").foregroundColor(theme.colors.secondary)) {
|
||||
Toggle("For storage", isOn: $serverOperatorToEdit.roles.storage)
|
||||
|
||||
Reference in New Issue
Block a user