Skip to content

Commit

Permalink
update account history on login/create account
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Dec 4, 2023
1 parent e119d9b commit f8dc077
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.mullvad.mullvadvpn.repository

import android.util.Log
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -64,14 +65,14 @@ class AccountRepository(
withContext(dispatcher) {
val deferred = async { accountCreationEvents.first() }
messageHandler.trySendRequest(Request.CreateAccount)
deferred.await()
deferred.await().also { fetchAccountHistory() }
}

suspend fun login(accountToken: String): LoginResult =
withContext(Dispatchers.IO) {
val deferred = async { loginEvents.first() }
messageHandler.trySendRequest(Request.Login(accountToken))
deferred.await()
deferred.await().also { fetchAccountHistory() }
}

fun logout() {
Expand Down

0 comments on commit f8dc077

Please sign in to comment.