-
Notifications
You must be signed in to change notification settings - Fork 121
[Mobile Payments] Specific tap on mobile errors #8315
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b7a4f85
8082 Show specific configuration progress alerts
joshheald e559a0d
8082 Extract shared progress logic to protocol ext
joshheald 0af2f5e
8082 Extract progress alert title and message logic
joshheald 6cb4683
8295 Add Built-in reader related Underlying Errors
joshheald 15cbc0b
8295 Decode Stripe errors for built-in readers
joshheald 72e4e6d
8295 Use UnderlyingError from discovery failure
joshheald 6b00ce8
8295 Update required iOS version in discovery error
joshheald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
81 changes: 81 additions & 0 deletions
81
...Classes/ViewModels/CardPresentPayments/CardPresentModalBuiltInConfigurationProgress.swift
This file contains hidden or 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,81 @@ | ||
| import UIKit | ||
|
|
||
| /// Modal presented when a firmware update is being installed | ||
| /// | ||
| final class CardPresentModalBuiltInConfigurationProgress: CardPresentPaymentsModalViewModel, CardPresentModalProgressDisplaying { | ||
| /// Called when cancel button is tapped | ||
| private let cancelAction: (() -> Void)? | ||
|
|
||
| let textMode: PaymentsModalTextMode = .fullInfo | ||
| let actionsMode: PaymentsModalActionsMode | ||
|
|
||
| var topSubtitle: String? = nil | ||
|
|
||
| var progress: Float | ||
|
|
||
| let primaryButtonTitle: String? = nil | ||
|
|
||
| let secondaryButtonTitle: String? = Localization.cancel | ||
|
|
||
| let auxiliaryButtonTitle: String? = nil | ||
|
|
||
| var titleComplete: String | ||
|
|
||
| var titleInProgress: String | ||
|
|
||
| var messageComplete: String? | ||
|
|
||
| var messageInProgress: String? | ||
|
|
||
| var accessibilityLabel: String? { | ||
| Localization.title | ||
| } | ||
|
|
||
| init(progress: Float, cancel: (() -> Void)?) { | ||
| self.progress = progress | ||
| self.cancelAction = cancel | ||
|
|
||
| titleComplete = Localization.titleComplete | ||
| titleInProgress = Localization.title | ||
| messageComplete = Localization.messageComplete | ||
| messageInProgress = Localization.message | ||
| actionsMode = cancel != nil ? .secondaryOnlyAction : .none | ||
| } | ||
|
|
||
| func didTapPrimaryButton(in viewController: UIViewController?) {} | ||
|
|
||
| func didTapSecondaryButton(in viewController: UIViewController?) { | ||
| cancelAction?() | ||
| } | ||
|
|
||
| func didTapAuxiliaryButton(in viewController: UIViewController?) {} | ||
| } | ||
|
|
||
| private extension CardPresentModalBuiltInConfigurationProgress { | ||
| enum Localization { | ||
| static let title = NSLocalizedString( | ||
| "Configuring iPhone", | ||
| comment: "Dialog title that displays when iPhone configuration is being updated for use as a card reader" | ||
| ) | ||
|
|
||
| static let titleComplete = NSLocalizedString( | ||
| "Configuration updated", | ||
| comment: "Dialog title that displays when a configuration update just finished installing" | ||
| ) | ||
|
|
||
| static let message = NSLocalizedString( | ||
| "Your iPhone needs to be configured to collect payments.", | ||
| comment: "Label that displays when a configuration update is happening" | ||
| ) | ||
|
|
||
| static let messageComplete = NSLocalizedString( | ||
| "Your phone will be ready to collect payments in a moment...", | ||
| comment: "Dialog message that displays when a configuration update just finished installing" | ||
| ) | ||
|
|
||
| static let cancel = NSLocalizedString( | ||
| "Cancel", | ||
| comment: "Label for a cancel button" | ||
| ) | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
WooCommerce/Classes/ViewModels/CardPresentPayments/CardPresentModalProgressDisplaying.swift
This file contains hidden or 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,39 @@ | ||
| import UIKit | ||
|
|
||
| protocol CardPresentModalProgressDisplaying: CardPresentPaymentsModalViewModel { | ||
| var progress: Float { get } | ||
| var isComplete: Bool { get } | ||
| var titleComplete: String { get } | ||
| var titleInProgress: String { get } | ||
| var messageComplete: String? { get } | ||
| var messageInProgress: String? { get } | ||
| } | ||
|
|
||
| extension CardPresentModalProgressDisplaying { | ||
| var image: UIImage { | ||
| .softwareUpdateProgress(progress: CGFloat(progress)) | ||
| } | ||
|
|
||
| var isComplete: Bool { | ||
| progress == 1 | ||
| } | ||
|
|
||
| var topTitle: String { | ||
| isComplete ? titleComplete : titleInProgress | ||
| } | ||
|
|
||
| var bottomTitle: String? { | ||
| String(format: CardPresentModalProgressDisplayingLocalization.percentComplete, 100 * progress) | ||
| } | ||
|
|
||
| var bottomSubtitle: String? { | ||
| isComplete ? messageComplete : messageInProgress | ||
| } | ||
| } | ||
|
|
||
| fileprivate enum CardPresentModalProgressDisplayingLocalization { | ||
| static let percentComplete = NSLocalizedString( | ||
| "%.0f%% complete", | ||
| comment: "Label that describes the completed progress of an update being installed (e.g. 15% complete). Keep the %.0f%% exactly as is" | ||
| ) | ||
| } | ||
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.
This part doesn't seem related to errors or mentioned in the description/testing, I'm wondering if this was intentionally included
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.
Github's being a bit strange.
Here's the first four commits from this PR:

And here's the three commits from the previous PR, which is merged to trunk:

So... they're all already in trunk with matching hashes, so I'm pretty sure this will sort itself out when I merge this PR... but I will check carefully! Thanks for the heads-up.