Skip to content

Commit

Permalink
Release 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rwbutler committed Dec 21, 2018
1 parent 613b1be commit aec005f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.5.0] - 2018-12-21
### Changed
- Now possible to present FeatureFlagsViewController without a close button.
- Fixed an issue where test variation assignments were not stored in the sitatuation where no remote data or cached data present (first launch scenario).

## [1.4.0] - 2018-12-17
### Changed
- Swipe to delete on FeatureFlagsViewController now deletes the feature rather than clearing cache now that cache can be cleared via the action button. Note: If the feature is still present in the JSON then it will re-created on refresh.
Expand Down
2 changes: 1 addition & 1 deletion Example/FeatureFlags/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
window?.makeKeyAndVisible()
let navigationSettings = ViewControllerNavigationSettings(
autoClose: true,
closeButtonAlignment: .left,
closeButtonAlignment: .closeButtonLeftActionButtonRight,
closeButton: .done,
isNavigationBarHidden: false)
FeatureFlagsUI.autoRefresh = true
Expand Down
2 changes: 1 addition & 1 deletion FeatureFlags.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FeatureFlags'
s.version = '1.4.0'
s.version = '1.5.0'
s.swift_version = '4.2'
s.summary = 'Feature flagging, A/B testing, MVT and phased feature roll out for iOS.'
s.description = <<-DESC
Expand Down
11 changes: 11 additions & 0 deletions FeatureFlags/Classes/Core/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ internal extension FeatureFlags {
.appendingPathComponent("\(configurationName).\(configurationType.rawValue)")
}

static func cacheExists() -> Bool {
guard let cachedConfigURL = cachedConfigurationURL else { return false }
return FileManager.default.fileExists(atPath: cachedConfigURL.path)
}

static func clearCache() {
guard let cachedConfigURL = cachedConfigurationURL else { return }
try? FileManager.default.removeItem(at: cachedConfigURL)
Expand Down Expand Up @@ -191,10 +196,16 @@ internal extension FeatureFlags {
} else if let localFallbackURL = localFallbackConfigurationURL,
let localFallbackData = try? Data(contentsOf: localFallbackURL) {
let localFallbackResult = parseConfiguration(data: localFallbackData)
if !cacheExists(), let result = localFallbackResult {
cacheConfiguration(result)
}
return localFallbackResult
} else if let bundledConfigurationURL = bundledConfigurationURL(),
let bundledData = try? Data(contentsOf: bundledConfigurationURL) {
let bundledResult = parseConfiguration(data: bundledData)
if !cacheExists(), let result = bundledResult {
cacheConfiguration(result)
}
return bundledResult
}
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import Foundation

@objc public enum CloseButtonAlignment: Int {
case left
case right
case closeButtonLeftActionButtonRight
case closeButtonRightActionButtonLeft
case noCloseButtonActionButtonLeft
case noCloseButtonActionButtonRight
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,18 @@ private extension FeatureFlagsViewController {
let actionButton = UIBarButtonItem(barButtonSystemItem: actionButtonType,
target: self,
action: #selector(presentActionSheet))
let closeButtonAlignment = navigationSettings?.closeButtonAlignment ?? .left
let closeButtonAlignment = navigationSettings?.closeButtonAlignment ?? .closeButtonLeftActionButtonRight
switch closeButtonAlignment {
case .left:
case .closeButtonLeftActionButtonRight:
navigationItem.leftBarButtonItem = doneButton
navigationItem.rightBarButtonItem = actionButton
case .right:
case .closeButtonRightActionButtonLeft:
navigationItem.leftBarButtonItem = actionButton
navigationItem.rightBarButtonItem = doneButton
case .noCloseButtonActionButtonLeft:
navigationItem.leftBarButtonItem = actionButton
case .noCloseButtonActionButtonRight:
navigationItem.rightBarButtonItem = actionButton
}
navigationItem.leftItemsSupplementBackButton = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UIKit
public init(actionButton: UIBarButtonItem.SystemItem = .action,
animated: Bool = false,
autoClose: Bool = true,
closeButtonAlignment: CloseButtonAlignment = .left,
closeButtonAlignment: CloseButtonAlignment = .closeButtonLeftActionButtonRight,
closeButton: UIBarButtonItem.SystemItem = .done,
isModal: Bool = false,
isNavigationBarHidden: Bool = false,
Expand Down
2 changes: 1 addition & 1 deletion FeatureFlags/Classes/UI/FeatureFlagsUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public struct FeatureFlagsUI {
let navigationSettings = FeatureFlagsViewController
.NavigationSettings(animated: animated,
autoClose: true,
closeButtonAlignment: .right,
closeButtonAlignment: .closeButtonRightActionButtonLeft,
isModal: true,
isNavigationBarHidden: navigationController.isNavigationBarHidden,
shouldRefresh: shouldRefresh)
Expand Down

0 comments on commit aec005f

Please sign in to comment.