`v3-base` → `dev` (#80)

This commit is contained in:
Yakov Manshin 2022-01-01 16:31:43 +03:00 committed by GitHub
commit f857d5224f
5 changed files with 9 additions and 42 deletions

View File

@ -12,10 +12,10 @@ import YMFFProtocols
// MARK: - FeatureFlagResolverConfiguration // MARK: - FeatureFlagResolverConfiguration
/// A YMFF-supplied object used to provide the feature flag resolver with its configuration. /// An object used to configure the resolver.
public struct FeatureFlagResolverConfiguration { final public class FeatureFlagResolverConfiguration {
public let stores: [FeatureFlagStore] public var stores: [FeatureFlagStore]
public init(stores: [FeatureFlagStore]) { public init(stores: [FeatureFlagStore]) {
self.stores = stores self.stores = stores

View File

@ -1,28 +0,0 @@
//
// MutableFeatureFlagResolverConfiguration.swift
// YMFF
//
// Created by Yakov Manshin on 5/17/21.
// Copyright © 2021 Yakov Manshin. See the LICENSE file for license info.
//
#if !COCOAPODS
import YMFFProtocols
#endif
// MARK: - MutableFeatureFlagResolverConfiguration
/// An object used to configure the resolver, which holds feature flag stores that can be changed.
final public class MutableFeatureFlagResolverConfiguration {
public var stores: [FeatureFlagStore]
public init(stores: [FeatureFlagStore]) {
self.stores = stores
}
}
// MARK: - FeatureFlagResolverConfigurationProtocol
extension MutableFeatureFlagResolverConfiguration: FeatureFlagResolverConfigurationProtocol { }

View File

@ -28,11 +28,6 @@ final public class FeatureFlagResolver {
self.configuration = configuration self.configuration = configuration
} }
@available(*, deprecated, message: "Use init(stores:)")
public convenience init(configuration: FeatureFlagResolverConfiguration) {
self.init(configuration: configuration as FeatureFlagResolverConfigurationProtocol)
}
/// Initializes the resolver with the list of feature flag stores. /// Initializes the resolver with the list of feature flag stores.
/// ///
/// + Passing in an empty array will produce the `noStoreAvailable` error on next read attempt. /// + Passing in an empty array will produce the `noStoreAvailable` error on next read attempt.

View File

@ -7,12 +7,12 @@
// //
/// An object that provides the resources critical to functioning of the resolver. /// An object that provides the resources critical to functioning of the resolver.
public protocol FeatureFlagResolverConfigurationProtocol { public protocol FeatureFlagResolverConfigurationProtocol: AnyObject {
/// An array of stores which may contain feature flag values. /// An array of stores which may contain feature flag values.
/// ///
/// + The array may include both mutable and immutable stores. /// + The array may include both mutable and immutable stores.
/// + The stores are examined in order. The first value found for a key will be used. /// + The stores are examined in order. The first value found for a key will be used.
var stores: [FeatureFlagStore] { get } var stores: [FeatureFlagStore] { get set }
} }

View File

@ -12,8 +12,8 @@ import XCTest
final class FeatureFlagResolverConfigurationTests: XCTestCase { final class FeatureFlagResolverConfigurationTests: XCTestCase {
func testStoreAdditionToMutableConfiguration() { func testStoreAdditionToConfiguration() {
let configuration = MutableFeatureFlagResolverConfiguration(stores: []) let configuration = FeatureFlagResolverConfiguration(stores: [])
XCTAssertEqual(configuration.stores.count, 0) XCTAssertEqual(configuration.stores.count, 0)
@ -22,8 +22,8 @@ final class FeatureFlagResolverConfigurationTests: XCTestCase {
XCTAssertEqual(configuration.stores.count, 1) XCTAssertEqual(configuration.stores.count, 1)
} }
func testStoreRemovalFromMutableConfiguration() { func testStoreRemovalFromConfiguration() {
let configuration = MutableFeatureFlagResolverConfiguration(stores: [.immutable(TransparentFeatureFlagStore())]) let configuration = FeatureFlagResolverConfiguration(stores: [.immutable(TransparentFeatureFlagStore())])
XCTAssertEqual(configuration.stores.count, 1) XCTAssertEqual(configuration.stores.count, 1)