From 68864ee21a3151ce5738909dd718ef8a0e1fa19b Mon Sep 17 00:00:00 2001 From: Daniel Arantes Loverde Date: Wed, 27 May 2026 09:55:00 -0300 Subject: [PATCH] fix(android): resolve color parser and resource bundle resolution issues --- .../Sources/PediFoods/Components/StoreCard.swift | 9 +++++++++ .../PediFoods/DesignSystem/DesignSystem.swift | 4 +++- .../PediFoods/Views/Auth/LoginEmailView.swift | 2 +- .../Sources/PediFoods/Views/Auth/LoginView.swift | 4 ++-- .../Sources/PediFoods/Views/Auth/OtpView.swift | 8 ++++++++ .../PediFoods/Views/Auth/RegistrationView.swift | 2 +- .../PediFoods/Views/Launch/LaunchSplashView.swift | 2 +- .../PediFoods/Views/Main/AddAddressFormView.swift | 2 +- .../PediFoods/Views/Main/OrderTrackingView.swift | 14 ++++++++++++++ 9 files changed, 40 insertions(+), 7 deletions(-) diff --git a/pedi-foods/Sources/PediFoods/Components/StoreCard.swift b/pedi-foods/Sources/PediFoods/Components/StoreCard.swift index 26de91f..c439344 100644 --- a/pedi-foods/Sources/PediFoods/Components/StoreCard.swift +++ b/pedi-foods/Sources/PediFoods/Components/StoreCard.swift @@ -95,12 +95,21 @@ struct FeaturedStoreCard: View { private var storeIconPlaceholder: some View { ZStack { +#if os(Android) + Image("placeholder-product", bundle: .module) + .resizable() + .scaledToFill() + .opacity(0.7) + .frame(maxWidth: .infinity, maxHeight: .infinity) + .clipped() +#else Image("placeholder-product") .resizable() .scaledToFill() .opacity(0.7) .frame(maxWidth: .infinity, maxHeight: .infinity) .clipped() +#endif Circle() .fill(AppColors.surface.opacity(0.92)) diff --git a/pedi-foods/Sources/PediFoods/DesignSystem/DesignSystem.swift b/pedi-foods/Sources/PediFoods/DesignSystem/DesignSystem.swift index 860a58e..7e44d11 100644 --- a/pedi-foods/Sources/PediFoods/DesignSystem/DesignSystem.swift +++ b/pedi-foods/Sources/PediFoods/DesignSystem/DesignSystem.swift @@ -103,7 +103,9 @@ extension Color { init(hex: String, alpha: Double = 1.0) { let cleaned = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted) var int: UInt64 = 0 - Scanner(string: cleaned).scanHexInt64(&int) + if let val = UInt64(cleaned, radix: 16) { + int = val + } let r, g, b: UInt64 switch cleaned.count { diff --git a/pedi-foods/Sources/PediFoods/Views/Auth/LoginEmailView.swift b/pedi-foods/Sources/PediFoods/Views/Auth/LoginEmailView.swift index c5e523c..787699b 100644 --- a/pedi-foods/Sources/PediFoods/Views/Auth/LoginEmailView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Auth/LoginEmailView.swift @@ -15,7 +15,7 @@ struct LoginEmailView: View { @ViewBuilder private var logoImage: some View { #if os(Android) - SwiftUI.Image("pedifoods") + SwiftUI.Image("pedifoods", bundle: .module) .resizable() #else SwiftUI.Image("pedifoods") diff --git a/pedi-foods/Sources/PediFoods/Views/Auth/LoginView.swift b/pedi-foods/Sources/PediFoods/Views/Auth/LoginView.swift index db94ee9..685c9d8 100644 --- a/pedi-foods/Sources/PediFoods/Views/Auth/LoginView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Auth/LoginView.swift @@ -16,7 +16,7 @@ struct LoginView: View { @ViewBuilder private var logoImage: some View { #if os(Android) - SwiftUI.Image("pedifoods") + SwiftUI.Image("pedifoods", bundle: .module) .resizable() #else SwiftUI.Image("pedifoods") @@ -26,7 +26,7 @@ struct LoginView: View { @ViewBuilder private var pinHeroImage: some View { #if os(Android) - SwiftUI.Image(colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app") + SwiftUI.Image(colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app", bundle: .module) .resizable() #else SwiftUI.Image("pin_image_app") diff --git a/pedi-foods/Sources/PediFoods/Views/Auth/OtpView.swift b/pedi-foods/Sources/PediFoods/Views/Auth/OtpView.swift index c53498d..08ccd07 100644 --- a/pedi-foods/Sources/PediFoods/Views/Auth/OtpView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Auth/OtpView.swift @@ -25,11 +25,19 @@ struct OtpView: View { var body: some View { ScrollView { VStack(spacing: 0) { +#if os(Android) + SwiftUI.Image("pedifoods", bundle: .module) + .resizable() + .scaledToFit() + .frame(width: 74, height: 74) + .padding(.top, 140) +#else SwiftUI.Image("pedifoods") .resizable() .scaledToFit() .frame(width: 74, height: 74) .padding(.top, 140) +#endif Text("Verificação") .font(AppTypography.heading1) diff --git a/pedi-foods/Sources/PediFoods/Views/Auth/RegistrationView.swift b/pedi-foods/Sources/PediFoods/Views/Auth/RegistrationView.swift index 58abc04..405cca1 100644 --- a/pedi-foods/Sources/PediFoods/Views/Auth/RegistrationView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Auth/RegistrationView.swift @@ -19,7 +19,7 @@ struct RegistrationView: View { @ViewBuilder private var logoImage: some View { #if os(Android) - SwiftUI.Image("pedifoods") + SwiftUI.Image("pedifoods", bundle: .module) .resizable() #else SwiftUI.Image("pedifoods") diff --git a/pedi-foods/Sources/PediFoods/Views/Launch/LaunchSplashView.swift b/pedi-foods/Sources/PediFoods/Views/Launch/LaunchSplashView.swift index 3b076d1..7e10f16 100644 --- a/pedi-foods/Sources/PediFoods/Views/Launch/LaunchSplashView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Launch/LaunchSplashView.swift @@ -37,7 +37,7 @@ struct LaunchSplashView: View { @ViewBuilder var splashLogo: some View { #if os(Android) - SwiftUI.Image("pedifoods") + SwiftUI.Image("pedifoods", bundle: .module) .resizable() #else SwiftUI.Image("pedifoods") diff --git a/pedi-foods/Sources/PediFoods/Views/Main/AddAddressFormView.swift b/pedi-foods/Sources/PediFoods/Views/Main/AddAddressFormView.swift index 95066da..94c955b 100644 --- a/pedi-foods/Sources/PediFoods/Views/Main/AddAddressFormView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Main/AddAddressFormView.swift @@ -33,7 +33,7 @@ struct AddAddressFormView: View { @ViewBuilder private var logoImage: some View { #if os(Android) - SwiftUI.Image("pedifoods") + SwiftUI.Image("pedifoods", bundle: .module) .resizable() #else SwiftUI.Image("pedifoods") diff --git a/pedi-foods/Sources/PediFoods/Views/Main/OrderTrackingView.swift b/pedi-foods/Sources/PediFoods/Views/Main/OrderTrackingView.swift index 70006c6..5fae271 100644 --- a/pedi-foods/Sources/PediFoods/Views/Main/OrderTrackingView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Main/OrderTrackingView.swift @@ -222,15 +222,29 @@ struct OrderTrackingView: View { Group { if hasTrackingImage { +#if os(Android) + Image(trackingImageName, bundle: .module) + .renderingMode(.original) + .resizable() + .scaledToFit() +#else Image(trackingImageName) .renderingMode(.original) .resizable() .scaledToFit() +#endif } else if hasPlaceholderProductImage { +#if os(Android) + Image("placeholder-product", bundle: .module) + .renderingMode(.original) + .resizable() + .scaledToFit() +#else Image("placeholder-product") .renderingMode(.original) .resizable() .scaledToFit() +#endif } else { ZStack { Color.black.opacity(0.08)