Skip to content

Commit 53a9ce5

Browse files
sign in with custom auth implmentation file
1 parent 286a100 commit 53a9ce5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import 'package:ensemble/framework/action.dart';
2+
import 'package:ensemble/framework/event.dart';
3+
import 'package:ensemble/framework/stub/auth_context_manager.dart';
4+
import 'package:ensemble/screen_controller.dart';
5+
import 'package:ensemble/widget/stub_widgets.dart';
6+
import 'package:ensemble_auth/signin/auth_manager.dart';
7+
import 'package:flutter/material.dart';
8+
9+
class SignInWithCustomAuthImpl implements SignInWithCustomAuth {
10+
@override
11+
Future<void> signInWithCustomAuth(BuildContext context,
12+
{required SignInWithCustomAuthAction action}) async {
13+
final isAuthenticated = await AuthManager().signInWithCustomAuth(context,idToken: action.idToken!);
14+
if (isAuthenticated != null) {
15+
if (action.onAuthenticated != null) {
16+
AuthenticatedUser? currentUser = AuthManager().getCurrentUser();
17+
ScreenController().executeAction(context, action.onAuthenticated!,
18+
event: EnsembleEvent(null, data: {'user': currentUser}));
19+
}
20+
} else {
21+
if (action.onError != null) {
22+
ScreenController().executeAction(context, action.onError!);
23+
}
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)