Skip to content

Commit d70ab91

Browse files
committed
♻️ Clean up
Signed-off-by: Peter Friese <[email protected]>
1 parent 0b1e11b commit d70ab91

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Examples/FriendlyFlix/app/FriendlyFlix/FriendlyFlix/Features/Authentication/AuthenticationToolbarButton.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,22 @@
1919
import SwiftUI
2020

2121
struct AuthenticationToolbarButton: View {
22-
@Environment(AuthenticationService.self) var viewModel
22+
@Environment(AuthenticationService.self) var authenticationService
2323

24-
var body: some View {
25-
Button(action: onButtonTapped) {
26-
Image(systemName: viewModel.authenticationState == .unauthenticated ? "person.circle" : "person.circle.fill")
24+
private func onButtonTapped() {
25+
if authenticationService.authenticationState == .unauthenticated {
26+
authenticationService.presentingAuthenticationDialog.toggle()
27+
}
28+
else {
29+
authenticationService.presentingAccountDialog.toggle()
2730
}
2831
}
32+
}
2933

30-
func onButtonTapped() {
31-
if viewModel.authenticationState == .unauthenticated {
32-
viewModel.presentingAuthenticationDialog.toggle()
33-
}
34-
else {
35-
viewModel.presentingAccountDialog.toggle()
34+
extension AuthenticationToolbarButton {
35+
var body: some View {
36+
Button(action: onButtonTapped) {
37+
Image(systemName: authenticationService.authenticationState == .unauthenticated ? "person.circle" : "person.circle.fill")
3638
}
3739
}
3840
}

0 commit comments

Comments
 (0)