metatext/ServiceLayer/Sources/ServiceLayer/Entities/AppEnvironment.swift
Justin Mazzocchi 2ca0dfe251
wip
2020-08-31 11:57:02 -07:00

35 lines
1.1 KiB
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
import HTTP
import Mastodon
public struct AppEnvironment {
let session: Session
let webAuthSessionType: WebAuthSession.Type
let keychainServiceType: KeychainService.Type
let userDefaults: UserDefaults
let inMemoryContent: Bool
public init(session: Session,
webAuthSessionType: WebAuthSession.Type,
keychainServiceType: KeychainService.Type,
userDefaults: UserDefaults,
inMemoryContent: Bool) {
self.session = session
self.webAuthSessionType = webAuthSessionType
self.keychainServiceType = keychainServiceType
self.userDefaults = userDefaults
self.inMemoryContent = inMemoryContent
}
}
public extension AppEnvironment {
static let live: Self = Self(
session: Session(configuration: .default),
webAuthSessionType: LiveWebAuthSession.self,
keychainServiceType: LiveKeychainService.self,
userDefaults: .standard,
inMemoryContent: false)
}