Advertisement
Kostiggig

Untitled

Jul 18th, 2022
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.67 KB | None | 0 0
  1. class RepositoryImpl(private val auth: FirebaseAuth) : Repository {
  2.  
  3.     override fun signIn(email: String,password: String) {
  4.         auth.signWithInEmailAndPassword(email, password)
  5.     }
  6. }
  7.  
  8. // domain
  9. interface AuthRepository {
  10.      fun signIn()
  11. }
  12.  
  13. class MyApplication : Application() {
  14.     lateinit var viewModel: MainViewModel
  15.  
  16.     override fun onCreate(){
  17.         val auth = FirebaseAuth.getInstance()
  18.         val repository = RepositoryImpl(auth)
  19.         val interactor = InteractorImpl(repository)
  20.         viewModel = MainViewModel(interactor)
  21.     }
  22. }
  23.  
  24. class MainActivity {
  25.  
  26.     override fun onCreate() {
  27.         val myApplication = application as MyApplication
  28.  
  29.         val viewModel = myApplication.viewModel
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement