Skip to content

Commit

Permalink
merge bookmarks on signin
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Apr 17, 2024
1 parent c74415a commit 3560865
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ class MainActivity : AppCompatActivity() {
val result = auth.signInWithCredential(firebaseCredential)
// Sign in success, update UI with the signed-in user's information
lifecycleScope.launch {
UserData().userRepository.setUser(result.user)
UserData().apply {
userRepository.setUser(result.user)
val uid = result.user?.uid
if (uid != null) {
syncBookmarksUseCase(uid)
}
}

println("user id=${result.user?.uid}")
println("idToken=${result.user?.getIdToken(true)}")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.androidmakers.ui.common.navigation

import fr.androidmakers.domain.interactor.SyncBookmarksUseCase
import fr.androidmakers.domain.repo.UserRepository
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject

class UserData: KoinComponent {
val userRepository: UserRepository by inject()
val syncBookmarksUseCase: SyncBookmarksUseCase by inject()
}


0 comments on commit 3560865

Please sign in to comment.