Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenTiigi committed Jun 11, 2018
2 parents fc90143 + 6457ccc commit 08ed823
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Configs/WhatsNewKit.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion Example/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ You can enable on both `DetailButton` and `CompletionButton` haptic feedback whe

```swift
// Impact Feedback
button.hapticFeedback = .impact
button.hapticFeedback = .impact(.medium)

// Selection Feedback
button.hapticFeedback = .selection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ public extension WhatsNewViewController {

/// The HapticFeedback Enumeration
enum HapticFeedback: Equatable {
/// ImpactFeedback
case impact
/// ImpactFeedback with FeedbackStyle
case impact(UIImpactFeedbackStyle)
/// SelectionFeedback
case selection
/// NotificationFeedback with FeedbackType
case notification(UINotificationFeedbackType)

/// Execute Feedback
/// Execute HapticFeedback
func execute() {
// Switch on self
switch self {
case .impact:
// UIImpactFeedbackGenerator
let impactFeedbackGenerator = UIImpactFeedbackGenerator()
impactFeedbackGenerator.impactOccurred()
case .impact(let style):
// UIFeedbackGenerator
let feedbackGenerator = UIImpactFeedbackGenerator(style: style)
feedbackGenerator.impactOccurred()
case .selection:
// UISelectionFeedbackGenerator
let selectionFeedbackGenerator = UISelectionFeedbackGenerator()
selectionFeedbackGenerator.selectionChanged()
case .notification(let feedbackType):
case .notification(let type):
// UINotificationFeedbackGenerator
let notificationFeedbackGenerator = UINotificationFeedbackGenerator()
notificationFeedbackGenerator.notificationOccurred(feedbackType)
notificationFeedbackGenerator.notificationOccurred(type)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Store/KeyValueWhatsNewVersionStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extension KeyValueWhatsNewVersionStore: WriteableWhatsNewVersionStore {
/// - Parameter version: The Version
public func set(version: WhatsNew.Version) {
// Set Version
self.keyValueable.set(version, forKey: self.key(forVersion: version))
self.keyValueable.set(version.description, forKey: self.key(forVersion: version))
}

}
Expand All @@ -100,7 +100,7 @@ extension KeyValueWhatsNewVersionStore: ReadableWhatsNewVersionStore {
/// - Returns: Bool if Version has been presented
public func has(version: WhatsNew.Version) -> Bool {
// Retrieve object for key and return comparison result with the WhatsNew.Version
return self.keyValueable.object(forKey: self.key(forVersion: version)) as? WhatsNew.Version == version
return self.keyValueable.object(forKey: self.key(forVersion: version)) as? String == version.description
}

}
2 changes: 1 addition & 1 deletion Tests/Stores/KeyValueWhatsNewVersionStoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class KeyValueWhatsNewVersionStoreTests: BaseTests {

let randomWhatsNewVersion = self.randomWhatsNew.version
keyValueWhatsNewVersionStore.set(version: randomWhatsNewVersion)
XCTAssertEqual(randomWhatsNewVersion, fakeKeyValueable.objects[randomWhatsNewVersion.description] as? WhatsNew.Version)
XCTAssertEqual(randomWhatsNewVersion.description, fakeKeyValueable.objects[randomWhatsNewVersion.description] as? String)
XCTAssert(keyValueWhatsNewVersionStore.has(version: randomWhatsNewVersion))
XCTAssertFalse(keyValueWhatsNewVersionStore.has(version: self.generateRandomWhatsNew().version))
}
Expand Down
44 changes: 44 additions & 0 deletions Tests/WhatsNewViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,52 @@ class WhatsNewViewControllerTests: BaseTests {
XCTAssert(versionStore.has(version: self.randomWhatsNew.version))
}

func testWhatsNewPassedToControllerEquatable() {
let whatsNewViewController = WhatsNewViewController(whatsNew: self.randomWhatsNew)
XCTAssertEqual(self.randomWhatsNew, whatsNewViewController.whatsNew)
}

func testCoderInitializer() {
XCTAssertNil(WhatsNewViewController(coder: .init()))
}

func testPresent() {
let whatsNewViewController = WhatsNewViewController(whatsNew: self.randomWhatsNew)
class FakeViewController: UIViewController {
var viewControllerToPresent: UIViewController?
var shouldAnimate: Bool?
override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) {
self.viewControllerToPresent = viewControllerToPresent
self.shouldAnimate = flag
completion?()
}
}
let fakeViewViewController = FakeViewController()
let animated = true
self.performTest(execution: { expectation in
whatsNewViewController.present(on: fakeViewViewController, animated: animated, completion: {
XCTAssert(fakeViewViewController.viewControllerToPresent === whatsNewViewController)
XCTAssertEqual(fakeViewViewController.shouldAnimate, true)
expectation.fulfill()
})
})
}

func testPush() {
let whatsNewViewController = WhatsNewViewController(whatsNew: self.randomWhatsNew)
class FakeNavigationController: UINavigationController {
var pushedViewController: UIViewController?
var shouldAnimate: Bool?
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
self.pushedViewController = viewController
self.shouldAnimate = animated
}
}
let fakeNavigationController = FakeNavigationController()
let animated = true
whatsNewViewController.push(on: fakeNavigationController, animated: animated)
XCTAssert(fakeNavigationController.pushedViewController === whatsNewViewController)
XCTAssertEqual(fakeNavigationController.shouldAnimate, animated)
}

}
8 changes: 4 additions & 4 deletions WhatsNewKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = de.tiigi.Example;
PRODUCT_BUNDLE_IDENTIFIER = de.tiigi.WhatsNewKit.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0;
Expand Down Expand Up @@ -662,7 +662,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = de.tiigi.Example;
PRODUCT_BUNDLE_IDENTIFIER = de.tiigi.WhatsNewKit.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
Expand Down Expand Up @@ -801,7 +801,7 @@
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "";
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.WhatsNewKit.WhatsNewKit-iOS";
PRODUCT_BUNDLE_IDENTIFIER = "de.tiigi.WhatsNewKit.WhatsNewKit-iOS";
PRODUCT_NAME = WhatsNewKit;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -828,7 +828,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = "";
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.WhatsNewKit.WhatsNewKit-iOS";
PRODUCT_BUNDLE_IDENTIFIER = "de.tiigi.WhatsNewKit.WhatsNewKit-iOS";
PRODUCT_NAME = WhatsNewKit;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down
1 change: 1 addition & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ platform :ios do
ensure_git_branch(branch: 'master')
test
version = version_bump_podspec(path: "WhatsNewKit.podspec", version_number: options[:version])
increment_version_number(version_number: version)
git_commit(
path: ["WhatsNewKit.podspec"],
message: "[WhatsNewKit Release 🚀] Bump to #{version}"
Expand Down

0 comments on commit 08ed823

Please sign in to comment.