Skip to content

Commit 5bb95f6

Browse files
committed
Do not observe ApplicationPasswordsGenerationFailed when authenticated with wpcom
1 parent f80f705 commit 5bb95f6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

WooCommerce/Classes/Yosemite/DefaultStoresManager.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,11 @@ class DefaultStoresManager: StoresManager {
164164
state = AuthenticatedState(credentials: credentials, sessionManager: sessionManager)
165165
sessionManager.defaultCredentials = credentials
166166

167-
listenToApplicationPasswordGenerationFailureNotification()
168-
listenToWPCOMInvalidWPCOMTokenNotification()
167+
if case .wpcom = credentials {
168+
listenToWPCOMInvalidWPCOMTokenNotification()
169+
} else {
170+
listenToApplicationPasswordGenerationFailureNotification()
171+
}
169172

170173
return self
171174
}
@@ -176,10 +179,7 @@ class DefaultStoresManager: StoresManager {
176179
applicationPasswordGenerationFailureObserver = notificationCenter.addObserver(forName: .ApplicationPasswordsGenerationFailed,
177180
object: nil,
178181
queue: .main) { [weak self] note in
179-
guard let self else { return }
180-
if isAuthenticatedWithoutWPCom {
181-
_ = deauthenticate()
182-
}
182+
_ = self?.deauthenticate()
183183
}
184184
}
185185

0 commit comments

Comments
 (0)