Skip to content

Commit

Permalink
Fixed template copy
Browse files Browse the repository at this point in the history
  • Loading branch information
mickmaccallum committed Aug 5, 2024
1 parent 2424d4b commit 4ae65f8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 27 deletions.
4 changes: 1 addition & 3 deletions dev/ParraDev/Settings Tab/Account Screen/AccountHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ import Parra
import SwiftUI

struct AccountHeader: View {
let user: ParraUser?

var body: some View {
VStack {
ParraProfilePhotoWell(
size: CGSize(width: 100, height: 100)
)
.padding(.bottom, 6)

IdentityLabels(user: user)
IdentityLabels()
}
.padding()
.frame(maxWidth: .infinity)
Expand Down
8 changes: 3 additions & 5 deletions dev/ParraDev/Settings Tab/Account Screen/AccountView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ struct AccountView: View {
@EnvironmentObject private var parraAuthState: ParraAuthState
@State private var isSigningIn = false

var user: ParraUser? {
return parraAuthState.current.user
}

var body: some View {
let user = parraAuthState.current.user

List {
Section {
AccountHeader(user: user)
AccountHeader()
}

Section {
Expand Down
14 changes: 7 additions & 7 deletions dev/ParraDev/Settings Tab/Cells/ProfileCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ public struct ProfileCell: View {
@EnvironmentObject private var parraAuthState: ParraAuthState

public var body: some View {
if let user = parraAuthState.current.user {
AuthenticatedProfileInfoView(user: user)
} else {
switch parraAuthState.current {
case .anonymous, .authenticated:
AuthenticatedProfileInfoView()
default:
UnauthenticatedProfileInfoView()
}
}
}

struct IdentityLabels: View {
let user: ParraUser?
@EnvironmentObject private var parraAuthState: ParraAuthState

var body: some View {
let user = parraAuthState.current.user
let identityNames = user?.info.identityNames ?? []

if identityNames.isEmpty {
Expand All @@ -46,11 +48,9 @@ struct IdentityLabels: View {
}

struct AuthenticatedProfileInfoView: View {
let user: ParraUser

@ViewBuilder var labels: some View {
VStack(alignment: .leading) {
IdentityLabels(user: user)
IdentityLabels()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ struct AccountView: View {
@EnvironmentObject private var parraAuthState: ParraAuthState
@State private var isSigningIn = false

var user: ParraUser? {
return parraAuthState.current.user
}

var body: some View {
let user = parraAuthState.current.user

List {
Section {
AccountHeader(user: user)
AccountHeader()
}

Section {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ public struct ProfileCell: View {
@EnvironmentObject private var parraAuthState: ParraAuthState

public var body: some View {
if let user = parraAuthState.current.user {
AuthenticatedProfileInfoView(user: user)
} else {
switch parraAuthState.current {
case .anonymous, .authenticated:
AuthenticatedProfileInfoView()
default:
UnauthenticatedProfileInfoView()
}
}
}

struct IdentityLabels: View {
let user: ParraUser?
@EnvironmentObject private var parraAuthState: ParraAuthState

var body: some View {
let user = parraAuthState.current.user
let identityNames = user?.info.identityNames ?? []

if identityNames.isEmpty {
Expand All @@ -46,11 +48,9 @@ struct IdentityLabels: View {
}

struct AuthenticatedProfileInfoView: View {
let user: ParraUser

@ViewBuilder var labels: some View {
VStack(alignment: .leading) {
IdentityLabels(user: user)
IdentityLabels()
}
}

Expand Down

0 comments on commit 4ae65f8

Please sign in to comment.