-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[NT-1296, NT-1297] Manage Pledge view info bugfixes #1241
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,8 +166,9 @@ public final class ManagePledgeViewModel: | |
|
||
self.configurePaymentMethodView = backing.map(managePledgePaymentMethodViewData) | ||
|
||
self.configurePledgeSummaryView = Signal.combineLatest(project, graphBackingEnvelope) | ||
.filterMap { project, env in managePledgeSummaryViewData(with: project, envelope: env) } | ||
self.configurePledgeSummaryView = Signal.combineLatest(projectAndReward, graphBackingEnvelope) | ||
.map(unpack) | ||
.filterMap(managePledgeSummaryViewData) | ||
|
||
let projectOrBackingFailedToLoad = Signal.merge( | ||
fetchProjectEvent.map { $0.error as Error? }, | ||
|
@@ -468,12 +469,9 @@ private func managePledgePaymentMethodViewData( | |
|
||
private func managePledgeSummaryViewData( | ||
with project: Project, | ||
backedReward: Reward, | ||
envelope: ManagePledgeViewBackingEnvelope | ||
) -> ManagePledgeSummaryViewData? { | ||
guard let backing = project.personalization.backing else { return nil } | ||
|
||
let backedReward = reward(from: backing, inProject: project) | ||
|
||
return .init( | ||
backerId: envelope.backing.backer.uid, | ||
backerName: envelope.backing.backer.name, | ||
|
@@ -511,8 +509,13 @@ private func rewardsData( | |
let dateFormatter = DateFormatter() | ||
dateFormatter.dateFormat = "yyyy-MM-DD" | ||
|
||
var existingAddOnIds = Set<String>() | ||
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. Maintaining a |
||
|
||
return addOns.compactMap { addOn in | ||
Reward.addOnReward( | ||
guard existingAddOnIds.contains(addOn.id) == false else { return nil } | ||
existingAddOnIds.insert(addOn.id) | ||
|
||
return Reward.addOnReward( | ||
from: addOn, | ||
project: project, | ||
selectedAddOnQuantities: selectedAddOnQuantities, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,7 @@ private func localizedDescription(project: Project, reward: Reward) -> String { | |
} | ||
|
||
private func rewardTitle(project: Project, reward: Reward) -> NSAttributedString { | ||
guard project.personalization.isBacking == true else { | ||
guard project.personalization.isBacking == true || currentUserIsCreator(of: project) else { | ||
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. This |
||
return NSAttributedString( | ||
string: reward.isNoReward ? Strings.Pledge_without_a_reward() : reward.title.coalesceWith("") | ||
) | ||
|
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.
We're now passing in the backed reward instead of trying to retrieve it from the
Project
'spersonalization
property as the latter is unavailable in the creator context.