diff --git a/app/src/main/java/com/example/notemania/FirebaseAuthSingleton.java b/app/src/main/java/com/example/notemania/FirebaseAuthSingleton.java index 116cf95..136e2a7 100644 --- a/app/src/main/java/com/example/notemania/FirebaseAuthSingleton.java +++ b/app/src/main/java/com/example/notemania/FirebaseAuthSingleton.java @@ -23,4 +23,26 @@ public static synchronized FirebaseAuthSingleton getInstance() { public FirebaseAuth getFirebaseAuth() { return firebaseAuth; } -} \ No newline at end of file + public void signIn(String email, String password, onSignInListener listener) { + firebaseAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(task -> { + if (task.isSuccessful()) { + listener.onSignInSuccess(); + } else { + // Login failed + listener.onSignInFailed(task.getException().getMessage()); + } + }); + } + + public void signOut() { + firebaseAuth.signOut(); + } + + + + public interface onSignInListener { + void onSignInSuccess(); + void onSignInFailed(String errorMessage); + } + +}