mirror of
https://github.com/bitwarden/ios.git
synced 2025-12-10 17:46:07 -06:00
[PM-26060] Consolidate StateProcessor to BitwardenKit (#2063)
This commit is contained in:
parent
67b2fe4425
commit
4be3d91cfb
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import OSLog
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import OSLog
|
||||
|
||||
// MARK: - VaultUnlockProcessor
|
||||
|
||||
@ -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) {}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import Foundation
|
||||
|
||||
// MARK: - ExportItemsProcessor
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - SelectLanguageDelegate
|
||||
|
||||
/// The delegate for updating the parent view after a language has been selected.
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - TutorialProcessor
|
||||
|
||||
/// The processer used to manage state and handle actions for the tutorial screen.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import Foundation
|
||||
import OSLog
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - ExpiredLinkProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the passwort hint screen.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
|
||||
// MARK: - MasterPasswordGeneratorProcessor
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - MasterPasswordGuidanceProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the master password guidance screen.
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - PreventAccountLockProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the prevent account lock screen.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import AuthenticationServices
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import BitwardenSdk
|
||||
import Foundation
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
|
||||
// MARK: - PasswordHintProcessor
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import Foundation
|
||||
|
||||
// MARK: - ProfileSwitcherCoordinator
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - ProfileSwitcherProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the profile switcher sheet.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import BitwardenSdk
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - CheckEmailProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the check email screen.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
|
||||
// MARK: - VaultUnlockSetupProcessor
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - ExtensionActivationProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the extension activation screen.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import Foundation
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import Foundation
|
||||
|
||||
// MARK: - EnableFlightRecorderProcessor
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import Foundation
|
||||
|
||||
// MARK: - AppearanceProcessor
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - SelectLanguageDelegate
|
||||
|
||||
/// The delegate for updating the parent view after a language has been selected.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
|
||||
// MARK: - AutoFillProcessor
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import Foundation
|
||||
|
||||
// MARK: - PasswordAutoFillProcessor
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - SettingsProcessorDelegate
|
||||
|
||||
/// A delegate of `SettingsProcessor` that is notified when the settings tab badge needs to be updated.
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - ExportSettingsProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the `ExportSettingsView`.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import BitwardenSdk
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - VaultSettingsProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the `VaultSettingsView`.
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import AuthenticationServices
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import BitwardenSdk
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import AuthenticationServices
|
||||
import BitwardenKit
|
||||
import BitwardenResources
|
||||
import BitwardenSdk
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import BitwardenKit
|
||||
|
||||
// MARK: - ImportLoginsSuccessProcessor
|
||||
|
||||
/// The processor used to manage state and handle actions for the import logins success screen.
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import SwiftUI
|
||||
|
||||
// MARK: - ManualEntryProcessor
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import BitwardenKit
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user