-
Notifications
You must be signed in to change notification settings - Fork 46
feature: set feelimit percentage in settings #315
base: master
Are you sure you want to change the base?
Changes from 1 commit
3295436
82a0b65
74dddb7
0cbcbea
1008c3c
668176e
12f22cc
022f7d8
6a69339
ad91e0d
eac918e
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Library | ||
// | ||
// Created by Christopher Pinski on 10/26/19. | ||
// Copyright © 2019 Zap. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftLnd | ||
|
||
extension PaymentFeeLimitPercentage: Localizable { | ||
public var localized: String { | ||
switch self { | ||
case .zero: | ||
return L10n.PaymentFeeLimitPercentage.none | ||
default: | ||
return "\(self.rawValue)%" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,4 +45,20 @@ extension UIAlertController { | |
|
||
return alertController | ||
} | ||
|
||
static func feeLimitAlertController(message: String, sendAction: @escaping () -> Void) -> UIAlertController { | ||
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. I don't like my Imo it would make sense to remove it and put the Alerts in the ViewControllers where they are actually used. 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. My other PR also has an alert added to this controller. I don't mind where they live but I would rather open an issue to refactor the alerts out of this extension and address it after the PRs are merged rather than refactor both PRs. |
||
let title: String = L10n.Scene.Send.FeeAlert.title | ||
let confirmButtonTitle: String = L10n.Scene.Send.FeeAlert.ConfirmButton.title | ||
|
||
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) | ||
let cancelAlertAction = UIAlertAction(title: L10n.Scene.Send.FeeAlert.CancelButton.title, style: .cancel, handler: nil) | ||
|
||
let confirmAlertAction = UIAlertAction(title: confirmButtonTitle, style: .default) { _ in | ||
sendAction() | ||
} | ||
alertController.addAction(cancelAlertAction) | ||
alertController.addAction(confirmAlertAction) | ||
|
||
return alertController | ||
} | ||
} |
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 should use the
NumberFormatter()
from the SendViewController here. Maybe put it in its own extension file.There are many different ways to format the percent sign (https://en.wikipedia.org/wiki/Percent_sign#Correct_style) 😅