Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ’²[Native Checkout] Stepper haptics #711

Merged

Conversation

dusi
Copy link
Contributor

@dusi dusi commented Jun 18, 2019

πŸ“² What

Adds haptic feedback to the amount stepper.

Based on design specs:

  • We're using selection feedback for incrementing/decrementing
  • We're using notification feedback for reaching minimum/maximum value

πŸ€” Why

Providing great UX to our users

πŸ›  How

The logic is pretty simple, when the stepper reaches its minimum or maximum value we trigger UIFeedbackGenerator.ksr_generateWarningFeedback(), when the stepper increments/decrements within its limited we trigger UIFeedbackGenerator.ksr_generateSelectionFeedback() (iOS does the rest for us.

Please note that big chunk of work was actually refactoring our haptic feedback mechanism in order for it to being more testable and remove some duplicates.

Previously we used UIButton extension proxy to trigger feedback on UIFeedbackGenerator...some of those proxies were not even used so I've removed them and hopefully this will make things simpler.

So where we would previously use:

self.button.ksr_success()

we now don't need to reference self (mostly in closures) and can directly call

UIFeedbackGenerator.ksr_generateSuccess()

in addition to that this is going through AppEnvironment.current which allows us to actually observe whether the correct feedback was triggered or not and allows us to mock it.

βœ… Acceptance criteria

You'll notice that currently we hardcode min, max and initial value (this is for the testing purposes and will be fixed in future work...right now we're using 10 for minimum stepper value, 20 for maximum stepper value and 15 for default stepper value).

  • Incrementing or decrementing by either holding - or + stepper button triggers selection haptic feedback (very subtle)
  • Reaching minimum or maximum triggers notification haptic feedback (more prominent)

⏰ TODO

This PR does not include the following (which will be separate pieces of work)

  • Dynamically set min, max and initial values based on project setting
  • Dynamically set incrementation step value (currently set to 1)
  • Allow stepper to interoperate with textfield input
  • Limit textfield input to digits and decimal separators only (based on locale)

