From f4b2cce849c7c50dbf17e8bdd6c1fa51b819eb72 Mon Sep 17 00:00:00 2001 From: Daniel Arantes Loverde Date: Sun, 2 Aug 2026 09:42:22 -0300 Subject: [PATCH] [logged-out-auth-intro] Embed login flow directly in logged-out profile tab --- Darwin/Entitlements.plist | 4 ++ Darwin/PediFoods.xcodeproj/project.pbxproj | 10 +-- .../PediFoods/Resources/Localizable.xcstrings | 9 --- .../PediFoods/Views/Main/MainTabView.swift | 8 +-- .../PediFoods/Views/Main/ProfileView.swift | 64 +++++++++---------- 5 files changed, 42 insertions(+), 53 deletions(-) diff --git a/Darwin/Entitlements.plist b/Darwin/Entitlements.plist index 70084b4..41ccb9e 100644 --- a/Darwin/Entitlements.plist +++ b/Darwin/Entitlements.plist @@ -2,7 +2,11 @@ + aps-environment + development com.apple.developer.devicecheck.appattest-environment development + com.apple.developer.location.push + diff --git a/Darwin/PediFoods.xcodeproj/project.pbxproj b/Darwin/PediFoods.xcodeproj/project.pbxproj index 9a9e402..515f1e5 100644 --- a/Darwin/PediFoods.xcodeproj/project.pbxproj +++ b/Darwin/PediFoods.xcodeproj/project.pbxproj @@ -182,7 +182,7 @@ ENABLE_PREVIEWS = YES; INFOPLIST_KEY_CFBundleDisplayName = "Pedi Foods"; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; - INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "PediFoods uses your location to show nearby stores and estimate delivery times."; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "PediFoods usa sua localização para mostrar lojas perto de você"; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; @@ -196,17 +196,17 @@ isa = XCBuildConfiguration; baseConfigurationReference = 496EB72F2A6AE4DE00C1253B /* PediFoods.xcconfig */; buildSettings = { - CODE_SIGN_IDENTITY = "Apple Distribution"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = K4E5BZMM4V; ENABLE_PREVIEWS = YES; INFOPLIST_KEY_CFBundleDisplayName = "Pedi Foods"; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; - INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "PediFoods uses your location to show nearby stores and estimate delivery times."; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "PediFoods usa sua localização para mostrar lojas perto de você"; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - PROVISIONING_PROFILE_SPECIFIER = "com.br.pedifoods.app AppStore"; + PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; TARGETED_DEVICE_FAMILY = 1; diff --git a/Sources/PediFoods/Resources/Localizable.xcstrings b/Sources/PediFoods/Resources/Localizable.xcstrings index b1307e2..35a37c3 100644 --- a/Sources/PediFoods/Resources/Localizable.xcstrings +++ b/Sources/PediFoods/Resources/Localizable.xcstrings @@ -456,12 +456,6 @@ "Entrar" : { "comment" : "A link that directs the user to the login screen.", "isCommentAutoGenerated" : true - }, - "Entrar ou Cadastrar" : { - - }, - "Entre na sua conta" : { - }, "Entrega" : { "comment" : "A text describing delivery mode.", @@ -514,9 +508,6 @@ }, "Excluir sua conta?" : { - }, - "Faça login ou cadastre-se para ver seu perfil, pedidos e endereços." : { - }, "Favorite" : { "comment" : "Item editor title label for marking the item as a favorite", diff --git a/Sources/PediFoods/Views/Main/MainTabView.swift b/Sources/PediFoods/Views/Main/MainTabView.swift index d9eec5f..cdbb57f 100644 --- a/Sources/PediFoods/Views/Main/MainTabView.swift +++ b/Sources/PediFoods/Views/Main/MainTabView.swift @@ -19,12 +19,12 @@ struct MainTabView: View { CartView(appState: $appState, selectedTab: $selectedTab, root: $root) } case .profile: - NavigationStack { - if appState.session.isAuthenticated { + if appState.session.isAuthenticated { + NavigationStack { ProfileView(root: $root, selectedTab: $selectedTab, tokenStore: tokenStore, appState: $appState) - } else { - ProfileLoggedOutView(root: $root) } + } else { + ProfileLoggedOutView(root: $root, selectedTab: $selectedTab, tokenStore: tokenStore, appState: $appState) } } } diff --git a/Sources/PediFoods/Views/Main/ProfileView.swift b/Sources/PediFoods/Views/Main/ProfileView.swift index 7666ed3..cb00395 100644 --- a/Sources/PediFoods/Views/Main/ProfileView.swift +++ b/Sources/PediFoods/Views/Main/ProfileView.swift @@ -312,45 +312,39 @@ struct ProfileView: View { struct ProfileLoggedOutView: View { @Binding var root: RootFlow + @Binding var selectedTab: MainTab + let tokenStore: TokenStore + @Binding var appState: AppState + @State private var path: [Route] = [] + @State private var entryAnimationToken = 0 var body: some View { - VStack(spacing: 18) { - Spacer() - - Image(systemName: "person.crop.circle.badge.questionmark") - .font(.system(size: 56, weight: .regular)) - .foregroundStyle(AppColors.textMuted) - - Text("Entre na sua conta") - .font(AppTypography.heading2) - .foregroundStyle(AppColors.textPrimary) - - Text("Faça login ou cadastre-se para ver seu perfil, pedidos e endereços.") - .font(AppTypography.body) - .foregroundStyle(AppColors.textMuted) - .multilineTextAlignment(.center) - .padding(.horizontal, 32) - - Button { - root = .auth - } label: { - Text("Entrar ou Cadastrar") - .font(AppTypography.heading3) - .foregroundStyle(AppColors.textInverse) - .frame(maxWidth: .infinity) - .padding(.vertical, 14) - .background(AppColors.primary) - .clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous)) + NavigationStack(path: $path) { + LoginView( + root: $root, + selectedTab: $selectedTab, + tokenStore: tokenStore, + appState: $appState, + shouldPrepareEntryAnimation: true, + authEntryAnimationToken: entryAnimationToken, + navigate: { route in path.append(route) } + ) + .onAppear { entryAnimationToken += 1 } + .navigationDestination(for: Route.self) { route in + switch route { + case .terms: + TermsOfUseView() + case .policy: + PrivacyPolicyView() + case .registration: + RegistrationView(root: $root, selectedTab: $selectedTab, tokenStore: tokenStore, appState: $appState, navigate: { route in path.append(route) }) + case .loginEmail: + LoginEmailView(root: $root, selectedTab: $selectedTab, tokenStore: tokenStore, appState: $appState, navigate: { route in path.append(route) }) + case .otp(let email, let phoneNumber): + OtpView(email: email, phoneNumber: phoneNumber, root: $root, selectedTab: $selectedTab, tokenStore: tokenStore, appState: $appState) + } } - .buttonStyle(.plain) - .padding(.horizontal, 32) - .padding(.top, 8) - - Spacer() - Spacer() } - .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(AppColors.backgroundLight) } }