Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kaulex99 committed Jul 11, 2024
2 parents 76d7a8c + 214ba79 commit 0403354
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 51 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center">
<img src="documentation/wr-square-rounded.png" style="width:200px; border-radius: 15px;"/>
<img src="documentation/wr-square-rounded.png" style="width:200px; border-radius: 15px;" alt="kellner.team logo"/>
</p>
<h1 align="center">WaiterRobot</h1>
<h1 align="center">kellner.team</h1>
<div align="center">
<p>Lightning fast and simple gastronomy</p>
<a href="https://apps.apple.com/at/app/waiterrobot/id1610157234?itsct=apps_box_badge&amp;itscg=30200">
Expand All @@ -11,7 +11,7 @@

# iOS

This Repository includes the iOS version of the WaiterRobot App. It is based on a shared Kotlin-Multiplatform (KMM)
This Repository includes the iOS version of the kellner.team App. It is based on a shared Kotlin-Multiplatform (KMM)
module, which can be found [here](https://github.com/DatepollSystems/waiterrobot-mobile_android-shared) (there you can
also find the Android version of the app).
The KMM module is integrated as a Swift-Package (shared).
Expand Down Expand Up @@ -61,7 +61,7 @@ machine maven.pkg.github.com
For a guide to use a local version of the KMM module
see [KMMBridge local dev spm](https://touchlab.github.io/KMMBridge/spm/IOS_LOCAL_DEV_SPM)

### Short version
### TLRD

1. Run `./gradlew spmDevBuild` in the KMM project (must be run after each change in the KMM module)
2. Drag the whole KMM project folder (top level git folder) into the WaiterRobot project in Xcode
Expand All @@ -73,14 +73,14 @@ see [KMMBridge local dev spm](https://touchlab.github.io/KMMBridge/spm/IOS_LOCAL

Production release is triggered on push to main. The CI then builds the app and deploys it to
TestFlight. After testing the app then must be released manually from there. A tag in the form of
`major.minor.patch` (e.g. android-1.0.0) is created. (see [publish.yml](.github/workflows/publish.yml))
`major.minor.patch` (e.g. 1.0.0) is created. (see [publish.yml](.github/workflows/publish.yml))

> Do not forget to bump the iOS app version ([project.yml](project.yml), CFBundleShortVersionString & CFBundleVersion)
> on the dev branch after a production release was made.
On each push to develop also a lava (dev) build is triggered and published to TestFlight of
the WaiterRobot Lava app. A tag in the form of `major.minor.patch-lava-epochMinutes` is created
(e.g. android-1.0.1-lava-27935730). (see [publish.yml](.github/workflows/publish.yml))
(e.g. 1.0.1-lava-27935730). (see [publish.yml](.github/workflows/publish.yml))

# Language, libraries and tools

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x22",
"red" : "0x9B"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0x3C",
"green" : "0x34",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 3 additions & 3 deletions WaiterRobot/Ui/Billing/BillingScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct BillingScreen: View {
let billItems = Array(viewModel.state.billItemsArray)

content(billItems: billItems)
.navigationTitle(localize.billing.title(value0: table.number.description, value1: table.groupName))
.navigationTitle(localize.billing.title(value0: table.groupName, value1: table.number.description))
.navigationBarTitleDisplayMode(.inline)
.customBackNavigation(
title: localize.dialog.cancel(),
Expand Down Expand Up @@ -63,7 +63,6 @@ struct BillingScreen: View {
}
}
}

// TODO: make only half screen when ios 15 is dropped
.sheet(isPresented: $showPayDialog) {
PayDialog(viewModel: viewModel)
Expand All @@ -76,7 +75,7 @@ struct BillingScreen: View {
VStack {
List {
if billItems.isEmpty {
Text(localize.billing.noOpenBill(value0: table.number.description, value1: table.groupName))
Text(localize.billing.noOpenBill(value0: table.groupName, value1: table.number.description))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding()
Expand Down Expand Up @@ -124,6 +123,7 @@ struct BillingScreen: View {
.font(.system(.title))
.padding()
.tint(.white)
.offset(x: -3)
}
.background(.blue)
.mask(Circle())
Expand Down
2 changes: 1 addition & 1 deletion WaiterRobot/Ui/Order/OrderScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct OrderScreen: View {
currentOder(resource.data)
}
}
.navigationTitle(localize.order.title(value0: table.number.description, value1: table.groupName))
.navigationTitle(localize.order.title(value0: table.groupName, value1: table.number.description))
.navigationBarTitleDisplayMode(.large)
.navigationBarBackButtonHidden()
.confirmationDialog(
Expand Down
85 changes: 64 additions & 21 deletions WaiterRobot/Ui/Order/ProductListItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ import SwiftUI

struct ProductListItem: View {
let product: Product
let backgroundColor: Color?
let onClick: () -> Void

private let allergens: String

init(product: Product, onClick: @escaping () -> Void) {
init(
product: Product,
backgroundColor: Color?,
onClick: @escaping () -> Void
) {
self.product = product
self.backgroundColor = backgroundColor
self.onClick = onClick

var allergens = ""
Expand All @@ -23,29 +29,42 @@ struct ProductListItem: View {
}
}

var body: some View {
ZStack {
RoundedRectangle(cornerRadius: 10, style: .continuous)
.fill(product.soldOut ? Color.gray.opacity(0.1) : Color(.systemBackground))
.shadow(radius: 2)
var foregroundColor: Color {
if product.soldOut {
return .blackWhite
}

if let backgroundColor {
return backgroundColor.getContentColor(lightColorScheme: .black, darkColorScheme: .white)
} else {
return Color.blackWhite
}
}

Button {
onClick()
} label: {
VStack {
Text(product.name)
.strikethrough(product.soldOut)
if !product.allergens.isEmpty {
Text(allergens)
.foregroundColor(.gray)
}
Text(product.price.description())
var body: some View {
Button {
onClick()
} label: {
VStack {
Text(product.name)
.strikethrough(product.soldOut)
.foregroundStyle(foregroundColor)
if !product.allergens.isEmpty {
Text(allergens)
.foregroundStyle(foregroundColor)
.opacity(0.6)
}
.foregroundColor(.blackWhite)
.frame(maxWidth: .infinity)
.padding(5)
Text(product.price.description())
}
.disabled(product.soldOut)
.foregroundStyle(foregroundColor)
.frame(maxWidth: .infinity)
.padding(5)
}
.disabled(product.soldOut)
.background {
RoundedRectangle(cornerRadius: 10, style: .continuous)
.fill(product.soldOut ? Color.gray.opacity(0.1) : backgroundColor ?? Color(.systemBackground))
.shadow(radius: 2)
}
}
}
Expand All @@ -66,6 +85,30 @@ struct ProductListItem: View {
],
position: 1
),
backgroundColor: .yellow,
onClick: {}
)
.frame(maxWidth: 100, maxHeight: 100)
}

#Preview {
ProductListItem(
product: Product(
id: 2,
name: "Wine",
price: Money(cents: 290),
soldOut: false,
allergens: [
Allergen(id: 1, name: "Egg", shortName: "E"),
Allergen(id: 2, name: "Egg2", shortName: "A"),
Allergen(id: 3, name: "Egg3", shortName: "B"),
Allergen(id: 4, name: "Egg4", shortName: "C"),
Allergen(id: 5, name: "Egg5", shortName: "D"),
],
position: 1
),
backgroundColor: .yellow,
onClick: {}
)
.frame(maxWidth: 100, maxHeight: 100)
}
1 change: 1 addition & 0 deletions WaiterRobot/Ui/Order/Search/ProductSearch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct ProductSearch: View {
LazyVGrid(columns: layout, spacing: 0) {
ProductSearchGroupList(
products: groupWithProducts.products,
backgroundColor: Color(hex: groupWithProducts.color),
onProductClick: {
viewModel.actual.addItem(product: $0, amount: 1)
dismiss()
Expand Down
2 changes: 2 additions & 0 deletions WaiterRobot/Ui/Order/Search/ProductSearchAllTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct ProductSearchAllTab: View {
Section {
ProductSearchGroupList(
products: productGroup.products,
backgroundColor: Color(hex: productGroup.color),
onProductClick: onProductClick
)
} header: {
Expand All @@ -38,6 +39,7 @@ struct ProductSearchAllTab: View {
id: 1,
name: "Test Group 1",
position: 1,
color: "",
products: [
Product(
id: 1,
Expand Down
4 changes: 3 additions & 1 deletion WaiterRobot/Ui/Order/Search/ProductSearchGroupList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import SwiftUI

struct ProductSearchGroupList: View {
let products: [Product]
let backgroundColor: Color?
let onProductClick: (Product) -> Void

var body: some View {
ForEach(products, id: \.id) { product in
ProductListItem(product: product) {
ProductListItem(product: product, backgroundColor: backgroundColor) {
onProductClick(product)
}
.foregroundColor(.blackWhite)
Expand All @@ -29,6 +30,7 @@ struct ProductSearchGroupList: View {
position: 1
),
],
backgroundColor: .yellow,
onProductClick: { _ in }
)
}
Expand Down
4 changes: 2 additions & 2 deletions WaiterRobot/Ui/TableDetail/TableDetailScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct TableDetailScreen: View {

var body: some View {
content()
.navigationTitle(localize.tableDetail.title(value0: table.number.description, value1: table.groupName))
.navigationTitle(localize.tableDetail.title(value0: table.groupName, value1: table.number.description))
.withViewModel(viewModel, navigator)
}

Expand Down Expand Up @@ -45,7 +45,7 @@ struct TableDetailScreen: View {
if orderedItems.isEmpty {
Spacer()

Text(localize.tableDetail.noOrder(value0: table.number.description, value1: table.groupName))
Text(localize.tableDetail.noOrder(value0: table.groupName, value1: table.number.description))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding()
Expand Down
25 changes: 17 additions & 8 deletions WaiterRobot/Ui/TableList/TableGroupSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct TableGroupSection: View {
TableView(
text: table.number.description,
hasOrders: table.hasOrders,
backgroundColor: Color(hex: tableGroup.color),
onClick: {
onTableClick(table)
}
Expand All @@ -19,19 +20,27 @@ struct TableGroupSection: View {
}
} header: {
HStack {
Text(tableGroup.name)
.font(.title2)
.foregroundStyle(.white)
.padding(6)
.background {
RoundedRectangle(cornerRadius: 8.0)
.foregroundStyle(Color(.main))
}
if let background = Color(hex: tableGroup.color) {
title(backgroundColor: background)
} else {
title(backgroundColor: .gray.opacity(0.3))
}

Spacer()
}
}
}

private func title(backgroundColor: Color) -> some View {
Text(tableGroup.name)
.font(.title2)
.foregroundStyle(backgroundColor.getContentColor(lightColorScheme: .black, darkColorScheme: .white))
.padding(6)
.background {
RoundedRectangle(cornerRadius: 8.0)
.foregroundStyle(backgroundColor)
}
}
}

#Preview {
Expand Down
Loading

0 comments on commit 0403354

Please sign in to comment.