mirror of
https://github.com/bitwarden/ios.git
synced 2026-02-04 02:14:09 -06:00
[PM-31181] fix: Fix display toast after view/edit cipher action like delete (#2290)
This commit is contained in:
parent
1def5003af
commit
9302960f0f
@ -153,10 +153,6 @@ class AutofillCredentialServiceAppExtensionTests: BitwardenTestCase { // swiftli
|
||||
prepareDataForIdentitiesReplacement()
|
||||
stateService.activeAccount = .fixture(profile: .fixture(userId: "1"))
|
||||
|
||||
try await waitForAsync { [weak self] in
|
||||
guard let self else { return false }
|
||||
return subject.hasCipherChangesSubscription
|
||||
}
|
||||
credentialIdentityFactory.createCredentialIdentitiesMocker
|
||||
.withResult { cipher in
|
||||
if cipher.id == "3" {
|
||||
@ -174,6 +170,11 @@ class AutofillCredentialServiceAppExtensionTests: BitwardenTestCase { // swiftli
|
||||
}
|
||||
}
|
||||
|
||||
try await waitForAsync { [weak self] in
|
||||
guard let self else { return false }
|
||||
return subject.hasCipherChangesSubscription
|
||||
}
|
||||
|
||||
// Send an upserted cipher
|
||||
cipherService.cipherChangesSubject.send(
|
||||
.upserted(.fixture(
|
||||
|
||||
@ -141,7 +141,10 @@ final class VaultGroupProcessor: StateProcessor<
|
||||
switch action {
|
||||
case let .addItemPressed(type):
|
||||
let type = type ?? CipherType(group: state.group) ?? .login
|
||||
coordinator.navigate(to: .addItem(group: state.group, type: type))
|
||||
coordinator.navigate(
|
||||
to: .addItem(group: state.group, type: type),
|
||||
context: self,
|
||||
)
|
||||
case .clearURL:
|
||||
state.url = nil
|
||||
case let .copyTOTPCode(code):
|
||||
@ -216,7 +219,10 @@ final class VaultGroupProcessor: StateProcessor<
|
||||
private func navigateToViewItem(cipherListView: CipherListView, id: String) {
|
||||
Task {
|
||||
await masterPasswordRepromptHelper.repromptForMasterPasswordIfNeeded(cipherListView: cipherListView) {
|
||||
self.coordinator.navigate(to: .viewItem(id: id, masterPasswordRepromptCheckCompleted: true))
|
||||
self.coordinator.navigate(
|
||||
to: .viewItem(id: id, masterPasswordRepromptCheckCompleted: true),
|
||||
context: self,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -618,6 +618,7 @@ class VaultGroupProcessorTests: BitwardenTestCase { // swiftlint:disable:this ty
|
||||
subject.state.group = .card
|
||||
subject.receive(.addItemPressed(.card))
|
||||
XCTAssertEqual(coordinator.routes.last, .addItem(group: .card, type: .card))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultGroupProcessor)
|
||||
}
|
||||
|
||||
/// `receive(_:)` with `.addItemPressed` navigates to the `.addItem` route with the correct group.
|
||||
@ -627,6 +628,7 @@ class VaultGroupProcessorTests: BitwardenTestCase { // swiftlint:disable:this ty
|
||||
subject.state.group = group
|
||||
subject.receive(.addItemPressed(nil))
|
||||
XCTAssertEqual(coordinator.routes.last, .addItem(group: group, type: .login))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultGroupProcessor)
|
||||
}
|
||||
|
||||
/// `receive(_:)` with `.addItemPressed` navigates to the `.addItem` route with an organization
|
||||
@ -637,6 +639,7 @@ class VaultGroupProcessorTests: BitwardenTestCase { // swiftlint:disable:this ty
|
||||
subject.state.group = group
|
||||
subject.receive(.addItemPressed(.secureNote))
|
||||
XCTAssertEqual(coordinator.routes.last, .addItem(group: group, type: .secureNote))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultGroupProcessor)
|
||||
}
|
||||
|
||||
/// TOTP Code expiration updates the state's TOTP codes.
|
||||
@ -837,6 +840,7 @@ class VaultGroupProcessorTests: BitwardenTestCase { // swiftlint:disable:this ty
|
||||
try await waitForAsync { !self.coordinator.routes.isEmpty }
|
||||
|
||||
XCTAssertEqual(coordinator.routes.last, .viewItem(id: "id", masterPasswordRepromptCheckCompleted: true))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultGroupProcessor)
|
||||
XCTAssertEqual(masterPasswordRepromptHelper.repromptForMasterPasswordCipherListView, cipherListView)
|
||||
}
|
||||
|
||||
@ -880,6 +884,7 @@ class VaultGroupProcessorTests: BitwardenTestCase { // swiftlint:disable:this ty
|
||||
try await waitForAsync { !self.coordinator.routes.isEmpty }
|
||||
|
||||
XCTAssertEqual(coordinator.routes.last, .viewItem(id: totpItem.id, masterPasswordRepromptCheckCompleted: true))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultGroupProcessor)
|
||||
XCTAssertEqual(masterPasswordRepromptHelper.repromptForMasterPasswordCipherListView, cipherListView)
|
||||
}
|
||||
|
||||
|
||||
@ -208,9 +208,15 @@ extension VaultListProcessor {
|
||||
setProfileSwitcher(visible: false)
|
||||
switch state.vaultFilterType {
|
||||
case let .organization(organization):
|
||||
coordinator.navigate(to: .addItem(organizationId: organization.id, type: type))
|
||||
coordinator.navigate(
|
||||
to: .addItem(organizationId: organization.id, type: type),
|
||||
context: self,
|
||||
)
|
||||
default:
|
||||
coordinator.navigate(to: .addItem(type: type))
|
||||
coordinator.navigate(
|
||||
to: .addItem(type: type),
|
||||
context: self,
|
||||
)
|
||||
}
|
||||
reviewPromptTask?.cancel()
|
||||
}
|
||||
@ -346,7 +352,10 @@ extension VaultListProcessor {
|
||||
private func navigateToViewItem(cipherListView: CipherListView, id: String) {
|
||||
Task {
|
||||
await masterPasswordRepromptHelper.repromptForMasterPasswordIfNeeded(cipherListView: cipherListView) {
|
||||
self.coordinator.navigate(to: .viewItem(id: id, masterPasswordRepromptCheckCompleted: true))
|
||||
self.coordinator.navigate(
|
||||
to: .viewItem(id: id, masterPasswordRepromptCheckCompleted: true),
|
||||
context: self,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1791,6 +1791,7 @@ class VaultListProcessorTests: BitwardenTestCase { // swiftlint:disable:this typ
|
||||
subject.receive(.addItemPressed(.login))
|
||||
|
||||
XCTAssertEqual(coordinator.routes.last, .addItem(type: .login))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultListProcessor)
|
||||
}
|
||||
|
||||
/// `receive(_:)` with `.addItemPressed` navigates to the `.addItem` route for a new secure note.
|
||||
@ -1799,6 +1800,7 @@ class VaultListProcessorTests: BitwardenTestCase { // swiftlint:disable:this typ
|
||||
subject.receive(.addItemPressed(.secureNote))
|
||||
|
||||
XCTAssertEqual(coordinator.routes.last, .addItem(type: .secureNote))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultListProcessor)
|
||||
}
|
||||
|
||||
/// `receive(_:)` with `.addItemPressed` hides the profile switcher view
|
||||
@ -1829,6 +1831,7 @@ class VaultListProcessorTests: BitwardenTestCase { // swiftlint:disable:this typ
|
||||
subject.receive(.addItemPressed(.login))
|
||||
|
||||
XCTAssertEqual(coordinator.routes.last, .addItem(organizationId: "organization-1", type: .login))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultListProcessor)
|
||||
}
|
||||
|
||||
/// `receive(_:)` with `.clearURL` clears the url in the state.
|
||||
@ -1874,6 +1877,7 @@ class VaultListProcessorTests: BitwardenTestCase { // swiftlint:disable:this typ
|
||||
try await waitForAsync { !self.coordinator.routes.isEmpty }
|
||||
|
||||
XCTAssertEqual(coordinator.routes.last, .viewItem(id: item.id, masterPasswordRepromptCheckCompleted: true))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultListProcessor)
|
||||
XCTAssertEqual(masterPasswordRepromptHelper.repromptForMasterPasswordCipherListView, cipherListView)
|
||||
}
|
||||
|
||||
@ -1918,6 +1922,7 @@ class VaultListProcessorTests: BitwardenTestCase { // swiftlint:disable:this typ
|
||||
try await waitForAsync { !self.coordinator.routes.isEmpty }
|
||||
|
||||
XCTAssertEqual(coordinator.routes.last, .viewItem(id: "123", masterPasswordRepromptCheckCompleted: true))
|
||||
XCTAssertTrue(coordinator.contexts.last is VaultListProcessor)
|
||||
XCTAssertEqual(masterPasswordRepromptHelper.repromptForMasterPasswordCipherListView, cipherListView)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user