feat: pass role, agent type, and auth mode to social login providers and repository

This commit is contained in:
pradeepkumar
2026-03-31 22:45:16 +05:30
parent c2c1b51777
commit 26611274d5
5 changed files with 65 additions and 11 deletions

View File

@@ -178,7 +178,11 @@ class AuthNotifier extends StateNotifier<AuthState> {
}
}
Future<void> signInWithGoogle() async {
Future<void> signInWithGoogle({
String? role,
String? agentTypeId,
String mode = 'signup',
}) async {
state = state.copyWith(
status: AuthStatus.loading,
errorMessage: null,
@@ -204,6 +208,9 @@ class AuthNotifier extends StateNotifier<AuthState> {
email: account.email,
name: account.displayName,
avatar: account.photoUrl,
role: role,
agentTypeId: agentTypeId,
mode: mode,
);
state = state.copyWith(
@@ -226,7 +233,11 @@ class AuthNotifier extends StateNotifier<AuthState> {
}
}
Future<void> signInWithFacebook() async {
Future<void> signInWithFacebook({
String? role,
String? agentTypeId,
String mode = 'signup',
}) async {
state = state.copyWith(
status: AuthStatus.loading,
errorMessage: null,
@@ -273,6 +284,9 @@ class AuthNotifier extends StateNotifier<AuthState> {
email: email,
name: userData['name'] as String?,
avatar: avatarUrl,
role: role,
agentTypeId: agentTypeId,
mode: mode,
);
state = state.copyWith(
@@ -296,7 +310,12 @@ class AuthNotifier extends StateNotifier<AuthState> {
}
/// Complete Twitter/X login after webview returns user data.
Future<void> completeTwitterLogin(Map<String, dynamic> twitterUser) async {
Future<void> completeTwitterLogin(
Map<String, dynamic> twitterUser, {
String? role,
String? agentTypeId,
String mode = 'signup',
}) async {
state = state.copyWith(
status: AuthStatus.loading,
errorMessage: null,
@@ -310,6 +329,9 @@ class AuthNotifier extends StateNotifier<AuthState> {
email: '${twitterUser['username']}@x.com',
name: twitterUser['name'] as String?,
avatar: twitterUser['avatar'] as String?,
role: role,
agentTypeId: agentTypeId,
mode: mode,
);
state = state.copyWith(