fix(android): resolve background image visibility and local flow animations on login
This commit is contained in:
@@ -96,18 +96,12 @@ struct FeaturedStoreCard: View {
|
|||||||
private var storeIconPlaceholder: some View {
|
private var storeIconPlaceholder: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: "placeholder-product", withExtension: "png")) { phase in
|
SwiftUI.Image("placeholder-product")
|
||||||
if let image = phase.image {
|
.resizable()
|
||||||
image
|
.scaledToFill()
|
||||||
.resizable()
|
.opacity(0.7)
|
||||||
} else {
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
Color.clear
|
.clipped()
|
||||||
}
|
|
||||||
}
|
|
||||||
.scaledToFill()
|
|
||||||
.opacity(0.7)
|
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
||||||
.clipped()
|
|
||||||
#else
|
#else
|
||||||
Image("placeholder-product")
|
Image("placeholder-product")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|||||||
@@ -15,14 +15,8 @@ struct LoginEmailView: View {
|
|||||||
|
|
||||||
@ViewBuilder private var logoImage: some View {
|
@ViewBuilder private var logoImage: some View {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
SwiftUI.Image("pedifoods")
|
||||||
if let image = phase.image {
|
.resizable()
|
||||||
image
|
|
||||||
.resizable()
|
|
||||||
} else {
|
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
SwiftUI.Image("pedifoods")
|
SwiftUI.Image("pedifoods")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|||||||
@@ -16,14 +16,8 @@ struct LoginView: View {
|
|||||||
|
|
||||||
@ViewBuilder private var logoImage: some View {
|
@ViewBuilder private var logoImage: some View {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
SwiftUI.Image("pedifoods")
|
||||||
if let image = phase.image {
|
.resizable()
|
||||||
image
|
|
||||||
.resizable()
|
|
||||||
} else {
|
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
SwiftUI.Image("pedifoods")
|
SwiftUI.Image("pedifoods")
|
||||||
.resizable()
|
.resizable()
|
||||||
@@ -32,14 +26,8 @@ struct LoginView: View {
|
|||||||
|
|
||||||
@ViewBuilder private var pinHeroImage: some View {
|
@ViewBuilder private var pinHeroImage: some View {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app", withExtension: "png")) { phase in
|
SwiftUI.Image(colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app")
|
||||||
if let image = phase.image {
|
.resizable()
|
||||||
image
|
|
||||||
.resizable()
|
|
||||||
} else {
|
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
SwiftUI.Image("pin_image_app")
|
SwiftUI.Image("pin_image_app")
|
||||||
.resizable()
|
.resizable()
|
||||||
@@ -120,15 +108,36 @@ struct LoginView: View {
|
|||||||
}
|
}
|
||||||
.ignoresSafeArea()
|
.ignoresSafeArea()
|
||||||
.onAppear {
|
.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 {
|
if shouldPrepareEntryAnimation {
|
||||||
applyHiddenStateWithoutAnimation()
|
applyHiddenStateWithoutAnimation()
|
||||||
} else {
|
} else {
|
||||||
showFinalStateWithoutAnimation()
|
showFinalStateWithoutAnimation()
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#if os(iOS)
|
||||||
.task(id: authEntryAnimationToken) {
|
.task(id: authEntryAnimationToken) {
|
||||||
await runEntryAnimationIfNeeded(for: authEntryAnimationToken)
|
await runEntryAnimationIfNeeded(for: authEntryAnimationToken)
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,17 +26,11 @@ struct OtpView: View {
|
|||||||
ScrollView {
|
ScrollView {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
SwiftUI.Image("pedifoods")
|
||||||
if let image = phase.image {
|
.resizable()
|
||||||
image
|
.scaledToFit()
|
||||||
.resizable()
|
.frame(width: 74, height: 74)
|
||||||
} else {
|
.padding(.top, 140)
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 74, height: 74)
|
|
||||||
.padding(.top, 140)
|
|
||||||
#else
|
#else
|
||||||
SwiftUI.Image("pedifoods")
|
SwiftUI.Image("pedifoods")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|||||||
@@ -19,14 +19,8 @@ struct RegistrationView: View {
|
|||||||
|
|
||||||
@ViewBuilder private var logoImage: some View {
|
@ViewBuilder private var logoImage: some View {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
SwiftUI.Image("pedifoods")
|
||||||
if let image = phase.image {
|
.resizable()
|
||||||
image
|
|
||||||
.resizable()
|
|
||||||
} else {
|
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
SwiftUI.Image("pedifoods")
|
SwiftUI.Image("pedifoods")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|||||||
@@ -37,14 +37,8 @@ struct LaunchSplashView: View {
|
|||||||
|
|
||||||
@ViewBuilder var splashLogo: some View {
|
@ViewBuilder var splashLogo: some View {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
SwiftUI.Image("pedifoods")
|
||||||
if let image = phase.image {
|
.resizable()
|
||||||
image
|
|
||||||
.resizable()
|
|
||||||
} else {
|
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
SwiftUI.Image("pedifoods")
|
SwiftUI.Image("pedifoods")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|||||||
@@ -33,14 +33,8 @@ struct AddAddressFormView: View {
|
|||||||
|
|
||||||
@ViewBuilder private var logoImage: some View {
|
@ViewBuilder private var logoImage: some View {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
SwiftUI.Image("pedifoods")
|
||||||
if let image = phase.image {
|
.resizable()
|
||||||
image
|
|
||||||
.resizable()
|
|
||||||
} else {
|
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
SwiftUI.Image("pedifoods")
|
SwiftUI.Image("pedifoods")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|||||||
@@ -223,16 +223,10 @@ struct OrderTrackingView: View {
|
|||||||
Group {
|
Group {
|
||||||
if hasTrackingImage {
|
if hasTrackingImage {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: trackingImageName, withExtension: "png")) { phase in
|
SwiftUI.Image(trackingImageName)
|
||||||
if let image = phase.image {
|
.renderingMode(.original)
|
||||||
image
|
.resizable()
|
||||||
.renderingMode(.original)
|
.scaledToFit()
|
||||||
.resizable()
|
|
||||||
} else {
|
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.scaledToFit()
|
|
||||||
#else
|
#else
|
||||||
Image(trackingImageName)
|
Image(trackingImageName)
|
||||||
.renderingMode(.original)
|
.renderingMode(.original)
|
||||||
@@ -241,16 +235,10 @@ struct OrderTrackingView: View {
|
|||||||
#endif
|
#endif
|
||||||
} else if hasPlaceholderProductImage {
|
} else if hasPlaceholderProductImage {
|
||||||
#if os(Android)
|
#if os(Android)
|
||||||
AsyncImage(url: Bundle.module.url(forResource: "placeholder-product", withExtension: "png")) { phase in
|
SwiftUI.Image("placeholder-product")
|
||||||
if let image = phase.image {
|
.renderingMode(.original)
|
||||||
image
|
.resizable()
|
||||||
.renderingMode(.original)
|
.scaledToFit()
|
||||||
.resizable()
|
|
||||||
} else {
|
|
||||||
Color.clear
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.scaledToFit()
|
|
||||||
#else
|
#else
|
||||||
Image("placeholder-product")
|
Image("placeholder-product")
|
||||||
.renderingMode(.original)
|
.renderingMode(.original)
|
||||||
|
|||||||
Reference in New Issue
Block a user