mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-27 19:06:23 +02:00
Refactor navigation button labels and enhance SettingsView with app version display and keyboard dismissal functionality
This commit is contained in:
parent
5c18cb1bbb
commit
c6415d7e32
3 changed files with 65 additions and 23 deletions
|
@ -96,8 +96,8 @@ struct GameInfoSheet: View {
|
|||
.navigationTitle(game.titleName)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button("Done") {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button("Dismiss") {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,6 +239,7 @@ struct GameLibraryView: View {
|
|||
}
|
||||
|
||||
// Library Section
|
||||
if !filteredGames.isEmpty {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Library")
|
||||
.font(.headline)
|
||||
|
@ -261,6 +262,7 @@ struct GameLibraryView: View {
|
|||
.padding(.vertical, 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ForEach(filteredGames) { game in
|
||||
GameListRow(
|
||||
|
|
|
@ -93,6 +93,15 @@ struct SettingsView: View {
|
|||
}
|
||||
}
|
||||
|
||||
var appVersion: String {
|
||||
guard let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else {
|
||||
return "Unknown"
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
@FocusState private var isArgumentsKeyboardVisible: Bool
|
||||
|
||||
var body: some View {
|
||||
iOSNav {
|
||||
ZStack {
|
||||
|
@ -145,6 +154,7 @@ struct SettingsView: View {
|
|||
}
|
||||
.padding(.bottom)
|
||||
}
|
||||
.scrollDismissesKeyboardIfAvailable()
|
||||
}
|
||||
}
|
||||
.navigationTitle("Settings")
|
||||
|
@ -189,6 +199,14 @@ struct SettingsView: View {
|
|||
Text("\(memoryText) RAM")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
Text("·")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
Text("Version \(appVersion)")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
// Device cards
|
||||
|
@ -747,7 +765,7 @@ struct SettingsView: View {
|
|||
.foregroundColor(.primary)
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
TextField("Separate arguments with commas", text: Binding(
|
||||
TextField("Separate arguments with commas" ,text: Binding(
|
||||
get: {
|
||||
config.additionalArgs.joined(separator: ", ")
|
||||
},
|
||||
|
@ -762,6 +780,14 @@ struct SettingsView: View {
|
|||
.textInputAutocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.padding(.vertical, 4)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .keyboard) {
|
||||
Button("Dismiss") {
|
||||
isArgumentsKeyboardVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
.focused($isArgumentsKeyboardVisible)
|
||||
} else {
|
||||
TextField("Separate arguments with commas", text: Binding(
|
||||
get: {
|
||||
|
@ -1013,6 +1039,7 @@ struct CategoryButton: View {
|
|||
RoundedRectangle(cornerRadius: 12)
|
||||
.fill(isSelected ? Color.blue.opacity(0.15) : Color.clear)
|
||||
)
|
||||
.animation(.bouncy(duration: 0.3), value: isSelected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1122,3 +1149,16 @@ struct InfoCard: View {
|
|||
.cornerRadius(8)
|
||||
}
|
||||
}
|
||||
|
||||
// this code is used to enable the keyboard to be dismissed when scrolling if available on iOS 16+
|
||||
extension View {
|
||||
@ViewBuilder
|
||||
func scrollDismissesKeyboardIfAvailable() -> some View {
|
||||
if #available(iOS 16.0, *) {
|
||||
self.scrollDismissesKeyboard(.interactively)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue