Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.getcode.opencode.model.core.ID
import com.getcode.utils.TraceManager
import com.getcode.utils.TraceType
import com.flipcash.libs.coroutines.DispatcherProvider
import com.getcode.utils.network.NetworkConnectivityListener
import com.getcode.utils.network.retryable
import com.getcode.utils.trace
import kotlinx.coroutines.CoroutineScope
Expand Down Expand Up @@ -49,6 +50,7 @@ class AuthManager @Inject constructor(
private val appSettings: AppSettingsCoordinator,
private val userFlags: UserFlagsCoordinator,
private val contactCoordinator: ContactCoordinator,
private val networkObserver: NetworkConnectivityListener,
private val dispatchers: DispatcherProvider,
// private val analytics: AnalyticsService,
) : CoroutineScope by CoroutineScope(dispatchers.IO) {
Expand Down Expand Up @@ -192,8 +194,12 @@ class AuthManager @Inject constructor(

coroutineScope {
launch {
val flags = retryable(maxRetries = 3) {
accountController.getUserFlags().getOrNull()
val flags = if (!isSoftLogin || networkObserver.isConnected) {
retryable(maxRetries = 3) {
accountController.getUserFlags().getOrNull()
}
} else {
null
}

val seenAccessKey = credentialManager.hasSeenAccessKey()
Expand Down Expand Up @@ -228,9 +234,13 @@ class AuthManager @Inject constructor(
}
}

profileController.updateUserProfile()
if (networkObserver.isConnected) {
profileController.updateUserProfile()
}
}
if (networkObserver.isConnected) {
launch { savePrefs() }
}
launch { savePrefs() }
}
}.onFailure {
logout()
Expand Down
Loading