Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Pretty print
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke committed Sep 28, 2020
1 parent 6c5f03b commit a78fc03
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,18 @@ object SimpleCredentialsStore : CredentialsStore {
cachedCredentials!!.removeIf { it.service == serviceDefinition.shortName() && it.tokenSet == tokenSet }
cachedCredentials!!.add(StoredToken(serviceDefinition.shortName(), tokenSet, token))

file.sink()
.buffer()
.use {
moshi.listAdapter<StoredToken>().toJson(it, cachedCredentials)
}
writeTokens()
}
}

fun writeTokens() {
file.sink()
.buffer()
.use {
moshi.listAdapter<StoredToken>().indent(" ").toJson(it, cachedCredentials)
}
}

override suspend fun <T> remove(
serviceDefinition: ServiceDefinition<T>,
tokenSet: String
Expand All @@ -90,11 +94,7 @@ object SimpleCredentialsStore : CredentialsStore {

cachedCredentials!!.removeIf { it.service == serviceDefinition.shortName() && it.tokenSet == tokenSet }

file.sink()
.buffer()
.use {
moshi.listAdapter<StoredToken>().toJson(it, cachedCredentials)
}
writeTokens()
}
}
}

0 comments on commit a78fc03

Please sign in to comment.