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] Event tracking & tests #784

Closed
wants to merge 94 commits into from

Conversation

cdolm92
Copy link
Contributor

@cdolm92 cdolm92 commented Aug 5, 2019

πŸ“² What

First release events that adds tracking events and tests for checkout events in project page and reward page.

βœ… Acceptance criteria

  • Turn on the KOALA_TRACKING environment variable in the scheme. Then launch the app and navigate to a project. You should see the Back this project CTA, tap it. You should see an event "Back this Project Button Clicked" in the console.
  • Turn on the KOALA_TRACKING environment variable in the scheme. Then launch the app and navigate to a project. You should see the Back this project CTA, tap it. You should get to the reward screen. Tap on a reward to select it and an event, "Select Reward Button Clicked" should appear in the console.

dusi and others added 30 commits March 29, 2019 15:38
…tViewController (#647)

* Rename CheckoutViewController to DeprecatedCheckoutViewController

* Rename CheckoutViewModel to DeprecatedCheckoutViewModel

* Remove CheckoutViewModelTests
…ag 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
…VC/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
* Prepare PledgeViewModel

* Prepare PledgeViewController

* Prepare PledgeDataSource
* 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
* 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
* 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
* 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
* 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
* PledgeContinueCell

* Common green button styling

* Tests

* Adding a test, cleaning up

* Swiftlint

* Fixing merge conflicts

* PR feedback
* 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
* 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
* 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
…feature-native-checkout

# Conflicts:
#	Kickstarter-iOS/DataSources/ProjectPamphletContentDataSource.swift
#	Kickstarter-iOS/DataSources/ProjectPamphletContentDataSourceTests.swift
#	Kickstarter-iOS/Views/Controllers/ProjectPamphletViewController.swift
#	Library/ViewModels/DiscoveryFiltersViewModel.swift
#	Library/ViewModels/LiveStreamContainerPageViewModel.swift
#	Library/ViewModels/ProjectPamphletViewModel.swift
…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
* Navigate to PledgeVC when reward is selected

* One more test

* Renaming

* Updates based on feedback
* 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
# Conflicts:
#	KsApi/models/Config.swift
#	bin/format.sh
dusi and others added 20 commits July 19, 2019 13:29
* 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
* 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
* Sections and section separators

* Formatting

* Renaming from feedback

* PR feedback
* 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
* Page sheet

* WIP ipad handling for sheet overlap

* More wip

* Helper for presenting sheet overlay w/ ipad exception

* Addressing feedback & formatting

* PR feedback
* Adding activity indicator

* Add starting/stopping indicator behavior

* Fade in effect

* Tests

* Formatting

* Cleanup

* Formatting

* Fix center alignment on indicator
@cdolm92 cdolm92 requested a review from ifbarrera August 5, 2019 19:03
@cdolm92 cdolm92 changed the base branch from feature-native-checkout to master August 6, 2019 18:18
Copy link
Contributor

@Scollaco Scollaco left a comment

Choose a reason for hiding this comment

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

Nice job, @cdolm92 . I made a comment because I don't think we should be using MockDate in production code. But since we already had this on our code, it would be good to clarify why we were using mocks and not the real Date type.

props["location"] = project.location.name
props["country"] = project.country.countryCode

let now = MockDate().timeIntervalSince1970
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that on line 2069 we are using MockDate() too, but I think we should be using Date() instead. @justinswart Do you know the reason for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm well-spotted @Scollaco. I can't imagine why MockDate() was used in this file, I see it's a change I made in #67 to fix tests, but I think doing it in this file, which is application code and not unit test code, is incorrect.

The only reason we use MockDate() in tests is to give ourselves control over the movement of time. It also ensures that tests pass in environments that are in different timezones, etc.

So yes, I think both instances of MockDate() here should be AppEnvironment.current.dateType.init(). This means that in unit tests it will use MockDate and in the app it uses Date

This likely means that the value of hours_remaining in our tracking properties has always been incorrect πŸ€” πŸ€·β€β™‚

@ksr-ci-bot
Copy link

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@cdolm92 cdolm92 mentioned this pull request Aug 12, 2019
2 tasks
@cdolm92 cdolm92 closed this Aug 12, 2019
@justinswart justinswart deleted the checkout-release-events branch June 15, 2021 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants