Skip to content

Commit eb41391

Browse files
committed
Add applicationPasswordUnsupportedList in UI layer
1 parent a6f3699 commit eb41391

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

Modules/Sources/NetworkingCore/Network/AlamofireNetwork.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ extension UserDefaults {
280280
}
281281

282282
enum Key: String {
283+
/// This key is shared with the UI layer, so ensure to keep it in-sync with `UserDefaults+Woo`.
283284
case applicationPasswordUnsupportedList
284285
}
285286
}

WooCommerce/Classes/Extensions/UserDefaults+Woo.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Foundation
66
//
77
extension UserDefaults {
88
enum Key: String {
9+
case applicationPasswordUnsupportedList
910
case defaultCredentialsType
1011
case defaultAccountID
1112
case defaultUsername

WooCommerce/Classes/System/SessionManager.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ final class SessionManager: SessionManagerProtocol {
225225
defaults[.blazeSelectedCampaignObjective] = nil
226226
defaults[.wpcomSiteSuspended] = nil
227227
defaults[.tapToPayAwarenessMomentFirstLaunchCompleted] = nil
228+
defaults[.applicationPasswordUnsupportedList] = nil
228229
resetTimestampsValues()
229230
imageCache.clearCache()
230231
}

WooCommerce/WooCommerceTests/System/SessionManagerTests.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,28 @@ final class SessionManagerTests: XCTestCase {
378378
XCTAssertTrue(mockCache.clearCacheCalled)
379379
}
380380

381+
/// Verifies that image cache is cleared upon reset
382+
///
383+
func test_applicationPasswordUnsupportedList_is_cleared_upon_reset() throws {
384+
// Given
385+
let siteID: Int64 = 13
386+
let uuid = UUID().uuidString
387+
let defaults = try XCTUnwrap(UserDefaults(suiteName: uuid))
388+
let sut = SessionManager(defaults: defaults, keychainServiceName: Settings.keychainServiceName)
389+
390+
// When
391+
defaults[.applicationPasswordUnsupportedList] = [siteID]
392+
393+
// Then
394+
XCTAssertEqual(try XCTUnwrap(defaults[.applicationPasswordUnsupportedList] as? [Int64]), [siteID])
395+
396+
// When
397+
sut.reset()
398+
399+
// Then
400+
XCTAssertNil(defaults[.applicationPasswordUnsupportedList])
401+
}
402+
381403
/// Verifies that `removeDefaultCredentials` effectively nukes everything from the keychain
382404
///
383405
func testDefaultCredentialsAreEffectivelyNuked() {

0 commit comments

Comments
 (0)