Skip to content

Commit

Permalink
stop using deprecated hasErrors() method in favor of property
Browse files Browse the repository at this point in the history
  • Loading branch information
frett committed Oct 4, 2023
1 parent 596a718 commit b249e59
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal class FacebookAccountProvider @Inject constructor(
resp = authenticateWithMobileContentApi(accessToken)
}

val token = resp?.takeIf { it.isSuccessful }?.body()?.takeUnless { it.hasErrors() }?.dataSingle
val token = resp?.takeIf { it.isSuccessful }?.body()?.takeUnless { it.hasErrors }?.dataSingle
if (accessToken != null && token != null) prefs.edit { putString(PREF_USER_ID(accessToken), token.userId) }
return token
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal class GoogleAccountProvider @Inject constructor(
val account = GoogleSignIn.getLastSignedInAccount(context)
val request = account?.idToken?.let { AuthToken.Request(googleIdToken = it) } ?: return null
val token = authApi.authenticate(request).takeIf { it.isSuccessful }
?.body()?.takeUnless { it.hasErrors() }
?.body()?.takeUnless { it.hasErrors }
?.dataSingle
if (token != null) prefs.edit { putString(PREF_USER_ID(account), token.userId) }
return token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal class UserCounterSyncTasks @Inject internal constructor(
}

val counters = countersApi.getCounters().takeIf { it.isSuccessful }
?.body()?.takeUnless { it.hasErrors() }
?.body()?.takeUnless { it.hasErrors }
?.data ?: return false

userCountersRepository.transaction {
Expand All @@ -66,7 +66,7 @@ internal class UserCounterSyncTasks @Inject internal constructor(
.map { counter ->
async {
val updated = countersApi.updateCounter(counter.id, counter).takeIf { it.isSuccessful }
?.body()?.takeUnless { it.hasErrors() }
?.body()?.takeUnless { it.hasErrors }
?.dataSingle ?: return@async false

userCountersRepository.transaction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class UserSyncTasks @Inject constructor(
}

val user = userApi.getUser().takeIf { it.isSuccessful }
?.body()?.takeUnless { it.hasErrors() }
?.body()?.takeUnless { it.hasErrors }
?.dataSingle ?: return false

userRepository.storeUserFromSync(user)
Expand Down

0 comments on commit b249e59

Please sign in to comment.