-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💲[Native Checkout] Stepper haptics (#711)
* Refactor haptic feedback to being more testable * Add haptic feedback for the amount stepper * Update reactive extensions dependency * Use UIStepper reactive extensions * Reorder alphabetically * Refactor feedback generators * Fix capitalization typo
- Loading branch information
1 parent
45d1933
commit 494246c
Showing
20 changed files
with
346 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import UIKit | ||
|
||
// MARK: - UIFeedbackGenerator | ||
|
||
protocol UIFeedbackGeneratorType { | ||
func prepare() | ||
} | ||
|
||
// MARK: - UIImpactFeedbackGeneratorType | ||
|
||
protocol UIImpactFeedbackGeneratorType: UIFeedbackGeneratorType { | ||
func impactOccurred() | ||
} | ||
|
||
extension UIImpactFeedbackGenerator: UIImpactFeedbackGeneratorType {} | ||
|
||
// MARK: - UINotificationFeedbackGeneratorType | ||
|
||
protocol UINotificationFeedbackGeneratorType: UIFeedbackGeneratorType { | ||
func notificationOccurred(_ notificationType: UINotificationFeedbackGenerator.FeedbackType) | ||
} | ||
|
||
extension UINotificationFeedbackGenerator: UINotificationFeedbackGeneratorType {} | ||
|
||
// MARK: - UISelectionFeedbackGeneratorType | ||
|
||
protocol UISelectionFeedbackGeneratorType: UIFeedbackGeneratorType { | ||
func selectionChanged() | ||
} | ||
|
||
extension UISelectionFeedbackGenerator: UISelectionFeedbackGeneratorType {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Foundation | ||
@testable import Library | ||
import UIKit | ||
|
||
struct MockAppEnvironment: AppEnvironmentType { | ||
static var logoutWasCalled = false | ||
|
||
static func logout() { | ||
self.logoutWasCalled = true | ||
} | ||
} | ||
|
||
struct MockPushNotificationDialog: PushNotificationDialogType { | ||
static var resetAllContextsWasCalled = false | ||
|
||
static func resetAllContexts() { | ||
self.resetAllContextsWasCalled = true | ||
} | ||
} | ||
|
||
class MockViewController: UIViewController { | ||
var dismissAnimatedWasCalled = false | ||
|
||
override func dismiss(animated _: Bool, completion _: (() -> Void)? = nil) { | ||
self.dismissAnimatedWasCalled = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Foundation | ||
@testable import Kickstarter_Framework | ||
import UIKit | ||
|
||
class MockImpactFeedbackGenerator: UIImpactFeedbackGeneratorType { | ||
var prepareWasCalled = false | ||
var impactOccurredWasCalled = false | ||
|
||
func prepare() { | ||
self.prepareWasCalled = true | ||
} | ||
|
||
func impactOccurred() { | ||
self.impactOccurredWasCalled = true | ||
} | ||
} | ||
|
||
class MockNotificationFeedbackGenerator: UINotificationFeedbackGeneratorType { | ||
var prepareWasCalled = false | ||
var notificationOccurredWasCalled = false | ||
|
||
func prepare() { | ||
self.prepareWasCalled = true | ||
} | ||
|
||
func notificationOccurred(_: UINotificationFeedbackGenerator.FeedbackType) { | ||
self.notificationOccurredWasCalled = true | ||
} | ||
} | ||
|
||
class MockSelectionFeedbackGenerator: UISelectionFeedbackGeneratorType { | ||
var prepareWasCalled = false | ||
var selectionChangedWasCalled = false | ||
|
||
func prepare() { | ||
self.prepareWasCalled = true | ||
} | ||
|
||
func selectionChanged() { | ||
self.selectionChangedWasCalled = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.