Skip to content

Commit

Permalink
💲[Native Checkout] RewardCardContainerView snapshots and view model b…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
justinswart committed Aug 7, 2019
1 parent 3517ae4 commit a6c9a21
Show file tree
Hide file tree
Showing 107 changed files with 1,413 additions and 88 deletions.
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "Find projects you’ll love in art, design, film, games, music, and more. Once you back a project, you’ll see all your activity here.";
"First_created" = "First created";
"Fix" = "Fix";
"Fix_your_payment_method" = "Fix your payment method";
"Follow_friend_name" = "Follow %{friend_name}";
"Follow_friends" = "Follow friends";
"Follow_more_friends" = "Follow more friends";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "Newsletters";
"No_Results" = "No Results";
"No_comments_yet" = "No comments yet.";
"No_longer_available" = "No longer available";
"No_messages" = "No messages";
"No_nevermind" = "No, nevermind";
"No_one_has_posted_an_update_yet" = "No one has posted an update yet.";
Expand Down
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "Finde Projekte nach deinem Geschmack - in Kunst, Design, Film, Spiele, Musik und vielen anderen Kategorien. Wenn du ein Projekt unterstützt hast, wird deren Aktivität hier angezeigt.";
"First_created" = "Erstes Projekt";
"Fix" = "Korrigieren";
"Fix_your_payment_method" = "Zahlungsmethode ändern";
"Follow_friend_name" = "%{friend_name} folgen.";
"Follow_friends" = "Freunden folgen";
"Follow_more_friends" = "Folge noch mehr Freunden";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "Newsletter";
"No_Results" = "Keine Ergebnisse";
"No_comments_yet" = "Bisher noch keine Kommentare.";
"No_longer_available" = "Nicht mehr verfügbar";
"No_messages" = "Keine Nachrichten";
"No_nevermind" = "Nein, ich habe es mir anders überlegt";
"No_one_has_posted_an_update_yet" = "Es wurden noch keine Updates gepostet.";
Expand Down
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "Proyectos a tu gusto - en arte, diseño, cine, juegos, música y otras categorías. Una vez que hayas patrocinado un proyecto, verás todas las actividades pertinentes aquí.";
"First_created" = "Primer proyecto creado";
"Fix" = "Corregir";
"Fix_your_payment_method" = "Corrige tu método de pago";
"Follow_friend_name" = "Seguir a %{friend_name}.";
"Follow_friends" = "Seguir amigos";
"Follow_more_friends" = "Seguir a más amigos";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "Boletines informativos";
"No_Results" = "Sin resultados";
"No_comments_yet" = "No hay comentarios todavia.";
"No_longer_available" = "Ya no está disponible";
"No_messages" = "No hay mensajes";
"No_nevermind" = "No, ignorar";
"No_one_has_posted_an_update_yet" = "Todavía no se han publicado actualizaciones.";
Expand Down
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "Découvrez des projets que vous allez adorer : art, design, cinéma, jeux, musique et plus encore. L'activité des projets que vous soutenez s'affichera ici.";
"First_created" = "Premier projet créé";
"Fix" = "Corriger";
"Fix_your_payment_method" = "Corriger votre moyen de paiement";
"Follow_friend_name" = "Suivre %{friend_name}";
"Follow_friends" = "Suivez vos amis";
"Follow_more_friends" = "Suivre plus d'amis";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "Lettres d'information";
"No_Results" = "Pas de résultats";
"No_comments_yet" = "Pas de commentaires.";
"No_longer_available" = "Indisponible";
"No_messages" = "Pas de messages";
"No_nevermind" = "Non, j'ai changé d'avis";
"No_one_has_posted_an_update_yet" = "Pas d'actus publiées pour le moment.";
Expand Down
2 changes: 2 additions & 0 deletions Kickstarter-iOS/Locales/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Find_projects_youll_love_in_art_design_film" = "お気に入りを見つけて、クリエイティブなプロジェクトに生命を吹き込もう。";
"First_created" = "1つめのプロジェクト";
"Fix" = "修正する";
"Fix_your_payment_method" = "お支払い方法を修正";
"Follow_friend_name" = "%{friend_name} をフォロー";
"Follow_friends" = "友達をフォロー";
"Follow_more_friends" = "もっと友達をフォローする";
Expand Down Expand Up @@ -275,6 +276,7 @@
"Newsletters" = "ニュースレター";
"No_Results" = "該当結果なし";
"No_comments_yet" = "まだコメントはありません。";
"No_longer_available" = "利用できなくなりました";
"No_messages" = "メッセージがありません。";
"No_nevermind" = "いいえ、削除しません";
"No_one_has_posted_an_update_yet" = "まだアップデートの投稿はありません。";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal final class BetaToolsViewController: UITableViewController {
self.navigationController?.dismiss(animated: true)
}

