@@ -22,13 +22,13 @@ public class OAuthProviderSwift: AuthProviderSwift, DeleteUserSwift {
2222 public let providerId : String
2323 public let scopes : [ String ]
2424 public let customParameters : [ String : String ]
25-
25+
2626 // Button appearance
2727 public let displayName : String
2828 public let buttonIcon : Image
2929 public let buttonBackgroundColor : Color
3030 public let buttonForegroundColor : Color
31-
31+
3232 /// Initialize a generic OAuth provider
3333 /// - Parameters:
3434 /// - providerId: The OAuth provider ID (e.g., "github.com", "microsoft.com")
@@ -38,15 +38,13 @@ public class OAuthProviderSwift: AuthProviderSwift, DeleteUserSwift {
3838 /// - buttonIcon: Button icon image
3939 /// - buttonBackgroundColor: Button background color
4040 /// - buttonForegroundColor: Button text/icon color
41- public init (
42- providerId: String ,
43- scopes: [ String ] = [ ] ,
44- customParameters: [ String : String ] = [ : ] ,
45- displayName: String ,
46- buttonIcon: Image ,
47- buttonBackgroundColor: Color = . black,
48- buttonForegroundColor: Color = . white
49- ) {
41+ public init ( providerId: String ,
42+ scopes: [ String ] = [ ] ,
43+ customParameters: [ String : String ] = [ : ] ,
44+ displayName: String ,
45+ buttonIcon: Image ,
46+ buttonBackgroundColor: Color = . black,
47+ buttonForegroundColor: Color = . white) {
5048 self . providerId = providerId
5149 self . scopes = scopes
5250 self . customParameters = customParameters
@@ -55,7 +53,7 @@ public class OAuthProviderSwift: AuthProviderSwift, DeleteUserSwift {
5553 self . buttonBackgroundColor = buttonBackgroundColor
5654 self . buttonForegroundColor = buttonForegroundColor
5755 }
58-
56+
5957 /// Convenience initializer using SF Symbol
6058 /// - Parameters:
6159 /// - providerId: The OAuth provider ID (e.g., "github.com", "microsoft.com")
@@ -65,15 +63,13 @@ public class OAuthProviderSwift: AuthProviderSwift, DeleteUserSwift {
6563 /// - iconSystemName: SF Symbol name
6664 /// - buttonBackgroundColor: Button background color
6765 /// - buttonForegroundColor: Button text/icon color
68- public convenience init (
69- providerId: String ,
70- scopes: [ String ] = [ ] ,
71- customParameters: [ String : String ] = [ : ] ,
72- displayName: String ,
73- iconSystemName: String ,
74- buttonBackgroundColor: Color = . black,
75- buttonForegroundColor: Color = . white
76- ) {
66+ public convenience init ( providerId: String ,
67+ scopes: [ String ] = [ ] ,
68+ customParameters: [ String : String ] = [ : ] ,
69+ displayName: String ,
70+ iconSystemName: String ,
71+ buttonBackgroundColor: Color = . black,
72+ buttonForegroundColor: Color = . white) {
7773 self . init (
7874 providerId: providerId,
7975 scopes: scopes,
@@ -84,20 +80,20 @@ public class OAuthProviderSwift: AuthProviderSwift, DeleteUserSwift {
8480 buttonForegroundColor: buttonForegroundColor
8581 )
8682 }
87-
83+
8884 @MainActor public func createAuthCredential( ) async throws -> AuthCredential {
8985 let provider = OAuthProvider ( providerID: providerId)
90-
86+
9187 // Set scopes if provided
9288 if !scopes. isEmpty {
9389 provider. scopes = scopes
9490 }
95-
91+
9692 // Set custom parameters if provided
9793 if !customParameters. isEmpty {
9894 provider. customParameters = customParameters
9995 }
100-
96+
10197 return try await withCheckedThrowingContinuation { continuation in
10298 provider. getCredentialWith ( nil ) { credential, error in
10399 if let error {
@@ -116,7 +112,7 @@ public class OAuthProviderSwift: AuthProviderSwift, DeleteUserSwift {
116112 }
117113 }
118114 }
119-
115+
120116 public func deleteUser( user: User ) async throws {
121117 let operation = OAuthDeleteUserOperation ( oauthProvider: self )
122118 try await operation ( on: user)
@@ -125,20 +121,19 @@ public class OAuthProviderSwift: AuthProviderSwift, DeleteUserSwift {
125121
126122public class OAuthProviderAuthUI : AuthProviderUI {
127123 public var provider : AuthProviderSwift
128-
124+
129125 public init ( provider: AuthProviderSwift ) {
130126 self . provider = provider
131127 }
132-
128+
133129 public var id : String {
134130 guard let oauthProvider = provider as? OAuthProviderSwift else {
135131 return " oauth.unknown "
136132 }
137133 return oauthProvider. providerId
138134 }
139-
135+
140136 @MainActor public func authButton( ) -> AnyView {
141137 AnyView ( GenericOAuthButton ( provider: provider) )
142138 }
143139}
144-
0 commit comments