Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace clerk env object with observed object singleton #31

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ extension View {
#Preview {
HomeView()
.demoSettings()
.environmentObject(Clerk.shared)
}
3 changes: 1 addition & 2 deletions ClerkDemo/ClerkDemo/DemoSpecific/DemoAppSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Factory
struct DemoAppSettingsView: View {
@AppStorage("publishableKey") var publishableKey: String = ""
@State private var text: String = ""
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@Environment(\.dismiss) private var dismiss

var body: some View {
Expand Down Expand Up @@ -51,5 +51,4 @@ struct DemoAppSettingsView: View {

#Preview {
DemoAppSettingsView()
.environmentObject(Clerk.shared)
}
1 change: 0 additions & 1 deletion ClerkDemo/ClerkDemo/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ struct HomeView: View {

#Preview {
HomeView()
.environmentObject(Clerk.shared)
}
3 changes: 1 addition & 2 deletions Sources/UI/Common/AuthSocialProvidersView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI
import Algorithms

struct AuthSocialProvidersView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@State private var errorWrapper: ErrorWrapper?
@Environment(\.clerkTheme) private var clerkTheme
@State private var viewSize: CGSize?
Expand Down Expand Up @@ -122,7 +122,6 @@ extension AuthSocialProvidersView {
#Preview {
AuthSocialProvidersView(useCase: .signIn)
.padding()
.environmentObject(Clerk.shared)
}

#endif
2 changes: 1 addition & 1 deletion Sources/UI/Common/OrgLogoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI
import NukeUI

struct OrgLogoView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@Environment(\.clerkTheme) private var clerkTheme

var body: some View {
Expand Down
3 changes: 1 addition & 2 deletions Sources/UI/Components/Auth/AuthView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct AuthView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.dismiss) private var dismiss
@Environment(\.clerkTheme) private var clerkTheme
Expand Down Expand Up @@ -141,7 +141,6 @@ struct AuthView: View {

#Preview {
AuthView()
.environmentObject(Clerk.shared)
.environmentObject(ClerkUIState())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI
import NukeUI

struct SignInFactorOneAlternativeMethodsView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@State private var errorWrapper: ErrorWrapper?

Expand Down Expand Up @@ -93,7 +93,6 @@ struct SignInFactorOneAlternativeMethodsView: View {
#Preview {
SignInFactorOneAlternativeMethodsView(currentFactor: nil)
.padding()
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorOneEmailCodeView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState

@State private var code: String = ""
Expand Down Expand Up @@ -83,7 +83,6 @@ struct SignInFactorOneEmailCodeView: View {

#Preview {
SignInFactorOneEmailCodeView()
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//import SwiftUI
//
//struct SignInFactorOneEmailLinkView: View {
// @EnvironmentObject private var clerk: Clerk
// @ObservedObject private var clerk = Clerk.shared
// @EnvironmentObject private var clerkUIState: ClerkUIState
// @State private var errorWrapper: ErrorWrapper?
//
Expand Down Expand Up @@ -69,5 +69,4 @@
//
//#Preview {
// SignInFactorOneEmailLinkView()
// .environmentObject(Clerk.shared)
//}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorOnePasswordView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme

Expand Down Expand Up @@ -105,7 +105,6 @@ struct SignInFactorOnePasswordView: View {

#Preview {
SignInFactorOnePasswordView()
.environmentObject(Clerk.shared)
.environmentObject(ClerkUIState())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorOnePhoneCodeView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState

@State private var code: String = ""
Expand Down Expand Up @@ -83,7 +83,6 @@ struct SignInFactorOnePhoneCodeView: View {

#Preview {
SignInFactorOnePhoneCodeView()
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorOneResetView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme

Expand Down Expand Up @@ -118,7 +118,6 @@ struct SignInFactorOneResetView: View {

#Preview {
SignInFactorOneResetView()
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorOneUseAnotherMethodView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme
@Environment(\.dismiss) private var dismiss
Expand Down Expand Up @@ -56,7 +56,6 @@ struct SignInFactorOneUseAnotherMethodView: View {

#Preview {
SignInFactorOneUseAnotherMethodView(currentFactor: nil)
.environmentObject(Clerk.shared)
.environmentObject(ClerkUIState())
}

Expand Down
3 changes: 1 addition & 2 deletions Sources/UI/Components/Auth/SignIn/SignInFactorOneView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorOneView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.openURL) private var openURL

Expand Down Expand Up @@ -95,7 +95,6 @@ struct SignInFactorOneView: View {

#Preview {
SignInFactorOneView()
.environmentObject(Clerk.shared)
.environmentObject(ClerkUIState())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI
import NukeUI

struct SignInFactorTwoAlternativeMethodsView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@State private var errorWrapper: ErrorWrapper?

Expand Down Expand Up @@ -61,7 +61,6 @@ struct SignInFactorTwoAlternativeMethodsView: View {

#Preview {
SignInFactorTwoAlternativeMethodsView(currentFactor: nil)
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorTwoBackupCodeView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme

Expand Down Expand Up @@ -82,7 +82,6 @@ struct SignInFactorTwoBackupCodeView: View {

#Preview {
SignInFactorTwoBackupCodeView()
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorTwoPhoneCodeView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState

@State private var code: String = ""
Expand Down Expand Up @@ -78,7 +78,6 @@ struct SignInFactorTwoPhoneCodeView: View {

#Preview {
SignInFactorTwoPhoneCodeView()
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorTwoTotpCodeView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState

@State private var code: String = ""
Expand Down Expand Up @@ -61,7 +61,6 @@ struct SignInFactorTwoTotpCodeView: View {

#Preview {
SignInFactorTwoTotpCodeView()
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorTwoUseAnotherMethodView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme
@Environment(\.dismiss) private var dismiss
Expand Down Expand Up @@ -55,7 +55,6 @@ struct SignInFactorTwoUseAnotherMethodView: View {

#Preview {
SignInFactorTwoUseAnotherMethodView(currentFactor: nil)
.environmentObject(Clerk.shared)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFactorTwoView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.openURL) private var openURL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import NukeUI
import AuthenticationServices

struct SignInForgotPasswordView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme
@State private var errorWrapper: ErrorWrapper?
Expand Down Expand Up @@ -82,7 +82,6 @@ struct SignInForgotPasswordView: View {

#Preview {
SignInForgotPasswordView()
.environmentObject(Clerk.shared)
}

#endif
3 changes: 1 addition & 2 deletions Sources/UI/Components/Auth/SignIn/SignInFormView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInFormView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme

Expand Down Expand Up @@ -147,7 +147,6 @@ struct SignInFormView: View {
#Preview {
SignInFormView()
.padding()
.environmentObject(Clerk.shared)
.environmentObject(ClerkUIState())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInResetPasswordView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme

Expand Down
3 changes: 1 addition & 2 deletions Sources/UI/Components/Auth/SignIn/SignInStartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignInStartView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState

private var socialProvidersEnabled: Bool {
Expand Down Expand Up @@ -66,7 +66,6 @@ struct SignInStartView: View {

#Preview {
SignInStartView()
.environmentObject(Clerk.shared)
}

#endif
3 changes: 1 addition & 2 deletions Sources/UI/Components/Auth/SignUp/SignUpEmailCodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignUpEmailCodeView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState

@State private var code: String = ""
Expand Down Expand Up @@ -79,7 +79,6 @@ struct SignUpEmailCodeView: View {

#Preview {
return SignUpEmailCodeView()
.environmentObject(Clerk.shared)
.environmentObject(ClerkUIState())
}

Expand Down
3 changes: 1 addition & 2 deletions Sources/UI/Components/Auth/SignUp/SignUpFormView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import SwiftUI

struct SignUpFormView: View {
@EnvironmentObject private var clerk: Clerk
@ObservedObject private var clerk = Clerk.shared
@EnvironmentObject private var clerkUIState: ClerkUIState
@Environment(\.clerkTheme) private var clerkTheme
@FocusState private var focusedField: Field?
Expand Down Expand Up @@ -228,7 +228,6 @@ struct SignUpFormView: View {
#Preview {
SignUpFormView()
.padding()
.environmentObject(Clerk.shared)
}

#endif
Loading
Loading