mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-05 20:16:25 +03:00
Setup gas price slider
This commit is contained in:
parent
7b16abd536
commit
7e67de8381
@ -141,6 +141,7 @@ extension ApproveTransactionViewController: UITableViewDataSource {
|
||||
return cell
|
||||
case .gasPriceSlider:
|
||||
let cell = tableView.dequeueReusableCellOfType(GasPriceSliderTableViewCell.self, for: indexPath)
|
||||
cell.setup(value: nil, isEnabled: false, delegate: self)
|
||||
return cell
|
||||
}
|
||||
|
||||
@ -155,3 +156,11 @@ extension ApproveTransactionViewController: UITableViewDataSource {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ApproveTransactionViewController: GasPriceSliderDelegate {
|
||||
|
||||
func sliderValueChanged(value: Double) {
|
||||
// TODO: update accorging to new value
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,12 +2,35 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
protocol GasPriceSliderDelegate: AnyObject {
|
||||
|
||||
func sliderValueChanged(value: Double)
|
||||
|
||||
}
|
||||
|
||||
class GasPriceSliderTableViewCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var slowSpeedLabel: UILabel!
|
||||
@IBOutlet weak var fastSpeedLabel: UILabel!
|
||||
private weak var sliderDelegate: GasPriceSliderDelegate?
|
||||
@IBOutlet weak var slider: UISlider!
|
||||
|
||||
@IBAction func sliderValueChanged(_ sender: Any) {
|
||||
|
||||
sliderDelegate?.sliderValueChanged(value: Double(slider.value))
|
||||
}
|
||||
|
||||
func setup(value: Double?, isEnabled: Bool, delegate: GasPriceSliderDelegate) {
|
||||
sliderDelegate = delegate
|
||||
update(value: value, isEnabled: isEnabled)
|
||||
}
|
||||
|
||||
func update(value: Double?, isEnabled: Bool) {
|
||||
slider.isEnabled = isEnabled
|
||||
slowSpeedLabel.alpha = isEnabled ? 1 : 0.5
|
||||
fastSpeedLabel.alpha = isEnabled ? 1 : 0.5
|
||||
if let value = value {
|
||||
slider.value = Float(value)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="qd0-pb-veR">
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.33000000000000002" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="qd0-pb-veR">
|
||||
<rect key="frame" x="49" y="16" width="228" height="34"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="33" id="p8e-ar-5IX"/>
|
||||
@ -51,7 +51,9 @@
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
|
||||
<connections>
|
||||
<outlet property="fastSpeedLabel" destination="Icb-yb-97Y" id="Td0-vW-AYd"/>
|
||||
<outlet property="slider" destination="qd0-pb-veR" id="JCq-Fs-VPp"/>
|
||||
<outlet property="slowSpeedLabel" destination="ISk-hp-Adc" id="kcW-Fl-ttL"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="140.57971014492756" y="143.63839285714286"/>
|
||||
</tableViewCell>
|
||||
|
@ -441,9 +441,9 @@
|
||||
2C40709227667A8600AB3D55 /* ImageWithLabelTableViewCell.swift */,
|
||||
2C40709327667A8600AB3D55 /* ImageWithLabelTableViewCell.xib */,
|
||||
2C40708E27667A6600AB3D55 /* MultilineLabelTableViewCell.swift */,
|
||||
2C40708F27667A6600AB3D55 /* MultilineLabelTableViewCell.xib */,
|
||||
2CC8C5A02767D3B30083FB1B /* GasPriceSliderTableViewCell.swift */,
|
||||
2CC8C5A12767D3B30083FB1B /* GasPriceSliderTableViewCell.xib */,
|
||||
2C40708F27667A6600AB3D55 /* MultilineLabelTableViewCell.xib */,
|
||||
);
|
||||
path = Approve;
|
||||
sourceTree = "<group>";
|
||||
|
Loading…
Reference in New Issue
Block a user