Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order / Billing refactoring #32

Merged
merged 17 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,5 @@ xcuserdata/
.env.*
!.env.example

.idea
.idea
fastlane/.env
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org'

gem 'fastlane'
gem 'fastlane', '2.219.0'
53 changes: 28 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.6)
CFPropertyList (3.0.7)
base64
nkf
rexml
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.877.0)
aws-sdk-core (3.190.1)
aws-partitions (1.894.0)
aws-sdk-core (3.191.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.76.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sdk-kms (1.77.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.142.0)
aws-sdk-core (~> 3, >= 3.189.0)
aws-sdk-s3 (1.143.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
claide (1.1.0)
colored (1.2)
colored2 (3.1.2)
Expand All @@ -32,7 +35,7 @@ GEM
declarative (0.0.20)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.6.20231109)
domain_name (0.6.20240107)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.109.0)
Expand Down Expand Up @@ -65,7 +68,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.3.0)
fastlane (2.218.0)
fastlane (2.219.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -84,6 +87,7 @@ GEM
gh_inspector (>= 1.1.2, < 2.0.0)
google-apis-androidpublisher_v3 (~> 0.3)
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-env (>= 1.6.0, < 2.0.0)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
http-cookie (~> 1.0.5)
Expand All @@ -108,38 +112,36 @@ GEM
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.2)
google-apis-core (0.11.3)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.29.0)
google-apis-storage_v1 (0.31.0)
google-apis-core (>= 0.11.0, < 2.a)
google-cloud-core (1.6.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.0)
faraday (>= 1.0, < 3.a)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.1)
google-cloud-storage (1.45.0)
google-cloud-storage (1.47.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.29.0)
google-apis-storage_v1 (~> 0.31.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.9.1)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
Expand All @@ -150,13 +152,15 @@ GEM
httpclient (2.8.3)
jmespath (1.6.2)
json (2.7.1)
jwt (2.7.1)
jwt (2.8.0)
base64
mini_magick (4.12.0)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.3.0)
multipart-post (2.4.0)
nanaimo (0.3.0)
naturally (2.2.1)
nkf (0.2.0)
optparse (0.4.0)
os (1.1.4)
plist (3.7.1)
Expand All @@ -172,7 +176,7 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.18.0)
signet (0.19.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
Expand All @@ -190,9 +194,8 @@ GEM
tty-cursor (~> 0.7)
uber (0.1.0)
unicode-display_width (2.5.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.23.0)
xcodeproj (1.24.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -211,7 +214,7 @@ PLATFORMS
x86_64-darwin-20

DEPENDENCIES
fastlane
fastlane (= 2.219.0)

BUNDLED WITH
2.5.3
72 changes: 41 additions & 31 deletions WaiterRobot/Core/Mvi/KotlinArrayWrapper.swift
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
import Foundation
import shared

@objc public class KotlinIteratorImpl: NSObject, KotlinIterator, IteratorProtocol {
public typealias Element = KotlinInt

var iterator: KotlinIterator

init(iterator: KotlinIterator) {
self.iterator = iterator
}

public func next() -> Any? {
if hasNext() {
iterator.next()
} else { nil }
}

public func next() -> KotlinInt? {
if hasNext() {
(iterator.next() as! KotlinInt?)
} else { nil }
}

public func hasNext() -> Bool {
iterator.hasNext()
}
}

extension KotlinArray: Sequence {
@objc public func makeIterator() -> KotlinIteratorImpl {
KotlinIteratorImpl(iterator: iterator())
}
}
// public class KotlinIteratorImpl<T>: NSObject, KotlinIterator, IteratorProtocol {
// public typealias Element = T
//
// var iterator: KotlinIterator
//
// init(iterator: KotlinIterator) {
// self.iterator = iterator
// }
//
// public func next() -> Any? {
// if hasNext() {
// iterator.next()
// } else {
// nil
// }
// }
//
// public func next() -> T? {
// if hasNext() {
// (iterator.next() as! T?)
// } else {
// nil
// }
// }
//
// public func hasNext() -> Bool {
// iterator.hasNext()
// }
// }

// extension KotlinArray where T: AnyObject {
// var array: Array<T> {
// Array(self)
// }
// }

// extension KotlinArray: Sequence {
// @objc public func makeIterator() -> KotlinIteratorImpl<Any> {
// KotlinIteratorImpl(iterator: iterator())
// }
// }

extension Array where Element: AnyObject {
init(_ kotlinArray: KotlinArray<Element>) {
Expand Down
18 changes: 11 additions & 7 deletions WaiterRobot/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ struct MainView: View {
case let screen as Screen.OrderScreen: OrderScreen(table: screen.table, initialItemId: screen.initialItemId)
case let screen as Screen.BillingScreen: BillingScreen(table: screen.table)
default:
Text("No view defined for \(route.description)") // TODO:
Button {
navigator.pop()
} label: {
Text("Back")
}.onAppear {
koin.logger(tag: "WaiterRobotApp").e { "No view defined for \(route.description)" }
VStack {
Text("No view defined for \(route.description)")

Button {
navigator.pop()
} label: {
Text("Back")
}
.onAppear {
koin.logger(tag: "WaiterRobotApp").e { "No view defined for \(route.description)" }
}
}
}
}
Expand Down
58 changes: 28 additions & 30 deletions WaiterRobot/Ui/Billing/BillListItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,33 @@ struct BillListItem: View {
}
}

struct BillListItem_Previews: PreviewProvider {
static var previews: some View {
List {
BillListItem(
item: BillItem(
productId: 1,
name: "Beer",
ordered: 10,
selectedForBill: 5,
pricePerPiece: Money(cents: 3390)
),
addOne: {},
addAll: {},
removeOne: {},
removeAll: {}
)
BillListItem(
item: BillItem(
productId: 2,
name: "Wine",
ordered: 15,
selectedForBill: 8,
pricePerPiece: Money(cents: 390)
),
addOne: {},
addAll: {},
removeOne: {},
removeAll: {}
)
}
#Preview {
List {
BillListItem(
item: BillItem(
productId: 1,
name: "Beer",
ordered: 10,
selectedForBill: 5,
pricePerPiece: Money(cents: 3390)
),
addOne: {},
addAll: {},
removeOne: {},
removeAll: {}
)
BillListItem(
item: BillItem(
productId: 2,
name: "Wine",
ordered: 15,
selectedForBill: 8,
pricePerPiece: Money(cents: 390)
),
addOne: {},
addAll: {},
removeOne: {},
removeAll: {}
)
}
}
Loading
Loading