[PM-26060] Consolidate StateProcessor to BitwardenKit (#2063)

This commit is contained in:
Katherine Bertelsen 2025-10-23 11:05:33 -05:00 committed by GitHub
parent 67b2fe4425
commit 4be3d91cfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 55 additions and 54 deletions

View File

@ -1,3 +1,4 @@
import BitwardenKit
import OSLog
import SwiftUI

View File

@ -1,3 +1,4 @@
import BitwardenKit
import OSLog
// MARK: - VaultUnlockProcessor

View File

@ -1,54 +0,0 @@
import BitwardenKit
import Combine
import Foundation
// MARK: - StateProcessor
/// A generic `Processor` which may be subclassed to easily build a `Processor` with the typical
/// properties, connections, and behaviors.
open class StateProcessor<State: Sendable, Action: Sendable, Effect: Sendable>: Processor {
// MARK: Properties
/// The processor's current state.
open var state: State {
get { stateSubject.value }
set { stateSubject.value = newValue }
}
/// A publisher that publishes the processor's state when it changes.
open var statePublisher: AnyPublisher<State, Never> {
stateSubject
.receive(on: RunLoop.main)
.eraseToAnyPublisher()
}
// MARK: Private properties
/// A subject used to store and publish the current state.
private var stateSubject: CurrentValueSubject<State, Never>
// MARK: Initialization
/// Initializes a `StateProcessor`.
///
/// - Parameter state: The initial state of the processor.
public init(state: State) {
stateSubject = CurrentValueSubject(state)
}
/// Performs an asynchronous effect.
///
/// Override this method in subclasses to customize its behavior.
///
/// - Parameter effect: The effect to perform.
///
open func perform(_ effect: Effect) async {}
/// Receives an action from the view's store.
///
/// Override this method in subclasses to customize its behavior.
///
/// - Parameter action: The action to process.
///
open func receive(_ action: Action) {}
}

View File

@ -1,3 +1,4 @@
import BitwardenKit
import Foundation
// MARK: - ExportItemsProcessor

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - SelectLanguageDelegate
/// The delegate for updating the parent view after a language has been selected.

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - TutorialProcessor
/// The processer used to manage state and handle actions for the tutorial screen.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import Foundation
import OSLog

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import SwiftUI

View File

@ -1,3 +1,4 @@
import BitwardenKit
import Combine
import SwiftUI

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - ExpiredLinkProcessor
/// The processor used to manage state and handle actions for the passwort hint screen.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
// MARK: - MasterPasswordGeneratorProcessor

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - MasterPasswordGuidanceProcessor
/// The processor used to manage state and handle actions for the master password guidance screen.

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - PreventAccountLockProcessor
/// The processor used to manage state and handle actions for the prevent account lock screen.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import Combine
import SwiftUI

View File

@ -1,4 +1,5 @@
import AuthenticationServices
import BitwardenKit
import BitwardenResources
import BitwardenSdk
import Foundation

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
// MARK: - PasswordHintProcessor

View File

@ -1,3 +1,4 @@
import BitwardenKit
import Foundation
// MARK: - ProfileSwitcherCoordinator

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - ProfileSwitcherProcessor
/// The processor used to manage state and handle actions for the profile switcher sheet.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import SwiftUI

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import BitwardenSdk

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - CheckEmailProcessor
/// The processor used to manage state and handle actions for the check email screen.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import SwiftUI

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
// MARK: - VaultUnlockSetupProcessor

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - ExtensionActivationProcessor
/// The processor used to manage state and handle actions for the extension activation screen.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import SwiftUI

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import Foundation

View File

@ -1,3 +1,4 @@
import BitwardenKit
import Foundation
// MARK: - EnableFlightRecorderProcessor

View File

@ -1,3 +1,4 @@
import BitwardenKit
import Foundation
// MARK: - AppearanceProcessor

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - SelectLanguageDelegate
/// The delegate for updating the parent view after a language has been selected.

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - AppExtensionProcessorDelegate
/// A delegate of the app extension setup flow that is notified when the user enables the extension.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import SwiftUI

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
// MARK: - AutoFillProcessor

View File

@ -1,3 +1,4 @@
import BitwardenKit
import Foundation
// MARK: - PasswordAutoFillProcessor

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - SettingsProcessorDelegate
/// A delegate of `SettingsProcessor` that is notified when the settings tab badge needs to be updated.

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - ExportSettingsProcessor
/// The processor used to manage state and handle actions for the `ExportSettingsView`.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import BitwardenResources
import BitwardenSdk

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - VaultSettingsProcessor
/// The processor used to manage state and handle actions for the `VaultSettingsView`.

View File

@ -1,4 +1,5 @@
import AuthenticationServices
import BitwardenKit
import BitwardenResources
import BitwardenSdk

View File

@ -1,4 +1,5 @@
import AuthenticationServices
import BitwardenKit
import BitwardenResources
import BitwardenSdk

View File

@ -1,3 +1,5 @@
import BitwardenKit
// MARK: - ImportLoginsSuccessProcessor
/// The processor used to manage state and handle actions for the import logins success screen.

View File

@ -1,3 +1,4 @@
import BitwardenKit
import SwiftUI
// MARK: - ManualEntryProcessor

View File

@ -1,3 +1,4 @@
import BitwardenKit
import Combine
import SwiftUI