Skip to content

Commit b01245f

Browse files
committed
fix: address review comments — add @VisibleForTesting annotations, fix process death docs, rename misleading tests
1 parent 5eba7ac commit b01245f

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

EXAMPLES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ WebAuthProvider.logout(account)
330330
When the Activity is destroyed during authentication due to a configuration change (e.g. device rotation, locale change, dark mode toggle), the SDK caches the authentication result internally. Call `WebAuthProvider.registerCallbacks()` once in your `onCreate()` to recover it. This single call handles both recovery scenarios:
331331

332332
- **Configuration change**: delivers any cached result on the next `onResume` to the callback
333-
- **Process death**: registers `loginCallback` as a listener and auto-removes it when the Activity is destroyed
333+
- **Process death**: `AuthenticationActivity` restores OAuth state and processes the redirect. Since static state was wiped, the result is cached and delivered to `loginCallback` on the next `onResume` after `registerCallbacks()` is called
334334

335335
```kotlin
336336
class LoginActivity : AppCompatActivity() {

V4_MIGRATION_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class LoginActivity : AppCompatActivity() {
342342
| Scenario | How it's handled |
343343
|----------|-----------------|
344344
| **Configuration change** (rotation, locale, dark mode) | The result is delivered directly to the registered callback once the async token exchange completes. If no callback is registered yet, the result is cached and delivered on the next `onResume` |
345-
| **Process death** (system killed the app while browser was open) | `loginCallback` is registered as a listener and auto-removed when `lifecycleOwner` is destroyed — no manual `addCallback`/`removeCallback` calls needed |
345+
| **Process death** (system killed the app while browser was open) | `AuthenticationActivity` restores the OAuth state and processes the redirect. Since all static state (including `callbacks`) was wiped, the result is cached in `pendingLoginResult`. When your Activity is recreated and calls `registerCallbacks()`, the cached result is delivered on the next `onResume` |
346346

347347
> **Note:** Both `loginCallback` and `logoutCallback` are required — this ensures results from either flow are never lost during configuration changes or process death.
348348

auth0/src/main/java/com/auth0/android/provider/WebAuthProvider.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public object WebAuthProvider {
3838
private val callbacks = CopyOnWriteArraySet<Callback<Credentials, AuthenticationException>>()
3939

4040
@JvmStatic
41+
@get:VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
4142
internal var managerInstance: ResumableManager? = null
4243
private set
4344

0 commit comments

Comments
 (0)