Skip to content

Commit 7d53d81

Browse files
authored
Merge pull request #70 from Surcharges/develop
Release 1.1.0
2 parents ef4feb8 + 9150353 commit 7d53d81

17 files changed

Lines changed: 275 additions & 117 deletions

File tree

Surcharges/DataLayer/DTOs/Sources/ServerSide/Surcharge/SurchargeStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
import Foundation
1010

1111
public enum SurchargeStatus: String, Codable, Equatable, Sendable {
12-
case UNKNOWN, REPORTED, CONFIRMED
12+
case UNKNOWN, REPORTED, CONFIRMED, AUTO_GENERATED, REJECTED
1313
}

Surcharges/DomainLayer/Entities/Sources/Surcharge/SurchargeStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
import Foundation
1010

1111
public enum SurchargeStatus: String, Codable, Equatable, Sendable {
12-
case unknown, reported, confirmed
12+
case unknown, reported, confirmed, autoGenerated, rejected
1313
}

Surcharges/DomainLayer/UseCases/Sources/ConvertPlaceDTOtoEntity.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ struct ConvertDTOtoEntity {
3737
case .UNKNOWN: return .unknown
3838
case .REPORTED: return .reported
3939
case .CONFIRMED: return .confirmed
40+
case .AUTO_GENERATED: return .autoGenerated
41+
case .REJECTED: return .rejected
4042
}
4143
}
4244

Surcharges/DomainLayer/UseCases/Sources/Place/GetPlaceUsecase.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public struct GetPlaceUsecase<R: PlaceRepositoryProtocol>: GetPlaceUsecaseProtoc
3737
case .UNKNOWN: return .unknown
3838
case .REPORTED: return .reported
3939
case .CONFIRMED: return .confirmed
40+
case .AUTO_GENERATED: return .autoGenerated
41+
case .REJECTED: return .rejected
4042
case .none: return .unknown
4143
}
4244
}

Surcharges/DomainLayer/UseCases/Sources/Place/GetPlacesUsecase.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public struct GetPlacesUsecase<R: PlaceRepositoryProtocol>: GetPlacesUsecaseProt
5252
case .UNKNOWN: return .unknown
5353
case .REPORTED: return .reported
5454
case .CONFIRMED: return .confirmed
55+
case .AUTO_GENERATED: return .autoGenerated
56+
case .REJECTED: return .rejected
5557
case .none: return .unknown
5658
}
5759
}

Surcharges/PresentationLayer/Models/Sources/Surcharge/SurchargeStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
import Foundation
1010

1111
public enum SurchargeStatus: Equatable, Sendable {
12-
case notDetermined, unknown, reported, confirmed
12+
case notDetermined, unknown, reported, confirmed, autoGenerated, rejected
1313
}

Surcharges/PresentationLayer/UIs/CommonUI/Sources/Text+extension/surchargeStatus.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public extension View {
2323
self._style(foreground: R.color.green800.color, background: R.color.green300.color)
2424
}
2525

26+
func surchargeStatusAutoGenerated() -> some View {
27+
self._style(foreground: R.color.yellow800.color, background: R.color.yellow300.color)
28+
}
29+
2630
private func _style(foreground: Color, background: Color) -> some View {
2731
self
2832
.foregroundStyle(foreground)

Surcharges/PresentationLayer/UIs/Main/App/Sources/MainApp.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import AppStatusService
1919
import AppStatusService
2020
import ViewUpdateService
2121
import DevelopmentEndpoint
22+
import DevelopmentAdsService
2223

2324
@main
2425
struct MainApp: App {
@@ -32,7 +33,7 @@ struct MainApp: App {
3233
var body: some Scene {
3334
WindowGroup {
3435
NavigationStack {
35-
MainView(
36+
MainView<MainFactory<DevelopmentEndpoint>.ViewModel, MainRouter, DevelopmentAdsService>(
3637
viewModel: MainFactory<DevelopmentEndpoint>(
3738
locationService: _locationService,
3839
viewUpdateService: _viewUpdateService

Surcharges/PresentationLayer/UIs/Main/Sources/SearchResult/PlaceView.swift

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,40 @@ struct PlaceView: View {
2222
}
2323

2424
var body: some View {
25-
VStack(spacing: 5) {
25+
HStack(spacing: 20) {
2626

27-
HStack(spacing: 10) {
28-
27+
Image(systemName: "storefront")
28+
.imageScale(.large)
29+
30+
VStack(spacing: 5) {
2931
Text(_place.name)
3032
.font(.headline)
33+
.frame(maxWidth: .infinity, alignment: .leading)
3134
.multilineTextAlignment(.leading)
3235

33-
if let rate = _place.surcharge.rate {
34-
if _place.surcharge.status == .reported {
35-
Text(verbatim: rate == 0 ? "\(R.string.localizable.zeroRates())🎉" : "\(rate)%")
36-
.surchargeStatusReported()
37-
38-
} else if _place.surcharge.status == .confirmed {
39-
Text(verbatim: rate == 0 ? "\(R.string.localizable.zeroRates())🎉" : "\(rate)%")
40-
.surchargeStatusConfirmed()
41-
}
42-
}
36+
Text(_place.address)
37+
.frame(maxWidth: .infinity, alignment: .leading)
38+
.font(.subheadline)
39+
.multilineTextAlignment(.leading)
4340
}
4441

45-
Text(_place.address)
46-
.frame(maxWidth: .infinity, alignment: .center)
47-
.font(.subheadline)
48-
.multilineTextAlignment(.center)
49-
42+
if let rate = _place.surcharge.rate {
43+
if _place.surcharge.status == .reported {
44+
Text(verbatim: rate == 0 ? "\(R.string.localizable.zeroRates())🎉" : "\(rate)%")
45+
.surchargeStatusReported()
46+
47+
} else if _place.surcharge.status == .confirmed {
48+
Text(verbatim: rate == 0 ? "\(R.string.localizable.zeroRates())🎉" : "\(rate)%")
49+
.surchargeStatusConfirmed()
50+
51+
} else if _place.surcharge.status == .autoGenerated {
52+
Text(verbatim: rate == 0 ? "\(R.string.localizable.zeroRates())🎉" : "\(rate)%")
53+
.surchargeStatusAutoGenerated()
54+
}
55+
}
5056
}
5157
.padding([.leading, .trailing], 20)
58+
5259
}
5360
}
5461

Surcharges/PresentationLayer/UIs/PlaceDetail/Sources/Button/ContributeButton.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ struct ContributeButton: View {
2626
Button {
2727

2828
switch _surcharge.status {
29-
case .notDetermined, .reported:
29+
case .notDetermined, .reported, .rejected:
3030
break
31-
case .unknown, .confirmed:
31+
case .unknown, .confirmed, .autoGenerated:
3232
_action()
3333
}
3434

@@ -45,10 +45,10 @@ struct ContributeButton: View {
4545
private func buttonText() -> String {
4646

4747
switch _surcharge.status {
48-
case .notDetermined: return ""
48+
case .notDetermined, .rejected: return ""
4949
case .unknown: return "\(R.string.localizable.reportForUnknownButtonTitle())🙏🏻"
5050
case .reported: return ""
51-
case .confirmed: return "\(R.string.localizable.reportForConfirmedButtonTitle())🤔"
51+
case .confirmed, .autoGenerated: return "\(R.string.localizable.reportForConfirmedButtonTitle())🤔"
5252
}
5353
}
5454
}

0 commit comments

Comments
 (0)