Skip to content

Commit

Permalink
Merge pull request #317 from PermanentOrg/bug/VSP-1491
Browse files Browse the repository at this point in the history
Bug/vsp 1491
  • Loading branch information
flaviahandrea-vsp authored Nov 18, 2024
2 parents 3df2015 + 3048480 commit 2cc6418
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,14 @@ class AuthenticationFragment : PermanentBaseFragment() {

private val onAccountCreated = Observer<Void?> {
logSignUpEvents()
startActivity(Intent(context, ArchiveOnboardingActivity::class.java))
activity?.finish()
startArchiveOnboardingActivity()
}

private val userMissingDefaultArchiveObserver = Observer<Void?> {
startArchiveOnboardingActivity()
}

private fun startArchiveOnboardingActivity() {
startActivity(Intent(context, ArchiveOnboardingActivity::class.java))
activity?.finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class AuthenticationViewModel(application: Application) : ObservableAndroidViewM
authRepository.login(email, password, object : IAuthenticationRepository.IOnLoginListener {
override fun onSuccess() {
_isBusyState.value = false
prefsHelper.saveUserLoggedIn(true)

val defaultArchiveId = prefsHelper.getDefaultArchiveId()
if (defaultArchiveId == 0) {
Expand Down Expand Up @@ -155,6 +154,7 @@ class AuthenticationViewModel(application: Application) : ObservableAndroidViewM
archive.thumbURL200,
archive.accessRole
)
prefsHelper.saveUserLoggedIn(true)
onSignedIn.call()
return
}
Expand Down Expand Up @@ -210,7 +210,7 @@ class AuthenticationViewModel(application: Application) : ObservableAndroidViewM
object : IAuthenticationRepository.IOnVerifyListener {
override fun onSuccess() {
_isBusyState.value = false
onSignedIn.call()
onCodeVerified()
}

override fun onFailed(error: String?) {
Expand All @@ -227,6 +227,13 @@ class AuthenticationViewModel(application: Application) : ObservableAndroidViewM
})
}

fun onCodeVerified() {
val defaultArchiveId = prefsHelper.getDefaultArchiveId()

if (defaultArchiveId == 0) onUserMissingDefaultArchive.call()
else getArchive(defaultArchiveId)
}

fun updateCodeValues(newValues: List<String>) {
_codeValues.value = newValues
}
Expand Down

0 comments on commit 2cc6418

Please sign in to comment.