Skip to content

Commit 2013af0

Browse files
Copilotstaskus
andcommitted
Fix SwiftLint errors - remove trailing whitespace and fix line length
- Remove trailing whitespace from all affected files - Break long localization string into multi-line format to comply with 163 character limit - All SwiftLint errors resolved Co-authored-by: staskus <[email protected]>
1 parent 5a67385 commit 2013af0

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

WooCommerce/Classes/ViewRelated/Dashboard/CurrencyMismatchBanner.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import SwiftUI
44
struct CurrencyMismatchBanner: View {
55
let siteCurrency: String
66
let accountCurrency: String
7-
7+
88
/// Closure invoked when the dismiss button is tapped
99
var dismissAction: () -> Void = {}
10-
10+
1111
// Tracks the scale of the view due to accessibility changes
1212
@ScaledMetric private var scale: CGFloat = 1.0
13-
13+
1414
var body: some View {
1515
Group {
1616
HStack(alignment: .top, spacing: Layout.horizontalSpacing) {
@@ -49,11 +49,14 @@ private extension CurrencyMismatchBanner {
4949
)
5050
static let message = NSLocalizedString(
5151
"currencyMismatchBanner.message",
52-
value: "Your site uses %1$@ but your payment account uses %2$@. This may cause issues with payments. Please update your account currency to match your site's currency in your payment gateway settings.",
52+
value: """
53+
Your site uses %1$@ but your payment account uses %2$@. This may cause issues with payments. \
54+
Please update your account currency to match your site's currency in your payment gateway settings.
55+
""",
5356
comment: "Message of the currency mismatch warning banner. %1$@ is the site currency code (e.g. USD), %2$@ is the account currency code (e.g. GBP)."
5457
)
5558
}
56-
59+
5760
enum Layout {
5861
static let padding = EdgeInsets(top: 16, leading: 16, bottom: 16, trailing: 16)
5962
static let iconDimension = CGFloat(20)

WooCommerce/Classes/ViewRelated/Dashboard/DashboardViewModel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ final class DashboardViewModel: ObservableObject {
206206
await reloadCardsWithBackgroundUpdateSupportIfNeeded()
207207

208208
await blazeLocalNotificationScheduler.scheduleNoCampaignReminder()
209-
209+
210210
await checkCurrencyMismatch()
211211
}
212212

@@ -798,7 +798,7 @@ private extension DashboardViewModel {
798798
}
799799

800800
let siteCurrencyCode = ServiceLocator.currencySettings.currencyCode.rawValue
801-
801+
802802
// Try to get payment gateway account currency
803803
guard let accountCurrencyCode = await loadPaymentGatewayAccountCurrency() else {
804804
showCurrencyMismatchBanner = false
@@ -810,7 +810,7 @@ private extension DashboardViewModel {
810810
siteCurrency = siteCurrencyCode
811811
accountCurrency = accountCurrencyCode
812812
showCurrencyMismatchBanner = true
813-
813+
814814
// Log the mismatch for analytics/debugging
815815
DDLogWarn("⚠️ Currency mismatch detected: Site currency \(siteCurrencyCode) differs from payment account currency \(accountCurrencyCode)")
816816
} else {
@@ -833,7 +833,7 @@ private extension DashboardViewModel {
833833
continuation.resume(returning: nil)
834834
return
835835
}
836-
836+
837837
// Try to get the selected payment gateway account
838838
let selectedAccountAction = CardPresentPaymentAction.selectedPaymentGatewayAccount { account in
839839
if let account = account {

WooCommerce/WooCommerceTests/ViewRelated/Dashboard/DashboardViewModelTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -848,33 +848,33 @@ private extension DashboardViewModelTests {
848848
storageManager: storageManager,
849849
userDefaults: userDefaults,
850850
analytics: analytics)
851-
851+
852852
// When
853853
viewModel.dismissCurrencyMismatchBanner()
854-
854+
855855
// Then
856856
XCTAssertFalse(viewModel.showCurrencyMismatchBanner)
857857
XCTAssertTrue(userDefaults.bool(forKey: UserDefaults.Key.currencyMismatchBannerDismissed.rawValue))
858858
XCTAssertEqual(analyticsProvider.receivedEvents.first, "dashboard_currency_mismatch_banner_dismissed")
859859
}
860-
860+
861861
@MainActor
862862
func test_currency_mismatch_banner_does_not_show_when_previously_dismissed() async {
863863
// Given
864864
userDefaults.set(true, forKey: .currencyMismatchBannerDismissed)
865-
865+
866866
let viewModel = DashboardViewModel(siteID: sampleSiteID,
867867
stores: stores,
868868
storageManager: storageManager,
869869
userDefaults: userDefaults)
870-
870+
871871
// When
872872
await viewModel.checkCurrencyMismatch()
873-
873+
874874
// Then
875875
XCTAssertFalse(viewModel.showCurrencyMismatchBanner)
876876
}
877-
877+
878878
func insertPaymentGatewayAccount(_ account: PaymentGatewayAccount) {
879879
let newAccount = storage.insertNewObject(ofType: StoragePaymentGatewayAccount.self)
880880
newAccount.update(with: account)

0 commit comments

Comments
 (0)