Skip to content

Commit b0ac315

Browse files
authored
[Auth] Fix Xcode 26.2 build warning (#15564)
1 parent f63f3cc commit b0ac315

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

FirebaseAuth/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22
- [fixed] Add a mechanism to prevent concurrent token refreshes. (#15474)
3+
- [fixed] Fix "weak never mutated" build warning introduced in Xcode 26.2.
34

45
# 12.2.0
56
- [added] Added TOTP support for macOS.

FirebaseAuth/Sources/Swift/Auth/Auth.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,30 +1938,30 @@ extension Auth: AuthInterop {
19381938
"for the new token.")
19391939
}
19401940
autoRefreshScheduled = true
1941-
weak var weakSelf = self
1942-
authDispatcher.dispatch(afterDelay: delay, queue: kAuthGlobalWorkQueue) {
1943-
guard let strongSelf = weakSelf else {
1941+
authDispatcher.dispatch(afterDelay: delay, queue: kAuthGlobalWorkQueue) { [weak self] in
1942+
guard let self else {
19441943
return
19451944
}
1946-
guard strongSelf._currentUser?.rawAccessToken() == accessToken else {
1945+
guard self._currentUser?.rawAccessToken() == accessToken else {
19471946
// Another auto refresh must have been scheduled, so keep _autoRefreshScheduled unchanged.
19481947
return
19491948
}
1950-
strongSelf.autoRefreshScheduled = false
1951-
if strongSelf.isAppInBackground {
1949+
self.autoRefreshScheduled = false
1950+
if self.isAppInBackground {
19521951
return
19531952
}
1954-
let uid = strongSelf._currentUser?.uid
1955-
strongSelf._currentUser?
1956-
.internalGetToken(forceRefresh: true, backend: strongSelf.backend) { token, error in
1957-
if strongSelf._currentUser?.uid != uid {
1953+
let uid = self._currentUser?.uid
1954+
self._currentUser?
1955+
.internalGetToken(forceRefresh: true, backend: self.backend) { [weak self] token, error in
1956+
guard let self else { return }
1957+
if self._currentUser?.uid != uid {
19581958
return
19591959
}
19601960
if error != nil {
19611961
// Kicks off exponential back off logic to retry failed attempt. Starts with one minute
19621962
// delay (60 seconds) if this is the first failed attempt.
19631963
let rescheduleDelay = retry ? min(delay * 2, 16 * 60) : 60
1964-
strongSelf.scheduleAutoTokenRefresh(withDelay: rescheduleDelay, retry: true)
1964+
self.scheduleAutoTokenRefresh(withDelay: rescheduleDelay, retry: true)
19651965
}
19661966
}
19671967
}

0 commit comments

Comments
 (0)