fix(android): resolve background image visibility and local flow animations on login

This commit is contained in:
Daniel Arantes Loverde
2026-05-27 15:12:38 -03:00
parent 215d208f4f
commit be6c31832f
8 changed files with 52 additions and 91 deletions

View File

@@ -96,18 +96,12 @@ struct FeaturedStoreCard: View {
private var storeIconPlaceholder: some View {
ZStack {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: "placeholder-product", withExtension: "png")) { phase in
if let image = phase.image {
image
.resizable()
} else {
Color.clear
}
}
.scaledToFill()
.opacity(0.7)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.clipped()
SwiftUI.Image("placeholder-product")
.resizable()
.scaledToFill()
.opacity(0.7)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.clipped()
#else
Image("placeholder-product")
.resizable()

View File

@@ -15,14 +15,8 @@ struct LoginEmailView: View {
@ViewBuilder private var logoImage: some View {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
if let image = phase.image {
image
.resizable()
} else {
Color.clear
}
}
SwiftUI.Image("pedifoods")
.resizable()
#else
SwiftUI.Image("pedifoods")
.resizable()

View File

@@ -16,14 +16,8 @@ struct LoginView: View {
@ViewBuilder private var logoImage: some View {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
if let image = phase.image {
image
.resizable()
} else {
Color.clear
}
}
SwiftUI.Image("pedifoods")
.resizable()
#else
SwiftUI.Image("pedifoods")
.resizable()
@@ -32,14 +26,8 @@ struct LoginView: View {
@ViewBuilder private var pinHeroImage: some View {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app", withExtension: "png")) { phase in
if let image = phase.image {
image
.resizable()
} else {
Color.clear
}
}
SwiftUI.Image(colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app")
.resizable()
#else
SwiftUI.Image("pin_image_app")
.resizable()
@@ -120,15 +108,36 @@ struct LoginView: View {
}
.ignoresSafeArea()
.onAppear {
#if os(Android)
// No Android, rodamos a animação localmente de forma direta
applyHiddenStateWithoutAnimation()
Task {
try? await Task.sleep(nanoseconds: 100_000_000)
withAnimation(.easeOut(duration: 0.5)) {
heroVisible = true
}
try? await Task.sleep(nanoseconds: 150_000_000)
withAnimation(.easeOut(duration: 0.4)) {
textVisible = true
}
try? await Task.sleep(nanoseconds: 150_000_000)
withAnimation(.easeOut(duration: 0.4)) {
buttonVisible = true
}
}
#else
if shouldPrepareEntryAnimation {
applyHiddenStateWithoutAnimation()
} else {
showFinalStateWithoutAnimation()
}
#endif
}
#if os(iOS)
.task(id: authEntryAnimationToken) {
await runEntryAnimationIfNeeded(for: authEntryAnimationToken)
}
#endif
}
}

View File

@@ -26,17 +26,11 @@ struct OtpView: View {
ScrollView {
VStack(spacing: 0) {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
if let image = phase.image {
image
.resizable()
} else {
Color.clear
}
}
.scaledToFit()
.frame(width: 74, height: 74)
.padding(.top, 140)
SwiftUI.Image("pedifoods")
.resizable()
.scaledToFit()
.frame(width: 74, height: 74)
.padding(.top, 140)
#else
SwiftUI.Image("pedifoods")
.resizable()

View File

@@ -19,14 +19,8 @@ struct RegistrationView: View {
@ViewBuilder private var logoImage: some View {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
if let image = phase.image {
image
.resizable()
} else {
Color.clear
}
}
SwiftUI.Image("pedifoods")
.resizable()
#else
SwiftUI.Image("pedifoods")
.resizable()

View File

@@ -37,14 +37,8 @@ struct LaunchSplashView: View {
@ViewBuilder var splashLogo: some View {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
if let image = phase.image {
image
.resizable()
} else {
Color.clear
}
}
SwiftUI.Image("pedifoods")
.resizable()
#else
SwiftUI.Image("pedifoods")
.resizable()

View File

@@ -33,14 +33,8 @@ struct AddAddressFormView: View {
@ViewBuilder private var logoImage: some View {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
if let image = phase.image {
image
.resizable()
} else {
Color.clear
}
}
SwiftUI.Image("pedifoods")
.resizable()
#else
SwiftUI.Image("pedifoods")
.resizable()

View File

@@ -223,16 +223,10 @@ struct OrderTrackingView: View {
Group {
if hasTrackingImage {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: trackingImageName, withExtension: "png")) { phase in
if let image = phase.image {
image
.renderingMode(.original)
.resizable()
} else {
Color.clear
}
}
.scaledToFit()
SwiftUI.Image(trackingImageName)
.renderingMode(.original)
.resizable()
.scaledToFit()
#else
Image(trackingImageName)
.renderingMode(.original)
@@ -241,16 +235,10 @@ struct OrderTrackingView: View {
#endif
} else if hasPlaceholderProductImage {
#if os(Android)
AsyncImage(url: Bundle.module.url(forResource: "placeholder-product", withExtension: "png")) { phase in
if let image = phase.image {
image
.renderingMode(.original)
.resizable()
} else {
Color.clear
}
}
.scaledToFit()
SwiftUI.Image("placeholder-product")
.renderingMode(.original)
.resizable()
.scaledToFit()
#else
Image("placeholder-product")
.renderingMode(.original)