forked from woocommerce/woocommerce-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeauthenticatedState.swift
42 lines (36 loc) · 1.28 KB
/
DeauthenticatedState.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Foundation
import Yosemite
import class Networking.AlamofireNetwork
// MARK: - DeauthenticatedState
//
class DeauthenticatedState: StoresManagerState {
/// Dispatcher: Glues all of the Stores!
///
private let dispatcher = Dispatcher()
/// Retains all of the active Services
///
private let services: [DeauthenticatedStore]
init() {
// Used for logged-out state without a WPCOM auth token.
let network = AlamofireNetwork(credentials: nil)
services = [
JetpackConnectionStore(dispatcher: dispatcher),
AccountCreationStore(dotcomClientID: ApiCredentials.dotcomAppId,
dotcomClientSecret: ApiCredentials.dotcomSecret,
network: network,
dispatcher: dispatcher),
WordPressSiteStore(network: network, dispatcher: dispatcher)
]
}
/// NO-OP: Executed when current state is activated.
///
func didEnter() { }
/// NO-OP: Executed before the current state is deactivated.
///
func willLeave() { }
/// During deauth method, we're handling actions that don't require access token to WordPress.com.
///
func onAction(_ action: Action) {
dispatcher.dispatch(action)
}
}