// MARK: Private Helper Functions
// MARK: - Functions

private func configureFooterView() {
let containerView = UIView(frame: .zero)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ internal final class DashboardProjectsDrawerViewController: UITableViewControlle
self.tableView.backgroundView?.addGestureRecognizer(
UITapGestureRecognizer(
target: self, action: #selector(DashboardProjectsDrawerViewController.backgroundTapped)
))
)
)
})

UIView.animate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ internal final class DeprecatedRewardPledgeViewController: UIViewController {
project: Project,
reward: Reward,
applePayCapable: Bool = PKPaymentAuthorizationViewController.applePayCapable()
)
-> DeprecatedRewardPledgeViewController {
) -> DeprecatedRewardPledgeViewController {
let vc = Storyboard.RewardPledge.instantiate(DeprecatedRewardPledgeViewController.self)
vc.viewModel.inputs.configureWith(project: project, reward: reward, applePayCapable: applePayCapable)
return vc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public final class ProjectPamphletViewController: UIViewController {
}

private var initialTopConstraint: CGFloat {
return parent?.view.safeAreaInsets.top ?? 0.0
return self.parent?.view.safeAreaInsets.top ?? 0.0
}

private func configurePledgeCTAContainerView() {
Expand Down
75 changes: 62 additions & 13 deletions Kickstarter-iOS/Views/RewardCardContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public final class RewardCardContainerView: UIView {

private let pledgeButtonLayoutGuide = UILayoutGuide()
private var pledgeButtonMarginConstraints: [NSLayoutConstraint]?
private var pledgeButtonShownConstraints: [NSLayoutConstraint] = []
private var pledgeButtonHiddenConstraints: [NSLayoutConstraint] = []
private let rewardCardView: RewardCardView = {
RewardCardView(frame: .zero)
|> \.translatesAutoresizingMaskIntoConstraints .~ false
Expand All @@ -52,9 +54,6 @@ public final class RewardCardContainerView: UIView {
|> roundedStyle(cornerRadius: Styles.grid(3))
|> \.layoutMargins .~ .init(all: Styles.grid(3))

_ = self.pledgeButton
|> greenButtonStyle

_ = self.gradientView
|> \.backgroundColor .~ .clear
|> \.startPoint .~ .zero
Expand Down Expand Up @@ -82,8 +81,29 @@ public final class RewardCardContainerView: UIView {
.rewardCardView(self.rewardCardView, didTapWithRewardId: rewardId)
}

self.pledgeButton.rac.title = self.viewModel.outputs.pledgeButtonTitleText
self.viewModel.outputs.pledgeButtonTitleText.observeValues { [weak self] text in
self?.pledgeButton.setTitle(text, for: .normal)
}
self.pledgeButton.rac.enabled = self.viewModel.outputs.pledgeButtonEnabled

self.viewModel.outputs.pledgeButtonHidden.observeValues { [weak self] hidden in
guard let self = self else { return }

if hidden {
NSLayoutConstraint.activate(self.pledgeButtonHiddenConstraints)
NSLayoutConstraint.deactivate(self.pledgeButtonShownConstraints)
} else {
NSLayoutConstraint.activate(self.pledgeButtonShownConstraints)
NSLayoutConstraint.deactivate(self.pledgeButtonHiddenConstraints)
}
}

self.viewModel.outputs.pledgeButtonStyleType
.observeForUI()
.observeValues { [weak self] styleType in
guard let self = self else { return }
_ = self.pledgeButton |> styleType.style
}
}

internal func configure(with value: (project: Project, reward: Either<Reward, Backing>)) {
Expand Down Expand Up @@ -112,6 +132,25 @@ public final class RewardCardContainerView: UIView {
}

public func setupConstraints() {
self.pledgeButtonHiddenConstraints = self.hiddenPledgeHiddenConstraints()
self.pledgeButtonShownConstraints = self.shownPledgeButtonConstraints()
NSLayoutConstraint.activate(self.pledgeButtonShownConstraints)
}

private func hiddenPledgeHiddenConstraints() -> [NSLayoutConstraint] {
let containerMargins = self.layoutMarginsGuide

let rewardCardViewConstraints = [
self.rewardCardView.leftAnchor.constraint(equalTo: containerMargins.leftAnchor),
self.rewardCardView.rightAnchor.constraint(equalTo: containerMargins.rightAnchor),
self.rewardCardView.topAnchor.constraint(equalTo: containerMargins.topAnchor),
self.rewardCardView.bottomAnchor.constraint(equalTo: containerMargins.bottomAnchor)
]

return rewardCardViewConstraints
}

private func shownPledgeButtonConstraints() -> [NSLayoutConstraint] {
let containerMargins = self.layoutMarginsGuide

let rewardCardViewConstraints = [
Expand All @@ -131,36 +170,46 @@ public final class RewardCardContainerView: UIView {
self.pledgeButtonLayoutGuide.bottomAnchor.constraint(equalTo: containerMargins.bottomAnchor),
self.pledgeButtonLayoutGuide.leftAnchor.constraint(equalTo: containerMargins.leftAnchor),
self.pledgeButtonLayoutGuide.rightAnchor.constraint(equalTo: containerMargins.rightAnchor),
// swiftlint:disable:next line_length
self.pledgeButtonLayoutGuide.topAnchor.constraint(equalTo: self.rewardCardView.bottomAnchor, constant: Styles.grid(3)),
self.pledgeButtonLayoutGuide.topAnchor.constraint(
equalTo: self.rewardCardView.bottomAnchor, constant: Styles.grid(3)
),
self.pledgeButtonLayoutGuide.heightAnchor.constraint(equalTo: self.pledgeButton.heightAnchor)
]

NSLayoutConstraint.activate([
let constraints = [
[pledgeButtonTopConstraint],
rewardCardViewConstraints,
pledgeButtonLayoutGuideConstraints
]
.flatMap { $0 })
.flatMap { $0 }

return constraints
}

private func addBottomViewsMarginConstraints(with layoutMarginsGuide: UILayoutGuide) {
NSLayoutConstraint.deactivate(self.pledgeButtonMarginConstraints ?? [])
let minTouchSize = Styles.minTouchSize.height

NSLayoutConstraint.activate([
let pledgeButtonMarginConstraints = [
self.pledgeButton.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor),
self.pledgeButton.rightAnchor.constraint(equalTo: layoutMarginsGuide.rightAnchor),
self.pledgeButton.bottomAnchor.constraint(lessThanOrEqualTo: layoutMarginsGuide.bottomAnchor),
self.pledgeButton.heightAnchor.constraint(greaterThanOrEqualToConstant: minTouchSize)
])
self.pledgeButton.heightAnchor.constraint(
greaterThanOrEqualToConstant: minTouchSize
)
]

NSLayoutConstraint.activate(pledgeButtonMarginConstraints)

self.pledgeButtonMarginConstraints = pledgeButtonMarginConstraints

NSLayoutConstraint.activate([
self.gradientView.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor),
self.gradientView.rightAnchor.constraint(equalTo: layoutMarginsGuide.rightAnchor),
self.gradientView.topAnchor.constraint(equalTo: self.pledgeButton.topAnchor, constant: -minTouchSize),
// swiftlint:disable:next line_length
self.gradientView.bottomAnchor.constraint(equalTo: self.pledgeButton.bottomAnchor, constant: minTouchSize / 2)
self.gradientView.bottomAnchor.constraint(
equalTo: self.pledgeButton.bottomAnchor, constant: minTouchSize / 2
)
])
}

Expand Down
Loading

0 comments on commit a6c9a21

Please sign in to comment.