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
2 changes: 1 addition & 1 deletion NativeAppTemplate/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ enum NativeAppTemplateConstants {
}
}

extension String {
enum Strings {
#if DEBUG
private static let env = ProcessInfo.processInfo.environment
static let scheme: String = env["NATEMPLATE_API_SCHEME"] ?? "https"
Expand Down
9 changes: 2 additions & 7 deletions NativeAppTemplate/Extensions/DateFormatter+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

import Foundation

extension String {
static let cardDateString: String = "yyyy/MM/dd"
static let cardTimeString: String = "HH:mm"
}

extension ISO8601DateFormatter {
convenience init(_ formatOptions: Options, timeZone: TimeZone = TimeZone(secondsFromGMT: 0)!) {
self.init()
Expand All @@ -34,9 +29,9 @@ extension String {
}

extension DateFormatter {
static let cardDateFormatter: DateFormatter = .formatter(for: .cardDateString)
static let cardDateFormatter: DateFormatter = .formatter(for: "yyyy/MM/dd")

static let cardTimeFormatter: DateFormatter = .formatter(for: .cardTimeString)
static let cardTimeFormatter: DateFormatter = .formatter(for: "HH:mm")

static let timeAgoInWordsDateFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class CertificatePinningDelegate: NSObject, URLSessionDelegate {
"kIdp6NNEd8wsugYyyIYFsi1ylMCED3hZbSR8ZFsa/A4="
]

static let pinnedDomain = String.domain
static let pinnedDomain = Strings.domain

/// ASN.1 header for EC 256-bit public key (SPKI prefix)
private static let ecDsaSecp256r1Asn1Header: [UInt8] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ struct NativeAppTemplateEnvironment: Equatable {
}

extension NativeAppTemplateEnvironment {
static let urlString = if String.port.isEmpty {
"\(String.scheme)://\(String.domain)"
static let urlString = if Strings.port.isEmpty {
"\(Strings.scheme)://\(Strings.domain)"
} else {
"\(String.scheme)://\(String.domain):\(String.port)"
"\(Strings.scheme)://\(Strings.domain):\(Strings.port)"
}

static let prod = NativeAppTemplateEnvironment(baseURL: URL(string: urlString)!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Foundation

struct LoggedInShopkeeperKeychainStore: KeychainStore {
// Make sure the account name doesn't match the bundle identifier!
var account = String.keychainAccountLoggedInShopkeeper
var service = String.keychainServiceLoggedInShopkeeper
var account = Strings.keychainAccountLoggedInShopkeeper
var service = Strings.keychainServiceLoggedInShopkeeper

typealias DataType = LoggedInShopkeeper
}
6 changes: 3 additions & 3 deletions NativeAppTemplate/UI/App Root/AcceptPrivacyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ private extension AcceptPrivacyView {

var acceptPrivacyView: some View {
VStack {
let agreement = "Please accept updated [\(String.privacyPolicy)](\(String.privacyPolicyUrl))."
let agreement = "Please accept updated [\(Strings.privacyPolicy)](\(Strings.privacyPolicyUrl))."
Text(.init(agreement))
.padding(.top, NativeAppTemplateConstants.Spacing.xl)

MainButtonView(title: String.accept, type: .primary(withArrow: false)) {
MainButtonView(title: Strings.accept, type: .primary(withArrow: false)) {
viewModel.updateConfirmedPrivacyVersion()
}
.padding(NativeAppTemplateConstants.Spacing.md)

Spacer()
}
.navigationTitle(String.privacyPolicyUpdated)
.navigationTitle(Strings.privacyPolicyUpdated)
.navigationBarTitleDisplayMode(.inline)
}
}
4 changes: 2 additions & 2 deletions NativeAppTemplate/UI/App Root/AcceptPrivacyViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ final class AcceptPrivacyViewModel {
do {
isUpdating = true
try await sessionController.updateConfirmedPrivacyVersion()
messageBus.post(message: Message(level: .success, message: .confirmedPrivacyVersionUpdated))
messageBus.post(message: Message(level: .success, message: Strings.confirmedPrivacyVersionUpdated))
} catch {
messageBus.post(message: Message(
level: .error,
message: "\(String.confirmedPrivacyVersionUpdatedError) \(error.codedDescription)",
message: "\(Strings.confirmedPrivacyVersionUpdatedError) \(error.codedDescription)",
autoDismiss: false
))
}
Expand Down
6 changes: 3 additions & 3 deletions NativeAppTemplate/UI/App Root/AcceptTermsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ private extension AcceptTermsView {

var acceptTermsView: some View {
VStack {
let agreement = "Please accept updated [\(String.termsOfUse)](\(String.termsOfUseUrl))."
let agreement = "Please accept updated [\(Strings.termsOfUse)](\(Strings.termsOfUseUrl))."
Text(.init(agreement))
.padding(.top, NativeAppTemplateConstants.Spacing.xl)

MainButtonView(title: String.accept, type: .primary(withArrow: false)) {
MainButtonView(title: Strings.accept, type: .primary(withArrow: false)) {
viewModel.updateConfirmedTermsVersion()
}
.padding(NativeAppTemplateConstants.Spacing.md)

Spacer()
}
.navigationTitle(String.termsOfUseUpdated)
.navigationTitle(Strings.termsOfUseUpdated)
.navigationBarTitleDisplayMode(.inline)
}
}
4 changes: 2 additions & 2 deletions NativeAppTemplate/UI/App Root/AcceptTermsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ final class AcceptTermsViewModel {
do {
isUpdating = true
try await sessionController.updateConfirmedTermsVersion()
messageBus.post(message: Message(level: .success, message: .confirmedTermsVersionUpdated))
messageBus.post(message: Message(level: .success, message: Strings.confirmedTermsVersionUpdated))
} catch {
messageBus.post(message: Message(
level: .error,
message: "\(String.confirmedTermsVersionUpdatedError) \(error.codedDescription)",
message: "\(Strings.confirmedTermsVersionUpdatedError) \(error.codedDescription)",
autoDismiss: false
))
}
Expand Down
4 changes: 2 additions & 2 deletions NativeAppTemplate/UI/App Root/AppTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ extension AppTabView: View {
tab(
content: shopListView,
navigationPath: $navigationPathShops,
text: .shops,
text: Strings.shops,
imageName: "storefront.fill",
tab: .shops
)

tab(
content: settingsView,
navigationPath: nil,
text: .settings,
text: Strings.settings,
imageName: "gearshape.fill",
tab: .settings
)
Expand Down
12 changes: 6 additions & 6 deletions NativeAppTemplate/UI/App Root/ForgotPasswordView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ private extension ForgotPasswordView {
var forgotPasswordView: some View {
Form {
Section {
TextField(String.placeholderEmail, text: $viewModel.email)
TextField(Strings.placeholderEmail, text: $viewModel.email)
.textContentType(.emailAddress)
.autocapitalization(.none)
} header: {
Text(String.email)
Text(Strings.email)
} footer: {
if viewModel.isEmailBlank {
Text(String.emailIsRequired)
Text(Strings.emailIsRequired)
.foregroundStyle(.validationError)
} else if viewModel.isEmailInvalid {
Text(String.emailIsInvalid)
Text(Strings.emailIsInvalid)
.foregroundStyle(.validationError)
}
}

MainButtonView(title: String.buttonSendMeResetPasswordInstructions, type: .primary(withArrow: false)) {
MainButtonView(title: Strings.buttonSendMeResetPasswordInstructions, type: .primary(withArrow: false)) {
viewModel.sendMeResetPasswordInstructionsTapped()
}
.disabled(viewModel.hasInvalidData)
.listRowBackground(Color.clear)
}
.navigationTitle(String.forgotYourPassword)
.navigationTitle(Strings.forgotYourPassword)
}
}
4 changes: 2 additions & 2 deletions NativeAppTemplate/UI/App Root/ForgotPasswordViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ final class ForgotPasswordViewModel {
try await signUpRepository.sendResetPasswordInstruction(sendResetPassword: sendResetPassword)
messageBus.post(message: Message(
level: .success,
message: .sentResetPasswordInstruction,
message: Strings.sentResetPasswordInstruction,
autoDismiss: false
))
shouldDismiss = true
} catch {
UIApplication.dismissKeyboard()
messageBus.post(message: Message(
level: .error,
message: String.sentResetPasswordInstructionError,
message: Strings.sentResetPasswordInstructionError,
autoDismiss: false
))
}
Expand Down
2 changes: 1 addition & 1 deletion NativeAppTemplate/UI/App Root/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private extension MainView {
case .error:
ErrorView(
buttonAction: { viewModel?.logout() },
buttonTitle: .backToStartScreen
buttonTitle: Strings.backToStartScreen
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion NativeAppTemplate/UI/App Root/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private extension OnboardingView {
.tabViewStyle(.page(indexDisplayMode: .always))
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Link(String.supportWebsite, destination: URL(string: String.supportWebsiteUrl)!)
Link(Strings.supportWebsite, destination: URL(string: Strings.supportWebsiteUrl)!)
}
ToolbarItem(placement: .navigationBarTrailing) {
NavigationLink(destination: SignUpOrSignInView()) {
Expand Down
18 changes: 9 additions & 9 deletions NativeAppTemplate/UI/App Root/OnboardingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ final class OnboardingViewModel {
func onboardingDescription(index: Int) -> String {
switch index {
case 1:
String.onboardingDescription1
Strings.onboardingDescription1
case 2:
String.onboardingDescription2
Strings.onboardingDescription2
case 3:
String.onboardingDescription3
Strings.onboardingDescription3
case 4:
String.onboardingDescription4
Strings.onboardingDescription4
case 5:
String.onboardingDescription5
Strings.onboardingDescription5
case 6:
String.onboardingDescription6
Strings.onboardingDescription6
case 7:
String.onboardingDescription7
Strings.onboardingDescription7
case 8:
String.onboardingDescription8
Strings.onboardingDescription8
default:
String.onboardingDescription1
Strings.onboardingDescription1
}
}
}
4 changes: 2 additions & 2 deletions NativeAppTemplate/UI/App Root/PermissionsLoadingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ struct PermissionsLoadingView: View {
isShowingLogoutAlert.toggle()
}
.alert(
String.forceSignOut,
Strings.forceSignOut,
isPresented: $isShowingLogoutAlert
) {
Button(role: .destructive) {
logout()
} label: {
Text(String.signOut)
Text(Strings.signOut)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ private extension ResendConfirmationInstructionsView {
var resendConfirmationInstructionsView: some View {
Form {
Section {
TextField(String.placeholderEmail, text: $viewModel.email)
TextField(Strings.placeholderEmail, text: $viewModel.email)
.textContentType(.emailAddress)
.autocapitalization(.none)
} header: {
Text(String.email)
Text(Strings.email)
} footer: {
if viewModel.isEmailBlank {
Text(String.emailIsRequired)
Text(Strings.emailIsRequired)
.foregroundStyle(.validationError)
} else if viewModel.isEmailInvalid {
Text(String.emailIsInvalid)
Text(Strings.emailIsInvalid)
.foregroundStyle(.validationError)
}
}

MainButtonView(title: String.buttonSendMeConfirmationInstructions, type: .primary(withArrow: false)) {
MainButtonView(title: Strings.buttonSendMeConfirmationInstructions, type: .primary(withArrow: false)) {
viewModel.sendMeConfirmationInstructionsTapped()
}
.disabled(viewModel.hasInvalidData)
.listRowBackground(Color.clear)
}
.navigationTitle(String.didntReceiveConfirmationInstructions)
.navigationTitle(Strings.didntReceiveConfirmationInstructions)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ final class ResendConfirmationInstructionsViewModel {
try await signUpRepository.sendConfirmationInstruction(sendConfirmation: sendConfirmation)
messageBus.post(message: Message(
level: .success,
message: .sentConfirmationInstruction,
message: Strings.sentConfirmationInstruction,
autoDismiss: false
))
shouldDismiss = true
} catch {
UIApplication.dismissKeyboard()
messageBus.post(message: Message(
level: .error,
message: String.sentConfirmationInstructionError,
message: Strings.sentConfirmationInstructionError,
autoDismiss: false
))
}
Expand Down
Loading
Loading