File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
app/src/main/java/com/example/notemania Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -23,4 +23,26 @@ public static synchronized FirebaseAuthSingleton getInstance() {
23
23
public FirebaseAuth getFirebaseAuth () {
24
24
return firebaseAuth ;
25
25
}
26
- }
26
+ public void signIn (String email , String password , onSignInListener listener ) {
27
+ firebaseAuth .signInWithEmailAndPassword (email , password ).addOnCompleteListener (task -> {
28
+ if (task .isSuccessful ()) {
29
+ listener .onSignInSuccess ();
30
+ } else {
31
+ // Login failed
32
+ listener .onSignInFailed (task .getException ().getMessage ());
33
+ }
34
+ });
35
+ }
36
+
37
+ public void signOut () {
38
+ firebaseAuth .signOut ();
39
+ }
40
+
41
+
42
+
43
+ public interface onSignInListener {
44
+ void onSignInSuccess ();
45
+ void onSignInFailed (String errorMessage );
46
+ }
47
+
48
+ }
You can’t perform that action at this time.
0 commit comments