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

[NT-449] Update pledge disclaimer #907

Merged
merged 29 commits into from
Oct 30, 2019
Merged

[NT-449] Update pledge disclaimer #907

merged 29 commits into from
Oct 30, 2019

Conversation

cdolm92
Copy link
Contributor

@cdolm92 cdolm92 commented Oct 23, 2019

📲 What

We are now showing a disclaimer when updating pledge in different currency.

🤔 Why

So that users understand that they are about to be charged in a foreign currency and foreign transaction fees may apply.

🛠 How

Checking to see if the user's currency matches the project's. If not we show the conversion label otherwise we don't.

👀 See

Before 🐛 After 🦋
Simulator Screen Shot - iPhone Xs - 2019-10-23 at 11 11 01 Simulator Screen Shot - iPhone Xs - 2019-10-23 at 11 08 57

✅ Acceptance criteria

  • Go to a project w/ a currency different than the preferred, navigate to update pledge, you should see the conversion label

@cdolm92 cdolm92 requested a review from Scollaco October 23, 2019 15:13
@cdolm92 cdolm92 changed the title Update pledge disclaimer [NT-449] Update pledge disclaimer Oct 23, 2019
@cdolm92 cdolm92 added the WIP label Oct 24, 2019
@cdolm92 cdolm92 removed the WIP label Oct 28, 2019
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.

Well done! I just left a few comments, but nothing serious. 🌟

@@ -141,13 +141,15 @@ public class PledgeViewModel: PledgeViewModelType, PledgeViewModelInputs, Pledge
}
.skipNil()

self.confirmationLabelAttributedText = Signal.merge(
let initialProjectAndProject = Signal.merge(
Copy link
Contributor

Choose a reason for hiding this comment

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

Here the initialProjectAndProject are the same project, but emitted in different times and this can end up becoming misleading. Maybe something like this would be better?

 let projectAndPledgeTotal = Signal.merge(
      project,
      project.takeWhen(self.traitCollectionDidChangeSignal)
    )
    .combineLatest(with: pledgeTotal)

self.confirmationLabelAttributedText = projectAndPledgeTotal
    .ksr_debounce(.milliseconds(10), on: AppEnvironment.current.scheduler)
    .map(attributedConfirmationString(with:pledgeTotal:))
    .skipNil()

Copy link
Contributor Author

@cdolm92 cdolm92 Oct 29, 2019

Choose a reason for hiding this comment

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

Oh, I forgot to change that naming 🤦🏾‍♀️ .Thanks for improving!

],
documentAttributes: nil
) else { return nil }
if project.stats.currentCurrency == project.stats.currency {
Copy link
Contributor

Choose a reason for hiding this comment

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

To make this function a bit smaller, we could extract this to a new function that returns a String based on the currencies.

)
}

let attributedString: NSMutableAttributedString = NSMutableAttributedString.init(string: fullString)
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency, the syntax without .init would be preferred (NSMutableAttributedString(string: fullString))

|> \.month .~ 11
|> \.day .~ 1
|> \.year .~ 2_019
|> \.timeZone .~ TimeZone.init(secondsFromGMT: 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this code was already here, but could you get rid of the .inits here too?

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.

Sheep it!

@cdolm92 cdolm92 merged commit 882939f into master Oct 30, 2019
@cdolm92 cdolm92 deleted the update-pledge-disclaimer branch October 30, 2019 16:19
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.

2 participants