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

@@ -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
}
}