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)
|
.navigationTitle(game.titleName)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .navigationBarTrailing) {
|
ToolbarItem(placement: .cancellationAction) {
|
||||||
Button("Done") {
|
Button("Dismiss") {
|
||||||
presentationMode.wrappedValue.dismiss()
|
presentationMode.wrappedValue.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,26 +239,28 @@ struct GameLibraryView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Library Section
|
// Library Section
|
||||||
VStack(alignment: .leading) {
|
if !filteredGames.isEmpty {
|
||||||
Text("Library")
|
VStack(alignment: .leading) {
|
||||||
.font(.headline)
|
Text("Library")
|
||||||
.foregroundColor(.primary)
|
.font(.headline)
|
||||||
.padding(.horizontal)
|
.foregroundColor(.primary)
|
||||||
.padding(.top)
|
.padding(.horizontal)
|
||||||
|
.padding(.top)
|
||||||
ForEach(filteredGames) { game in
|
|
||||||
GameListRow(
|
ForEach(filteredGames) { game in
|
||||||
game: game,
|
GameListRow(
|
||||||
startemu: $startemu,
|
game: game,
|
||||||
games: games,
|
startemu: $startemu,
|
||||||
isViewingGameInfo: $isViewingGameInfo,
|
games: games,
|
||||||
isSelectingGameUpdate: $isSelectingGameUpdate,
|
isViewingGameInfo: $isViewingGameInfo,
|
||||||
isSelectingGameDLC: $isSelectingGameDLC,
|
isSelectingGameUpdate: $isSelectingGameUpdate,
|
||||||
gameRequirements: $gameRequirements,
|
isSelectingGameDLC: $isSelectingGameDLC,
|
||||||
gameInfo: $gameInfo
|
gameRequirements: $gameRequirements,
|
||||||
)
|
gameInfo: $gameInfo
|
||||||
.padding(.horizontal, 3)
|
)
|
||||||
.padding(.vertical, 8)
|
.padding(.horizontal, 3)
|
||||||
|
.padding(.vertical, 8)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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 {
|
var body: some View {
|
||||||
iOSNav {
|
iOSNav {
|
||||||
ZStack {
|
ZStack {
|
||||||
|
@ -145,6 +154,7 @@ struct SettingsView: View {
|
||||||
}
|
}
|
||||||
.padding(.bottom)
|
.padding(.bottom)
|
||||||
}
|
}
|
||||||
|
.scrollDismissesKeyboardIfAvailable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle("Settings")
|
.navigationTitle("Settings")
|
||||||
|
@ -189,6 +199,14 @@ struct SettingsView: View {
|
||||||
Text("\(memoryText) RAM")
|
Text("\(memoryText) RAM")
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text("·")
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text("Version \(appVersion)")
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Device cards
|
// Device cards
|
||||||
|
@ -747,7 +765,7 @@ struct SettingsView: View {
|
||||||
.foregroundColor(.primary)
|
.foregroundColor(.primary)
|
||||||
|
|
||||||
if #available(iOS 15.0, *) {
|
if #available(iOS 15.0, *) {
|
||||||
TextField("Separate arguments with commas", text: Binding(
|
TextField("Separate arguments with commas" ,text: Binding(
|
||||||
get: {
|
get: {
|
||||||
config.additionalArgs.joined(separator: ", ")
|
config.additionalArgs.joined(separator: ", ")
|
||||||
},
|
},
|
||||||
|
@ -762,6 +780,14 @@ struct SettingsView: View {
|
||||||
.textInputAutocapitalization(.none)
|
.textInputAutocapitalization(.none)
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
.padding(.vertical, 4)
|
.padding(.vertical, 4)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .keyboard) {
|
||||||
|
Button("Dismiss") {
|
||||||
|
isArgumentsKeyboardVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.focused($isArgumentsKeyboardVisible)
|
||||||
} else {
|
} else {
|
||||||
TextField("Separate arguments with commas", text: Binding(
|
TextField("Separate arguments with commas", text: Binding(
|
||||||
get: {
|
get: {
|
||||||
|
@ -1013,6 +1039,7 @@ struct CategoryButton: View {
|
||||||
RoundedRectangle(cornerRadius: 12)
|
RoundedRectangle(cornerRadius: 12)
|
||||||
.fill(isSelected ? Color.blue.opacity(0.15) : Color.clear)
|
.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)
|
.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