@@ -257,21 +257,15 @@ internal final class DiscoveryPostcardCell: UITableViewCell, ValueCell {

self.watchProjectViewModel.outputs.generateImpactFeedback
.observeForUI()
.observeValues { [weak self] in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now no longer need self reference...in the future this could also be refactored into a side effect so there would not be a need for generateImpactFeedback signal from the VM. I identified that this would make the changes much bigger and decided against doing that.

@@ -122,21 +122,15 @@ public final class ProjectNavBarViewController: UIViewController {

self.watchProjectViewModel.outputs.generateImpactFeedback
.observeForUI()
.observeValues { [weak self] in
self?.saveButton.generateImpactFeedback(style: .light)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Team notice that this is a thing of past (these proxies were just duplicating things and made a lot of reasoning about our code harder than need be).

So previously the flow would be

button.generateImpactFeedback
  -> UIFeedbackGenerator.ksr_impact()
    -> UIImpactFeedbackGenerator(style: style).impactOccurred()`

now we're removing one layer and doing

UIFeedbackGenerator.ksr_generateImpactFeedback()
  -> AppEnvironment.current.impactFeedbackGenerator.impactOccured

(please not that the naming is now more consistent) & (this also allows us to test things)

Cc: @justinswart @cdolm92 @ifbarrera @Scollaco

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some feedback from Justin it's now even simpler...we only have one publicly available function for each haptic type.

So what was previously this

button.generateImpactFeedback
  -> UIFeedbackGenerator.ksr_impact()
    -> UIImpactFeedbackGenerator(style: style).impactOccurred()

is now

generateImpactFeedback()

@@ -73,13 +73,19 @@ public struct Environment {
/// The current set of launched countries for Kickstarter.
public let launchedCountries: LaunchedCountries

/// Impact haptic feedback with light style
public let lightImpactFeedbackGenerator: UIImpactFeedbackGeneratorType
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By making these injectable we can test haptics πŸ™Œ

UIFeedbackGenerator.ksr_selection()
}

public func generateSuccessFeedback() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe previously only generateSuccessFeedback was used through proxy so the other 2 functions were unused

@@ -1,15 +1,19 @@
import UIKit

extension UIFeedbackGenerator {
public static func ksr_success() {
UINotificationFeedbackGenerator().notificationOccurred(.success)
public static func ksr_generateImpactFeedback(style _: UIImpactFeedbackGenerator.FeedbackStyle = .light) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorting alphabetically + more consistent naming


self.currency = project
.map { currencySymbol(forCountry: $0.country).trimmed() }

let minAndMax = Signal.combineLatest(project, reward)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding min, max and initialValue for now..will be fixed in future PRs

Copy link
Contributor

@justinswart justinswart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Just some questions/comments.

@@ -117,11 +126,14 @@ public struct Environment {
koala: Koala = Koala(client: KoalaTrackingClient(endpoint: .production)),
language: Language = Language(languageStrings: Locale.preferredLanguages) ?? Language.en,
launchedCountries: LaunchedCountries = .init(),
lightImpactFeedbackGenerator: UIImpactFeedbackGeneratorType = UIImpactFeedbackGenerator(style: .light),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that at the callsite we access all of these through an extension on UIFeedbackGenerator, would it not be less to add to the Environment (and less to mock) if we just added a type like UIFeedbackGeneratorType?

I guess one other question I have is - does it matter if these generator instances exist for the lifetime of the app? I'm guessing they're pretty lightweight like tap gestures and it doesn't matter too much, but perhaps if we moved the instantiation of them into the type that we create then they'd only exist when we need them.

Lastly - I've seen in the documentation that we're supposed to call prepare(), I don't think we were doing that before, but perhaps it's a good idea to add it.

@@ -4,6 +4,7 @@ import KsApi
import ReactiveSwift
import XCTest

// swiftlint:disable line_length
extension XCTestCase {
// Pushes an environment onto the stack, executes a closure, and then pops the environment from the stack.
func withEnvironment(_ env: Environment, body: () -> Void) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When adding stuff to Environment be sure to also carry the arguments through to the pushEnvironment and replaceCurrentEnvironment functions in Library/AppEnvironment.swift too πŸ‘

@@ -1,7 +1,7 @@
### Internal

github "kickstarter/Kickstarter-Prelude" "c96c90b026d45839724e827f881dcba3ec812725"
github "kickstarter/Kickstarter-ReactiveExtensions" "665b5cd4941e54e5d120b80218f62d6ae0e66dac"
github "kickstarter/Kickstarter-ReactiveExtensions" "1b12cd6236aaace5e90a75332309c15c3585e162"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also review ReactiveExtensions updates

@@ -1,6 +1,38 @@
import Library
import UIKit

// MARK: - Haptic feedback

func generateImpactFeedback(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convenience functions should now be unified place to trigger with the following improvements:

  • we call prepare to get the HW ready for haptic feedback
  • we do not store reference to the haptic feedback generator (so the system releases it right after)

@@ -3,6 +3,42 @@
import XCTest

internal final class SharedFunctionsTests: XCTestCase {
func testGenerateImpactFeedback() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests to make sure that we call both prepare and the right haptic function

@@ -0,0 +1,31 @@
import UIKit
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Protocol that allows us to mock and test our haptic feedback

@@ -0,0 +1,27 @@
import Foundation
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this was part of the test file that I touched, so I've extracted this since I was doing the same work for MockFeedbackGenerator (keeps the test file small and readable)

@@ -21,7 +21,7 @@ public protocol WatchProjectViewModelOutputs {
var generateSelectionFeedback: Signal<(), Never> { get }

/// Emits when haptic feedback should be generated
var generateSuccessFeedback: Signal<(), Never> { get }
var generateNotificationSuccessFeedback: Signal<(), Never> { get }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed in order to be consistent with our haptic feedback convenience functions

@dusi dusi requested a review from justinswart June 20, 2019 20:54
@ksr-ci-bot
Copy link

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

feedbackGenerator.impactOccurred()
}

func generateNotificationSuccessFeedback(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any concern with these not being prefixed ksr_?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since those are not extension functions or anything like that I went with simplicity

XCTAssertTrue(mockFeedbackGenerator.impactOccurredWasCalled)
}

func testGEnerateNotificationSuccessFeedback() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GE -> Ge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ˜…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next time if you use Github's suggestion I can update it right from this PR

Copy link
Contributor

@justinswart justinswart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO ITLIVE

@dusi dusi merged commit ad39509 into feature-native-checkout Jun 21, 2019
@dusi dusi deleted the feature-native-checkout-amount-stepper-haptics branch June 21, 2019 18:11
@dusi dusi removed the needs review label Jun 21, 2019
@dusi dusi restored the feature-native-checkout-amount-stepper-haptics branch June 21, 2019 19:01
justinswart added a commit that referenced this pull request Jun 21, 2019
justinswart added a commit that referenced this pull request Jun 21, 2019
justinswart pushed a commit that referenced this pull request Aug 5, 2019
* 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
justinswart added a commit that referenced this pull request Aug 5, 2019
ifbarrera pushed a commit that referenced this pull request Aug 5, 2019
* 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
ifbarrera pushed a commit that referenced this pull request Aug 5, 2019
ifbarrera pushed a commit that referenced this pull request Aug 6, 2019
* 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
ifbarrera pushed a commit that referenced this pull request Aug 6, 2019
justinswart pushed a commit that referenced this pull request Aug 6, 2019
* 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
justinswart added a commit that referenced this pull request Aug 6, 2019
justinswart added a commit that referenced this pull request Aug 7, 2019
…indings (#779)

* πŸ’²[Native Checkout] Rename CheckoutViewController to DeprecatedCheckoutViewController (#647)

* Rename CheckoutViewController to DeprecatedCheckoutViewController

* Rename CheckoutViewModel to DeprecatedCheckoutViewModel

* Remove CheckoutViewModelTests

* πŸ’²[Native Checkout] Hide rewards when "ios_native_checkout" feature flag is enabled (#646)

* Feature-flagging old rewards treatment & tests

* Adding another test

* Fix issue causing test failure

* PR comments and adding other features to the β€œFeature” enum

* Renaming and clearer logic/func naming

* Line break

* πŸ’²[Native Checkout] Rename RewardPledgeVC/VM to DeprecatedRewardPledgeVC/VM (#653)

* Rename RewardPledgeViewController.swift to DeprecatedRewardPledgeViewController.swift

* Rename RewardPledgeViewModel.swift to DeprecatedRewardPledgeViewModel.swift

* Rename RewardPledgeViewController to DeprecatedRewardPledgeViewController

* Rename RewardPledgeViewModel to DeprecatedRewardPledgeViewModel

* Update Snapshot tests

* πŸ’² [Native Checkout] Plumbing (#654)

* Prepare PledgeViewModel

* Prepare PledgeViewController

* Prepare PledgeDataSource

* πŸ’²[Native Checkout] Pledge Amount Cell (#660)

* Add stepper image resources

* Add convenience function to add subview constrained to edges

* Prepare pledge amount cell

* Implement amount input field

* Pass correct amount and currency values

* Disable selection

* Explicitly declare types in styles

* Add localized strings

* Add iOS 10 support

* Style with explicit types

* Use localized string

* Re-record screenshot tests for the deprecated controller

* Explicitly set accessibility elements

* Extract ascender constrain to private function

* Add background color

* Prevent spacer from collapsing bellow its minimum width

* Fix inputStackViewStyle

* Register cells and footers using their classes for type safety

* Remove unnecessary traitCollectionDidChange handler

* Make style private

* Refactor auto layout helpers

* [Native Checkout] "Back this project" button (#659)

* Back this project buttons setup

* Adding feature flag behaviour

* Tests

* Swiftlint

* Default off

* Revert test changes

* Cleanup

* PR comments and dynamic type support for button

* Updating screenshots to account for accurate button font size

* Wrapping button text and storing reference to shape layer

* Concat constraints

* Renaming button

* Cleanup

* Set stepper images using a lens (#661)

* πŸ’²[Native Checkout] Shipping Location Cell 1/3 (UI) (#666)

* Fix tests

* Extract shared styles

* Add shipping location cell

* Expose only certain elements to VoiceOver

* Add header trait

* Add new line for better readability

* Update tests

* Add arranged subviews to stack view using a functional helper

* Fix font size

* Use point free expression

* Fix tests

* Fix style test

* πŸ’²[Native Checkout] Description Cell (#663)

* wip description cell

* wip description cell, new strings

* wip description cell, refactor

* wip- estimated deloivery date from reward

* wip- datasource test

* new snapshots

* stackview refactor

* stackview func name change

* func name change

* corrected datasource test

* refactor

* pr feedback

* pr feedback

* swiftlint fix

* datasource test fix

* datasource test fix

* description string

* fixing lib/framework tests

* new snapshots for deprecated rewards

* using new string

* wip- vm test name change

* pr feedback

* pr feedback

* strings

* snapshot tests

* change padding

* datasource change

* updated strings to correct deprecated pledge view

* new snapshots

* font change, remove unnecessary constraint and view color, alphabetizing

* blended layers and usimng helper function to add arranged subviews to stack view

* πŸ’²[Native Checkout] Reverts strings & snapshots (#671)

* Revert strings

* Update comment

* reverted strings

* πŸ’²[Native Checkout] Rewards Collection View Plumbing (#664)

* New files

* removing scroll view stuff for now

* Tests

* Cleaning up insets

* More cleanup

* Swiftlint

* Adding β€œdeprecated” to more file names

* Removing duplicated file

* Increasing hit area of close button

* PR comments

* PR comments

* πŸ’²[Native Checkout] Pledge Continue Button - UI Only (#670)

* PledgeContinueCell

* Common green button styling

* Tests

* Adding a test, cleaning up

* Swiftlint

* Fixing merge conflicts

* PR feedback

* πŸ’²[Native Checkout] Description Cell User Interaction (#668)

* wip description cell

* wip description cell, new strings

* wip description cell, refactor

* wip- estimated deloivery date from reward

* wip- datasource test

* new snapshots

* stackview refactor

* stackview func name change

* func name change

* corrected datasource test

* refactor

* setup delegate

* pr feedback

* pr feedback

* swiftlint fix

* datasource test fix

* datasource test fix

* pledgevm

* description string

* fixing lib/framework tests

* new snapshots for deprecated rewards

* using new string

* wip- presenting trust and safety now

* wip- vm tests

* wip- refactor

* wip

* button

* learn more higlight color change

* snapshot tests

* pr edit

* pr edits

* snapshot tests and strings

* Replace label and button with UITextView for tappable links

* pr feedback

* font size removed

* πŸ’²[Native Checkout] "Peek" functionality using hidden scroll view (#665)

* New files

* removing scroll view stuff for now

* Tests

* Cleaning up insets

* More cleanup

* Swiftlint

* Adding β€œdeprecated” to more file names

* Removing duplicated file

* Increasing hit area of close button

* Hidden scroll view

* Hidden scroll view working

* Refactoring & cleanup

* Use collection view’s content size

* PR updates from comments

* Fix autolayout warnings on device rotation

* Cleanup

* More cleanup

* More PR feedback

* Use HTML string with anchor tags (#673)

* Add missing imports, update to use traitCollection.preferredContentSizeCategory.isAccessibilityCategory

* Fix imports in tests

* πŸ’²[Native Checkout] Sheet Overlay Container (#674)

* Sheet overlay container VC and animator

* Renaming, fixing rotation issues

* Revert testing code

* Cleanup and fixing a snapshot

* Using keypath lenses

* Updating the comment

* PR comments

* Renaming

* Cleanup

* View helpers

* Style naming

* Fix build

* Remove iOS 11 Availability Checks From Native Checkout (#679)

* Remove iOS 11 availability references

* Fix merge conflict issues

* Renaming suggestions

* Swiftlint

* Clean up issues with live stream deprecation

* πŸ’²[Native Checkout] Shipping Location Cell 2/3 (Currency formatter 🀯) (#667)

* Fix tests

* Extract shared styles

* Add shipping location cell

* Expose only certain elements to VoiceOver

* Add header trait

* Add new line for better readability

* Add the ability to format currency strings

* Add currency formatter playground

* Add currency formatter tests

* Fix typo

* Remove duplicate type conformance

* Set label background color for better performance

* Move attributed currency string to shared functions

* Disable Swiftlint's line length in tests

* Add convenience function to calculate superscript offset between two UIFonts

* Refactor attributed currency formatter to a NSNumberFormatter subclass

* Expose attributed formatter through Format enum

* Use the new attributed currency formatter

* Move attributes to checkout styles

* Pass shipping information to data source from view model

* Change font size on the input view to match shipping location

* Fix playground

* Fix Swiftlint issue

* Use typealias for string attributes

* Remove dangling playground reference

* Localize string

* Remove obsolete imports

* πŸ’²[Native Checkout] Reward Selection (no animation) (#683)

* Navigate to PledgeVC when reward is selected

* One more test

* Renaming

* Updates based on feedback

* πŸ’²[Native Checkout] - SwiftFormat (#687)

* Remove SwiftFormat's hoisting rule

* Update SwiftFormat rules

* Format all Swift files added or updated by feature branch

* Fix line length violations

* Re-enable explicit self reference rule

* Format code with explicit self reference ON

* Update .init spacing

* Format decimals

* Format and operator

* Format comments

* Order SwiftFormat rules alphabetically

* Format selectors

* Format ChangeEmailViewController

* Order excluded swiftformat files alphabeticallyr

* Rename UIView+AutoLayout

* Fix formatter causing build errors

* Disable rules on new line

* Reformat indentation

* Rename ksr_swiftformat to format

* Fix version after merge

* πŸ’²[Native Checkout] Shipping location cell plus sign (#691)

* Add the ability to concatenate two NSAttributedStrings

* Add plus sign attributed string

* Prefix shipping location amount with a plus sign

* Resolve swiftformat configuration merge conflict

* Format files that were missed during merge conflict resolution

* πŸ’²[Native Checkout] Load Shipping Rules (#682)

* Setting up for loading shipping locations

* Fixing shippingIsLoading

* Test scaffolding

* WIP

* Mutable Property

* Tests

* Adding debounce to prevent race condition

* Swiftlint

* Reverting testing code

* Improving reloadData handling

* Adding reloadDataProperty check to selected shipping rules signal

* Removing stored property

* Removing redundant test

* Fix all the conflicts :\

* Refactoring for new shipping cell requirements

* Adding more tests

* Cartfile.resolved?

* Conflicts for ReactiveSwift 6.0

* Removing Result module

* Format shipping amount properly

* SwiftFormat

* Improving tests

* Formatting

* Adding TODO

* πŸ’²[Native Checkout] Refactor cells to be backed by view model (#693)

* Reformat UITableViewDelegate function

* Expose label and textfield publicly

* Refactor cells to be backed by view models

* Format code

* Extract date format to a convenience getter

* Fix tests

* πŸ’²[Native Checkout] Rewards - Basic (#700)

* RewardCell content

* Scrolling behaviour

* View model setup

* Pledge Button Functionality

* Fixing logic

* Remove unneeded output

* Removing unneeded input in RewardCollectionViewModel

* Tests

* Swiftformat

* Swiftlint

* Fixing dynamic type issue and iPad presentation

* Screenshots

* Strings

* Fix screenshots from Strings update

* Remove Result import

* Improve tests

* Formatting

* Blended layers

* Bumping the tolerance

* Undoing schema change

* PR comments

* More PR Comments

* Reverting schema change

* Formatting

* Swiftlint

* Reverting strings

* Only commiting required strings

* πŸ’²[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

* Revert "πŸ’²[Native Checkout] Stepper haptics (#711)" (#714)

This reverts commit ad39509.

* Feature Flag Tools πŸ”¨ (#705)

* Refactor Beta tools to table view

* Removing Storyboard and fixing tests

* Adding FeatureFlagTools

* Tests

* Screenshot tests

* Swiftformat

* Fixing iPad sourceView

* Updating BetaTools screenshot and fixing naming issue

* More cleanup

* Swiftformat

* PR comments

* Fixing typo, autolayout warnings, moving styles to base styles

* Swift format

* Tint debug icon when filters are active

* Cleanup

* Prefering alert style for iPad

* Swiftformat

* πŸ’²[Native Checkout] Stepper Haptics Final Final (#716)

* 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

* Update reactive extensions commit hash

* πŸ’²[Native Checkout] Pledge amount Stepper and Textfield input + Done button (#719)

* Add inputAccessoryView to amount text field

* Expose done button getter

* Dismiss text field by tapping done button

* Dismiss text field by tapping anywhere else

* Bind stepper and text field changes and properly enable/disable done button

* Batch layout constraints activation

* Make textfield signal point free

* Persist Debug Feature Flags (#721)

* Persiting debug data

* Tests

* Adding some more assertions

* Formatting

* PR comments

* Switching DebugData to Library

* πŸ’²[Native Checkout] Pledge Summary Cell Layout (#715)

* Pledge Summary Cell layout

* SwiftFormat

* Fix test

* πŸ’²[Native Checkout] Pledge Summary Cell Handle Links (#717)

* Open links in web view

* Add tests

* DRY it up a little

* Formatting

* Remove PledgeRowCell

* Fix textview voiceover

* Fix amount label voice-over

* πŸ’²[Native Checkout] Pledge Summary Cell Handle State Change (#718)

* Open links in web view

* Add tests

* DRY it up a little

* Formatting

* Handle amount state between cells

* swiftlint

* Add tests

* Move parentheses

* Pass ShippingRule to delegate

* total -> pledgeTotal

* Use the same output for reloading and updating the tableview

* Move a brace

* Add minimumScaleFactor to total label

* Abstract isShippingEnabled implementation detail to PledgeViewModel

* SwiftFormat lol

* Improve output naming and type, add tests

* πŸ’²[Native Checkout] UITextView bottom padding improvements (#723)

* Pledge Summary Cell layout

* SwiftFormat

* Fix test

* Open links in web view

* Add tests

* DRY it up a little

* Formatting

* Handle amount state between cells

* swiftlint

* Add tests

* Move parentheses

* Pass ShippingRule to delegate

* total -> pledgeTotal

* Use the same output for reloading and updating the tableview

* Move a brace

* πŸ’²[Native Checkout] Pledge Summary Cell Handle Links (#717)

* Open links in web view

* Add tests

* DRY it up a little

* Formatting

* Remove PledgeRowCell

* Add minimumScaleFactor to total label

* Fix textview voiceover

* Fix amount label voice-over

* Improve UITextView bottom padding

* Add ksr_ prefix

* πŸ’²[Native Checkout] Disable non-numeric, non-decimal separator input for the amount (#722)

* Disable non-numeric, non-decimal separator input for the amount

* Replace string initializer with a literal

* Simplify return statement

* Add the ability to reset text field's value to min or max depending on the value that the keyboard is being dismissed with

* Use coalesceWith

* Add test that was removed during merge

* πŸ’²[Native Checkout]  Project Pledge States UI (#702)

* wip project states

* wip project states button colors and label showing up

* wip project states button height fix

* wip, manage button

* wip setting up vm for states

* wip setting up vm for states

* wip for reward title in manage state

* wip - refactor and vm tests

* wip - getting reward title now

* wip - amount and reward formatted for manage state

* wip

* wip- deleted backer banner

* wip- swiftlint fixes

* wip - got view layer back

* wip - refactor and renaming

* wip - snapshot tests

* wip

* wip- corrected shipping amount in manage state

* wip- final and alphabetize files

* pr feedback -move stylings to bindStyles()

* smapshot tests

* manage and view rewards strings added

* using new strings

* vm tests fix

* swift format

* revert strings

* backer banner is back

* snapshots

* refactor- was not using user

* light refactor

* refactor and snapshot test correction

* swiftlint fix

* new snapshots

* remove images from new snapshots

* remove image

* pr feedback

* ksr blue now added

* word wrapping to button

* swift format

* button stacks and label  wraps

* line length correction

* swift format

* πŸ’²[Native Checkout] Project Pledge States UI - UI Fixes (#724)

* Add signal that would emit whether or not the spacer is hidden

* Trim the amount

* Fix UI issues with Dynamic Type

* Revert back to the right font

* Rename button and style

* πŸ’²[Native Checkout] Re-enable the CTA button action (#728)

* Remove unused property

* Re-add target to the CTA button

* Remove padding fix, instead use correct string (#729)

* πŸ’²[Native Checkout] Load default, min and max pledge values properly (#726)

* Load min and max pledge values properly

* Format code

* Update reactive extensions dependency

* Set stepper's step value properly

* Update reactive extensions dependency

* Omit unnecessary signal reference

* [Native Checkout] Pledge Payment Methods Collection View UI (#725)

* Rename deprecated vc and vm (#739)

* πŸ’²[Native Checkout] Refactor shipping rules (#736)

* Rename button

* Hook the button up to its action

* Fit target action on one line

* Refactor shipping rules logic

* Revert MockService changes

* Rename button signal

* Rename a property

* Add comments

* Extract tuple to a private function for allowing point free assignment

* Explicitly state masked corners type to help the compiler

* Format comment a bit better

* Feature native checkout applepay button (#742)

* πŸ’²[Native Checkout] Shipping Picker - Navigation Workflow - 1/4 (#738)

* Rename button

* Hook the button up to its action

* Fit target action on one line

* Refactor shipping rules logic

* Revert MockService changes

* Hook up selection of a shipping rule to presenting a picker

* Rename button signal

* Rename a property

* Add comments

* Extract tuple to a private function for allowing point free assignment

* Explicitly state masked corners type to help the compiler

* Rename view controller

* Extract offset value to a private enum constant

* Rename delegate method

* Rename signals

* Update top offset

* Rename output signal

* πŸ’²[Native Checkout] Pledge Error State CTA (#746)

* wip project states

* wip project states button colors and label showing up

* wip project states button height fix

* wip, manage button

* wip setting up vm for states

* wip setting up vm for states

* wip for reward title in manage state

* wip - refactor and vm tests

* wip - getting reward title now

* wip - amount and reward formatted for manage state

* wip

* wip- deleted backer banner

* wip- swiftlint fixes

* wip - got view layer back

* wip - refactor and renaming

* wip - snapshot tests

* wip

* wip- corrected shipping amount in manage state

* wip- final and alphabetize files

* pr feedback -move stylings to bindStyles()

* smapshot tests

* manage and view rewards strings added

* using new strings

* vm tests fix

* swift format

* wip- fix pledge

* revert strings

* backer banner is back

* snapshots

* refactor- was not using user

* light refactor

* refactor and snapshot test correction

* swiftlint fix

* new snapshots

* remove images from new snapshots

* remove image

* wip - fix state

* case

* fix logic is there

* fix vm tests are passing

* snapshot tests fixed

* snapshot tests fix for error state

* strings for error state

* vm refactor

* vm refactor title text

* undid change

* swift format

* fix button width

* new snapshots

* design feedback, new snapshots

* swift format

* added spacing

* renamed a stackview

* capitalized

* capitalized

* Revert "πŸ’²[Native Checkout] Pledge Error State CTA (#746)" (#748)

This reverts commit f073a51.

* πŸ’²[Native Checkout] Fix Pledge CTA for logged out users (#744)

* Use backing from personalization over making network request

* SwiftFormat, cleanup

* Feature tests

* Improving screenshot tests

* Formatting

* Fixing flaking tests

* Assert output didn’t emit

* πŸ’²[Native Checkout] Shipping Picker - Show List - 2/4 (#747)

* Rename button

* Hook the button up to its action

* Fit target action on one line

* Refactor shipping rules logic

* Revert MockService changes

* Hook up selection of a shipping rule to presenting a picker

* Rename button signal

* Rename a property

* Add comments

* Extract tuple to a private function for allowing point free assignment

* Explicitly state masked corners type to help the compiler

* Rename view controller

* Extract offset value to a private enum constant

* Show shipping rules list

* Dismiss shipping rules through view model

* Remove duplicate signal

* Format code

* Use a simple dismiss

* Remove unnecessary advance call

* Use weak self

* Make the test more explicit

* Use combineLatest instead of takeWhen

* Rename signal for better readability

* πŸ’²[Native Checkout] Login & Sign-up on the pledge screen (Part 1) (#727)

* Continue button functionality

* Tests

* Fixing merge conflict issues

* Fix more issues from merge

* SwiftFormat

* Cleanup

* Fixing merge issues

* Code review comments

* Formatting

* PR comment

* Renaming signals

* Swiftformat

* Change pragma mark from Binding to View model (#749)

[skip ci]

* πŸ’²[Native Checkout] Prepare reward checkmark image view UI (#755)

* Add reward checkmark image resource

* Add checkmark image view to the cell (temporarily hidden)

* Update snapshots

* Remove trailing comma

* Rename image view and its container to use more descriptive naming

* πŸ’²[Native Checkout] Pledge Screen Refactor: UITableView -> UIStackView (#754)

* Beginning to refactor

* Renaming everything, getting it to build

* Get it to render properly

* Fix shipping rules

* Fix amount functionality

* Fix all the links

* Renaming VMs and tests

* Fixing some tests

* Fixing tests

* Add keyboard handling

* Rename

* Refactoring login/signup

* Formatting

* Getting instantiate protocol to work properly

* formatting

* Fixing diffs

* Testing file names

* Renaming

* Last rename

* Moving

* remove comments

* Updates to shipping VM

* Renaming missed output

* Formatting

* Moving to helper extension

* πŸ’²[Native Checkout] Pledge Screen Refactor: UITableView -> UIStackView - Fix Tests πŸ™Œ (#758)

* Format imports

* Fix checkout styles tests

* PR feedback

* Formatting

* Apply suggestions from code review

Co-Authored-By: Pavel Dusatko <pavel.dusatko@gmail.com>

* Functions & renaming protocol

* Rename protocol

* Removing layoutMargins

* Formatting

* Make alert icon single scale (#759)

* πŸ’²[Native Checkout] Prepare reward pill collection view UI (#757)

* Extract classNameWithoutModule to shared functions

* Update collection view convenience functions

* Update table view convenience functions

* Add pill collection view, cell, layout and data source

* Style pill cell

* Add pill collection to reward cell

* Format code

* Update font

* Fix a bug caused by a merge gone wrong

* Make adding / removing pill collection view controller more robust

* Refactor pill collection view

* Use consistent way to register collection view cell

* Remove nilling out delegate

* πŸ’²[Native Checkout] Pledge Error State CTA (#753)

* wip project states

* wip project states button colors and label showing up

* wip project states button height fix

* wip, manage button

* wip setting up vm for states

* wip setting up vm for states

* wip for reward title in manage state

* wip - refactor and vm tests

* wip - getting reward title now

* wip - amount and reward formatted for manage state

* wip

* wip- deleted backer banner

* wip- swiftlint fixes

* wip - got view layer back

* wip - refactor and renaming

* wip - snapshot tests

* wip

* wip- corrected shipping amount in manage state

* wip- final and alphabetize files

* pr feedback -move stylings to bindStyles()

* smapshot tests

* manage and view rewards strings added

* using new strings

* vm tests fix

* swift format

* wip- fix pledge

* revert strings

* backer banner is back

* snapshots

* refactor- was not using user

* light refactor

* refactor and snapshot test correction

* swiftlint fix

* new snapshots

* remove images from new snapshots

* remove image

* wip - fix state

* case

* fix logic is there

* fix vm tests are passing

* snapshot tests fixed

* snapshot tests fix for error state

* strings for error state

* vm refactor

* vm refactor title text

* undid change

* swift format

* fix button width

* new snapshots

* design feedback, new snapshots

* swift format

* added spacing

* renamed a stackview

* capitalized

* capitalized

* fixes

* Cleaning up screenshots, fixing issues with merge conflict

* Formatting

* Revert unneeded project template

* Cleaning up the snapshot configurations so they’re more consistent from test to test

* Formatting

* Line length

* Line length again

* new snapshots

* requested changes

* fixed reward title missing

* fixed snapshot failures

* new snapshots

* swift format

* swift lint fix

* swift format

* pr feedback and snapshot test for error state

* name change to minHeight and minWidth

* snapshot tests for error state

* constant name change

* snapshot correction

* πŸ’²[Native Checkout] Pledge Screen Separators (#760)

* Sections and section separators

* Formatting

* Renaming from feedback

* PR feedback

* πŸ’²[Native Checkout] Reward -> Pledge View transition animation (#741)

* Rebase animation on top of refactor

* SwiftFormat

* Improve layout passes and snapshot flicker issue

* Move values to constants

* SwiftFormat

* Infer duration from spring timing, align titleStackView top

* SwiftFormat missed self

* SwiftFormat

* Alphabetize rootStackView

* Remove redundant bindViewModel()

* Move constraint setup to function, add private modifiers

* Move translatesAutoresizingMaskIntoConstraints to initializer

* Move minWidth to constant

* Update to use helper functions

* CheckoutNavigationController -> RewardPledgeNavigationController

* Spacing tweaks

* Remove redundant bind call

* Remove old view model

* Repair merge

* Use keypaths

* Light design pass and screenshots (#771)

* πŸ’²[Native Checkout] Sheet Overlay iPad Bugfix (#769)

* Page sheet

* WIP ipad handling for sheet overlap

* More wip

* Helper for presenting sheet overlay w/ ipad exception

* Addressing feedback & formatting

* PR feedback

* πŸ’²[Native Checkout] Login/Signup design pass (#770)

* Add outputs and bindings

* SwiftFormat

* πŸ’²[Native Checkout] Activity Indicator for the Pledge View (#773)

* Adding activity indicator

* Add starting/stopping indicator behavior

* Fade in effect

* Tests

* Formatting

* Cleanup

* Formatting

* Fix center alignment on indicator

* snapshots and fix title font (#775)

* [Native Checkout] Credit card cell (#766)

* Add RewardCardContainerView snapshot tests

* Update RewardsCollectionViewController snapshots

* Add NoReward snapshots

* Improve snapshot naming

* Feature native checkout rewards gradient (#776)

* Tidy up some logic

* Feature native checkout reward pledge states (#764)

* reward state type

* icon to reward states

* time based and limited reward states

* some renaming

* time based and limited reward states

* disabled pledge button

* fix payment copy

* new green 200 color

* new snapshots

* new copy

* updating business logic

* rewardstates enum

* snapshot tests

* swift format

* swift lint fix

* swift lint fix

* frameworks not needed

* removed strings

* new copy in Strings file

* fix payment copy translations

* fix failing tests

* arg name change

* new  snapshots

* delete orig files

* removing colors

* removed latests copy

* remove copy for error state

* removing new localized copy

* removing fix copy

* snapshot fix

* noreward test

* noreward test

* noreward test

* Simplified and rename enum, updated tests

* πŸ’²[Native Checkout] Add New Card View (#777)

* PledgeAddNewCardView

* Add new card view styling

* Adding delegate

* View model & tests

* Formatting

* Cleanup

* More cleanup

* Tried to fix blended layers, gave up

* Original image

* Better naming

* formatting

* πŸ’²[Native Checkout] Add native pledge view feature flag (#774)

* Add ios_native_checkout_pledge_view feature flag

* Fix tests

* Fix back button

* Revert "Fix back button"

This reverts commit b2cb23b.

* Add test for featureNativeCheckoutPledgeViewEnabled()

* Only add close button when modal

* Set navigationItem in presenting VC

* Remove type after merge

* πŸ’²[Native Checkout] Button style sweep (#781)

* Update button styles first pass

* Move color mixing to extension file

* Update Colors.json

* Updated remaining button styles

* Record new snapshots

* Rename playground buttons

* Move button up slightly on empty state VC

* Update empty state snapshots

* SwiftFormat

* Repair merge

* Revert unrelated code-changes from merging

* Tidy up logic with guards and ternary operators

* Add logged out non-backer test

* πŸ’²[Native Checkout] RewardCardView states VM tests (#780)

* Add 	RewardCardContainerViewModelTests

* Add RewardCardViewModelTests

* Fix test

* Remove shippingAmount from noReward test

* Add logged out non-backer test

* Add tests for NonLive, Backed and NonLive, NonBacked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants