Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RepositoryImpl(private val auth: FirebaseAuth) : Repository {
- override fun signIn(email: String,password: String) {
- auth.signWithInEmailAndPassword(email, password)
- }
- }
- // domain
- interface AuthRepository {
- fun signIn()
- }
- class MyApplication : Application() {
- lateinit var viewModel: MainViewModel
- override fun onCreate(){
- val auth = FirebaseAuth.getInstance()
- val repository = RepositoryImpl(auth)
- val interactor = InteractorImpl(repository)
- viewModel = MainViewModel(interactor)
- }
- }
- class MainActivity {
- override fun onCreate() {
- val myApplication = application as MyApplication
- val viewModel = myApplication.viewModel
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement