Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 13 additions & 8 deletions Surcharges/Applications/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,28 @@ let infoPlist: InfoPlist = .extendingDefault(
"NSLocationWhenInUseUsageDescription": .string("Surcharges uses your location to provide nearest places to you."),
"NSCameraUsageDescription": .string("Surcharges uses your camera to take your receipt."),
"ITSAppUsesNonExemptEncryption": .boolean(false),
"UISupportedInterfaceOrientations": .array([.string("UIInterfaceOrientationPortrait")])
]
)

// MARK: Target - Prod
let surcharges = Target.target(
name: "Surcharges",
destinations: [.iPhone, .iPad, .mac],
destinations: [.iPhone],
product: .app,
bundleId: "nz.surcharges",
deploymentTargets: .multiplatform(iOS: "17.0", macOS: "13.0"),
deploymentTargets: .iOS("17.0"),
infoPlist: infoPlist,
sources: ["Sources/Commons/**", "Sources/Prod/**"],
resources: .resources(
[
"Resources/Localise/**",
.glob(
pattern: .relativeToManifest("Resources/Prod/**"),
excluding: [.relativeToManifest("Resources/Prod/.gitkeep")]
)
], privacyManifest: .default
),
],
privacyManifest: .default
),
dependencies: productionDependencies + externalDependencies,
settings: Settings.settings(
Expand All @@ -105,19 +108,21 @@ let surcharges = Target.target(
// MARK: Target - Dev
let surchargesDev = Target.target(
name: "SurchargesDev",
destinations: [.iPhone, .iPad, .mac],
destinations: [.iPhone],
product: .app,
bundleId: "nz.surcharges.development",
deploymentTargets: .multiplatform(iOS: "17.0", macOS: "13.0"),
deploymentTargets: .iOS("17.0"),
infoPlist: infoPlist,
sources: ["Sources/Commons/**", "Sources/Dev/**"],
resources: .resources(
[
"Resources/Localise/**",
.glob(
pattern: .relativeToManifest("Resources/Dev/**"),
excluding: [.relativeToManifest("Resources/Dev/.gitkeep")]
)
], privacyManifest: .default
),
],
privacyManifest: .default
),
dependencies: developmentDependencies + externalDependencies,
settings: Settings.settings(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "appicon.png",
"filename" : "AppIcon_light.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand All @@ -13,7 +13,7 @@
"value" : "dark"
}
],
"filename" : "appicon 1.png",
"filename" : "AppIcon_dark.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand All @@ -25,7 +25,7 @@
"value" : "tinted"
}
],
"filename" : "appicon 2.png",
"filename" : "AppIcon_light 1.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
Resources

Created by Bonsung Koo on 30/01/2025.
Copyright © 2025 Surcharges. All rights reserved.
*/

"NSCameraUsageDescription"= "Surcharges uses your camera to take your receipt.";
"NSLocationWhenInUseUsageDescription"= "Surcharges uses your location to provide nearest places to you.";
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Localizable.strings
Resources

Created by Bonsung Koo on 30/01/2025.
Copyright © 2025 Surcharges. All rights reserved.
*/

/* This file must be empty. */
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
InfoPlist.strings
Resources

Created by Bonsung Koo on 30/01/2025.
Copyright © 2025 Surcharges. All rights reserved.
*/

"NSCameraUsageDescription"= "영수증 사진을 촬영하기 위해 카메라를 사용합니다.";
"NSLocationWhenInUseUsageDescription"= "당신 주변의 상점을 검색하기 위해 위치 정보를 사용합니다.";
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Localizable.strings
Resources

Created by Bonsung Koo on 30/01/2025.
Copyright © 2025 Surcharges. All rights reserved.
*/

/* This file must be empty. */
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "appicon.png",
"filename" : "AppIcon_light.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand All @@ -13,7 +13,7 @@
"value" : "dark"
}
],
"filename" : "appicon 1.png",
"filename" : "AppIcon_dark.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand All @@ -25,7 +25,7 @@
"value" : "tinted"
}
],
"filename" : "appicon 2.png",
"filename" : "AppIcon_light 1.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion Surcharges/DataLayer/Networks/Sources/API/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ extension API {
case .badRequest:
throw .badRequest
case .forbidden:
throw .forbidden
throw .forbidden(reason: .region(availableRegions: ["nz"]))
case .unauthorised:
throw .unauthorised
case .notFound:
Expand Down
14 changes: 13 additions & 1 deletion Surcharges/DataLayer/Networks/Sources/Commons/NetworkError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@
import Foundation

public enum NetworkError: Error {

public enum ForbiddenReason: Identifiable, Equatable, Sendable {
case region(availableRegions: [String])

public var id: String {
switch self {
case .region(let availableRegions):
return availableRegions.joined(separator: "")
}
}
}

case systemError
case badRequest
case unauthorised
case forbidden
case forbidden(reason: ForbiddenReason)
case notFound
case methodNotAllowed
case deprecatedAPI
Expand Down
7 changes: 5 additions & 2 deletions Surcharges/DataLayer/Repositories/Sources/errorHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ extension RepositoryProtocol {
switch error {
case .unauthorised:
await appStatusService.notifyAppStatus(.toast(.unauthorised))
case .forbidden:
await appStatusService.notifyAppStatus(.toast(.outOfNZ))
case .forbidden(let reason):
switch reason {
case .region(let availableRegions):
await appStatusService.notifyAppStatus(.toast(.outOfRegion(availableRegions: availableRegions)))
}
case .systemError:
await appStatusService.notifyAppStatus(.toast(.noInternet))
case .deprecatedAPI:
Expand Down
17 changes: 10 additions & 7 deletions Surcharges/PresentationLayer/UIs/Main/Sources/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol>: V
.padding([.top], 10)
.padding([.leading, .trailing], 20)

/*
// Favourite Places is currently not available.
Section {

FavouritePlacesView()
Expand All @@ -55,6 +57,7 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol>: V
.font(.title3)
.blurBackground()
}
*/

if _viewModel.isLoading {

Expand Down Expand Up @@ -90,7 +93,7 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol>: V
)

} header: {
Text("Search for \"\(_viewModel.searchedText)\"")
Text(R.string.localizable.searchFor(_viewModel.searchedText))
.font(.title3)
.blurBackground()
}
Expand Down Expand Up @@ -138,7 +141,7 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol>: V
.buttonStyle(.plain)
.contentTransition(.symbolEffect(.replace))
.alert(
"Use Location is Denied",
R.string.localizable.alertUseLocationDeniedTitle(),
isPresented: $_showLocationDeniedAlert
) {

Expand All @@ -147,17 +150,17 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol>: V
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [:], completionHandler: nil)

} label: {
Text("Go to Settings")
Text(R.string.localizable.goToSettings())
}

Button(role: .cancel) {
_showLocationDeniedAlert.toggle()
} label: {
Text("Close")
Text(R.string.localizable.close())
}

} message: {
Text("Allow to use your location")
Text(R.string.localizable.alertUseLocationDeniedMessage())
}
.popoverTip(_useLocationTip, arrowEdge: .leading) { action in
withAnimation {
Expand All @@ -166,7 +169,7 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol>: V
_useLocationTip.invalidate(reason: .actionPerformed)
}

TextField("Search your destination", text: $_viewModel.searchText)
TextField(R.string.localizable.searchBoxPlaceholder(), text: $_viewModel.searchText)
.textFieldStyle(.roundedBorder)
.font(.body)
.disabled(_viewModel.isLoading)
Expand All @@ -188,7 +191,7 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol>: V
await _viewModel.search()
}
} label: {
Text("Search")
Text(R.string.localizable.searchButtonTitle())
.font(.body)
.disabled(!_viewModel.canSearch)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct NoResultView: View {
.font(.largeTitle)
}

Text("Oops!\nNo results found for \"\(_searchedText)\"")
Text(R.string.localizable.noResultForSearch(_searchedText))
.font(.subheadline)
.multilineTextAlignment(.center)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ struct PlaceView: View {

if let rate = _place.surcharge.rate {
if _place.surcharge.status == .reported {
Text(verbatim: rate == 0 ? "Zero🎉" : "\(rate)%")
Text(verbatim: rate == 0 ? "\(R.string.localizable.zeroRates())🎉" : "\(rate)%")
.surchargeStatusReported()

} else if _place.surcharge.status == .confirmed {
Text(verbatim: rate == 0 ? "Zero🎉" : "\(rate)%")
Text(verbatim: rate == 0 ? "\(R.string.localizable.zeroRates())🎉" : "\(rate)%")
.surchargeStatusConfirmed()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
import SwiftUI
import TipKit

import Resources
import CommonUI

struct SurchargeStatusTip: Tip {
var title: Text {
Text("Surcharge Status")
Text(R.string.localizable.tipSurchargeStatusTitle())
}

var message: Text? {
Text("Get to know different surcharge status")
Text(R.string.localizable.tipSurchargeStatusMessage())
}

var image: Image? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
import SwiftUI
import TipKit

import Resources

struct UseLocationTip: Tip {
var title: Text {
Text("Use Your Location")
Text(R.string.localizable.tipUseLocationTitle())
}

var message: Text? {
Text("Search for nearby places.")
Text(R.string.localizable.tipUseLocationMessage())
}

var image: Image? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

import SwiftUI

import Resources

struct WelcomeView: View {

var body: some View {
Text("Welcome to the Surcharge App")
Text(R.string.localizable.welcomeToSurchargeApp())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import SwiftUI

import Resources
import Models

struct ContributeButton: View {
Expand Down Expand Up @@ -45,9 +46,9 @@ struct ContributeButton: View {

switch _surcharge.status {
case .notDetermined: return ""
case .unknown: return "We're welcome to your contribution🙏🏻"
case .unknown: return "\(R.string.localizable.reportForUnknownButtonTitle())🙏🏻"
case .reported: return ""
case .confirmed: return "Something wrong?🤔"
case .confirmed: return "\(R.string.localizable.reportForConfirmedButtonTitle())🤔"
}
}
}
Loading
Loading