This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override suspend fun getUserLoggedInState(): Flow<Boolean> { | |
return protoDataStore.data | |
.catch { exception -> | |
// dataStore.data throws an IOException when an error is encountered when reading data | |
if (exception is IOException) { | |
emit(UserStore.getDefaultInstance()) | |
} else { | |
throw exception | |
} | |
}.map { protoBuilder -> | |
protoBuilder.isLoggedIn | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment