Add localization support, add drink icons in list, fix display error for out-of-stock favourites, fix low-res profile picture

This commit is contained in:
2025-04-23 22:35:46 +02:00
parent 5121d14b55
commit d6af1a7438
12 changed files with 674 additions and 71 deletions
+5 -5
View File
@@ -52,14 +52,14 @@ struct ContentView: View {
NavigationView {
List() {
// Drinks
Section("Favourites") {
Section(String(localized: "FAVOURITES")) {
ForEach(favouriteDrinks) { drink in
NavigationLink(drink.name) {
DrinkDetailView(wcMgr: wcMgr, drink: drink)
}
}
}
Section("Drinks") {
Section(String(localized: "DRINKS")) {
ForEach(availableDrinks) { drink in
NavigationLink(drink.name) {
DrinkDetailView(wcMgr: wcMgr, drink: drink)
@@ -69,7 +69,7 @@ struct ContentView: View {
// Controls
Section {
Button("Refresh") {
Button(String(localized: "REFRESH")) {
favouriteDrinks = []
availableDrinks = []
update()
@@ -83,9 +83,9 @@ struct ContentView: View {
}
.onAppear(perform: update)
// Alert to communicate an error in communication with the paired device
.alert("Connection Error", isPresented: $showUpdateError) {
.alert(String(localized: "CONNECTION_ERROR"), isPresented: $showUpdateError) {
Text(updateError).tint(.red).font(.footnote)
Button("Retry", systemImage: "arrow.clockwise", action: update)
Button(String(localized: "RETRY"), systemImage: "arrow.clockwise", action: update)
}
}
}
+3 -3
View File
@@ -29,12 +29,12 @@ struct DrinkDetailView: View {
HStack {
VStack {
Text(String(format: "%img", drink.caffeine)).fontWeight(.bold)
Text("Caffeine").fontWeight(Font.Weight.thin)
Text(String(localized: "CAFFEINE")).fontWeight(Font.Weight.thin)
}
Divider()
VStack {
Text(String(format: "%.2f€", drink.GetPrice())).fontWeight(.bold)
Text("Price").fontWeight(Font.Weight.thin)
Text(String(localized: "PRICE")).fontWeight(Font.Weight.thin)
}
}
@@ -43,7 +43,7 @@ struct DrinkDetailView: View {
// Open the transaction sheet
shouldShowTransactionSheet = true
}) {
Text("Poison picked!")
Text(String(localized: "POISON_PICKED"))
}.tint(.green)
}
+1 -1
View File
@@ -11,7 +11,7 @@ struct TransactionView: View {
private var wcMgr: WCManager
private var drinkID: Int
@State var statusLine = "Booking..."
@State var statusLine = String(localized: "BOOKING")
@Environment(\.dismiss) private var dismiss