mirror of
https://github.com/bitwarden/android.git
synced 2026-08-26 22:04:07 -05:00
Bug: Support translations for Cookie Acquisition error (#6917)
This commit is contained in:
@@ -13,6 +13,5 @@ import java.io.IOException
|
||||
*/
|
||||
class CookieRedirectException(
|
||||
val hostname: String,
|
||||
) : IOException(
|
||||
"Your request was interrupted because the app needed to re-authenticate. Please try again.",
|
||||
)
|
||||
message: String,
|
||||
) : IOException(message)
|
||||
|
||||
@@ -60,7 +60,10 @@ internal class CookieInterceptor(
|
||||
if (cookieProvider.needsBootstrap(hostname)) {
|
||||
Timber.d("Cookie bootstrap required for $hostname, triggering acquisition")
|
||||
cookieProvider.acquireCookies(hostname)
|
||||
throw CookieRedirectException(hostname = hostname)
|
||||
throw CookieRedirectException(
|
||||
hostname = hostname,
|
||||
message = cookieProvider.errorMessageString,
|
||||
)
|
||||
}
|
||||
|
||||
val request = originalRequest.withCookies(hostname)
|
||||
@@ -77,6 +80,7 @@ internal class CookieInterceptor(
|
||||
cookieProvider.acquireCookies(hostname)
|
||||
throw CookieRedirectException(
|
||||
hostname = hostname,
|
||||
message = cookieProvider.errorMessageString,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,11 @@ import com.bitwarden.network.model.NetworkCookie
|
||||
* Bitwarden API endpoints behind a load balancer.
|
||||
*/
|
||||
interface CookieProvider {
|
||||
/**
|
||||
* The translated human-readable string to be displayed when the missing cookie is the reason
|
||||
* for a request failure.
|
||||
*/
|
||||
val errorMessageString: String
|
||||
|
||||
/**
|
||||
* Determines if the given [hostname] requires cookie bootstrap.
|
||||
|
||||
Reference in New Issue
Block a user