Skip to content

Commit

Permalink
delete account button
Browse files Browse the repository at this point in the history
  • Loading branch information
voynow committed Jan 18, 2025
1 parent e37b9b7 commit f1fbc90
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
26 changes: 25 additions & 1 deletion mobile/mobile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ struct ProfileInfoCard: View {
struct SignOutSection: View {
let action: () -> Void
@State private var showOnboarding: Bool = false
@State private var showDeleteConfirmation: Bool = false
@EnvironmentObject var appState: AppState

var body: some View {
VStack {

HStack(spacing: 12) {
Button(action: { showOnboarding = true }) {
HStack {
Expand Down Expand Up @@ -241,6 +242,29 @@ struct SignOutSection: View {
.cornerRadius(8)
}
}

Button(action: {
showDeleteConfirmation = true
}) {
Text("Delete Account")
.font(.system(size: 14, weight: .regular))
.foregroundColor(ColorTheme.lightGrey)
.padding(.vertical, 8)
}
.padding(.top, 8)
.confirmationDialog(
"Delete Account?",
isPresented: $showDeleteConfirmation,
titleVisibility: .visible
) {
Button("Delete", role: .destructive) {
action() // Sign out first
// TODO: Add actual account deletion logic here
}
Button("Cancel", role: .cancel) { }
} message: {
Text("This action cannot be undone. All your data will be permanently deleted.")
}
}
.fullScreenCover(isPresented: $showOnboarding) {
OnboardingCarousel(showCloseButton: true)
Expand Down
29 changes: 25 additions & 4 deletions mobile/mobile/StravaConnectOverlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import SwiftUI
struct StravaConnectOverlay: View {
@EnvironmentObject var appState: AppState
@State private var showOnboarding: Bool = false
@State private var showDeleteConfirmation: Bool = false

var body: some View {
Color.clear
Expand Down Expand Up @@ -76,6 +77,29 @@ struct StravaConnectOverlay: View {
}
}
.padding(.horizontal, 24)

Button(action: {
showDeleteConfirmation = true
}) {
Text("Delete Account")
.font(.system(size: 14, weight: .regular))
.foregroundColor(ColorTheme.lightGrey)
.padding(.vertical, 8)
}
.padding(.top, 8)
.confirmationDialog(
"Delete Account?",
isPresented: $showDeleteConfirmation,
titleVisibility: .visible
) {
Button("Delete", role: .destructive) {
appState.clearAuthState() // Sign out first
// TODO: Add actual account deletion logic here
}
Button("Cancel", role: .cancel) {}
} message: {
Text("This action cannot be undone. All your data will be permanently deleted.")
}
}
.padding(.vertical, 24)
.padding(.horizontal, 16)
Expand All @@ -97,8 +121,5 @@ struct StravaConnectOverlay: View {
}

#Preview {
ZStack {
Color.black
StravaConnectOverlay()
}
StravaConnectOverlay()
}

0 comments on commit f1fbc90

Please sign in to comment.