Fixed Dark Mode for AnisetteServerList.swift

Signed-off-by: Stephen <158498287+0-Blu@users.noreply.github.com>
This commit is contained in:
Stephen
2024-08-12 16:53:45 -04:00
committed by GitHub
parent 8b782c9416
commit b43fd0a54b

View File

@@ -59,7 +59,8 @@ struct AnisetteServers: View {
var body: some View { var body: some View {
ZStack { ZStack {
Color(UIColor.systemBackground).ignoresSafeArea() Color(UIColor.systemBackground)
.ignoresSafeArea()
.onAppear { .onAppear {
viewModel.getListOfServers() viewModel.getListOfServers()
} }
@@ -92,14 +93,11 @@ struct AnisetteServers: View {
} }
.padding() .padding()
.background(RoundedRectangle(cornerRadius: 10).fill(Color(UIColor.secondarySystemBackground))) .background(RoundedRectangle(cornerRadius: 10).fill(Color(UIColor.secondarySystemBackground)))
.shadow(color: Color.gray.opacity(0.4), radius: 5, x: 0, y: 5) .shadow(color: Color.black.opacity(0.2), radius: 5, x: 0, y: 5)
.listRowSeparatorTint(.white)
.listRowBackground(Color(UIColor.systemBackground).ignoresSafeArea())
} }
.listStyle(.plain) .listStyle(.plain)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.listRowBackground(Color(UIColor.systemBackground).ignoresSafeArea()) .listRowBackground(Color(UIColor.systemBackground))
} else { } else {
List(selection: $selected) { List(selection: $selected) {
ForEach($viewModel.servers, id: \.name) { server in ForEach($viewModel.servers, id: \.name) { server in
@@ -117,26 +115,23 @@ struct AnisetteServers: View {
} }
.padding() .padding()
.background(RoundedRectangle(cornerRadius: 10).fill(Color(UIColor.secondarySystemBackground))) .background(RoundedRectangle(cornerRadius: 10).fill(Color(UIColor.secondarySystemBackground)))
.shadow(color: Color.black.opacity(0.1), radius: 5, x: 0, y: 5) .shadow(color: Color.black.opacity(0.2), radius: 5, x: 0, y: 5)
} }
.listStyle(.plain) .listStyle(.plain)
// Fallback on earlier versions
} }
VStack(spacing: 16) { VStack(spacing: 16) {
// TextField with gray background
TextField("Anisette Server List", text: $viewModel.source) TextField("Anisette Server List", text: $viewModel.source)
.padding() .padding()
.background(RoundedRectangle(cornerRadius: 10).fill(Color.gray)) .background(RoundedRectangle(cornerRadius: 10).fill(Color(UIColor.secondarySystemFill)))
.foregroundColor(.white) .foregroundColor(.primary)
.frame(height: 60) .frame(height: 60)
.shadow(color: Color.gray.opacity(0.4), radius: 10, x: 0, y: 5) .shadow(color: Color.black.opacity(0.2), radius: 5, x: 0, y: 5)
.onChange(of: viewModel.source) { newValue in .onChange(of: viewModel.source) { newValue in
UserDefaults.standard.menuAnisetteList = newValue UserDefaults.standard.menuAnisetteList = newValue
viewModel.getListOfServers() viewModel.getListOfServers()
} }
// Back and Refresh Buttons next to each other
HStack(spacing: 16) { HStack(spacing: 16) {
SUIButton(action: { SUIButton(action: {
presentationMode.wrappedValue.dismiss() presentationMode.wrappedValue.dismiss()
@@ -165,7 +160,6 @@ struct AnisetteServers: View {
.shadow(color: Color.accentColor.opacity(0.4), radius: 10, x: 0, y: 5) .shadow(color: Color.accentColor.opacity(0.4), radius: 10, x: 0, y: 5)
} }
// Reset Button below Back and Refresh
SUIButton(action: { SUIButton(action: {
#if !DEBUG #if !DEBUG
if Keychain.shared.adiPb != nil { if Keychain.shared.adiPb != nil {
@@ -189,7 +183,7 @@ struct AnisetteServers: View {
.padding(.horizontal) .padding(.horizontal)
} }
} }
.navigationBarHidden(true) // Hide the navigation bar if you don't need it .navigationBarHidden(true)
.navigationTitle("") // Remove title to avoid extra space .navigationTitle("")
} }
} }