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
Profile updates #4
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
40fb5b0
update styles
theginbin 84b5a42
add metadata. fix loader. fix sort by ending date.
theginbin 42ca928
update tests. add screenshots.
theginbin 0a629fb
fix lint
theginbin 013931c
fix failing test
theginbin a1774ba
pr feedback
theginbin 8602cd5
Merge remote-tracking branch 'oss/master' into profile-updates
theginbin 1a735b2
prevent progress bar anchor point from being too low
theginbin a32fa30
set divider back to darker color
theginbin File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
Kickstarter-iOS/Tests/Views/ProfileViewControllerTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import Prelude | ||
import Result | ||
import XCTest | ||
@testable import Kickstarter_Framework | ||
@testable import KsApi | ||
@testable import Library | ||
|
||
internal final class ProfileViewControllerTests: TestCase { | ||
private var project1: Project! | ||
private var project2: Project! | ||
private var project3: Project! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
let deadline = self.dateType.init().timeIntervalSince1970 + 60.0 * 60.0 * 24.0 * 14.0 | ||
let liveProject = Project.cosmicSurgery | ||
|> Project.lens.photo.full .~ "" | ||
|> (Project.lens.creator.avatar • User.Avatar.lens.small) .~ "" | ||
|> Project.lens.dates.deadline .~ deadline | ||
|> Project.lens.stats.fundingProgress .~ 0.5 | ||
|
||
let deadProject = Project.anomalisa | ||
|> Project.lens.photo.full .~ "" | ||
|> (Project.lens.creator.avatar • User.Avatar.lens.small) .~ "" | ||
|> Project.lens.dates.deadline .~ self.dateType.init().timeIntervalSince1970 | ||
|> Project.lens.state .~ .successful | ||
|
||
let failed = Project.cosmicSurgery | ||
|> Project.lens.name .~ "A Failed Project About Mittens" | ||
|> Project.lens.photo.full .~ "" | ||
|> (Project.lens.creator.avatar • User.Avatar.lens.small) .~ "" | ||
|> Project.lens.dates.deadline .~ self.dateType.init().timeIntervalSince1970 | ||
|> Project.lens.state .~ .failed | ||
|
||
self.project1 = liveProject | ||
self.project2 = deadProject | ||
self.project3 = failed | ||
|
||
AppEnvironment.pushEnvironment(mainBundle: NSBundle.framework) | ||
UIView.setAnimationsEnabled(false) | ||
} | ||
|
||
override func tearDown() { | ||
AppEnvironment.popEnvironment() | ||
UIView.setAnimationsEnabled(true) | ||
super.tearDown() | ||
} | ||
|
||
func testBackedProjects() { | ||
let env = .template |> DiscoveryEnvelope.lens.projects .~ [self.project1, self.project2, self.project3] | ||
|
||
let user = .template | ||
|> User.lens.name .~ "Chuck Berry" | ||
|> User.lens.avatar.large .~ "" | ||
|> User.lens.stats.backedProjectsCount .~ 3 | ||
|> User.lens.stats.createdProjectsCount .~ 1 | ||
|
||
combos(Language.allLanguages, [Device.phone4_7inch, Device.pad]).forEach { language, device in | ||
withEnvironment(apiService: MockService(fetchDiscoveryResponse: env, fetchUserSelfResponse: user), | ||
currentUser: user, | ||
language: language) { | ||
let controller = ProfileViewController.instantiate() | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: controller) | ||
|
||
self.scheduler.run() | ||
|
||
FBSnapshotVerifyView(parent.view, identifier: "lang_\(language)_device_\(device)") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,21 @@ internal final class ProfileHeaderView: UICollectionReusableView, ValueCell { | |
internal override func bindStyles() { | ||
super.bindStyles() | ||
|
||
self.backedProjectsLabel | ||
|> UILabel.lens.textColor .~ .ksr_text_navy_600 | ||
|> UILabel.lens.font .~ .ksr_subhead(size: 12) | ||
|
||
self.createdProjectsLabel | ||
|> UILabel.lens.textColor .~ .ksr_text_navy_600 | ||
|> UILabel.lens.font .~ .ksr_subhead(size: 12) | ||
|
||
self.dividerView | ||
|> UIView.lens.backgroundColor .~ .ksr_navy_400 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can use |
||
|
||
self.nameLabel | ||
|> UILabel.lens.textColor .~ .ksr_text_navy_700 | ||
|> UILabel.lens.font .~ .ksr_headline(size: 15) | ||
|
||
[self.backedProjectsLabel, self.createdProjectsLabel] | ||
||> UILabel.lens.adjustsFontSizeToFitWidth .~ true | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there was some funkadelic stuff happening with the progress bar overlapping the space if progress was greater than
1.0
, although we use this logic in every place we have a progress bar. I think this could be improved by a math whiz.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could do
let scaleX = min(1.0, progress)
or you could set some clipping properties on the enclosing view to prevent it from overlapping