mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-08 19:10:53 +00:00
Location distance picker fixes
This commit is contained in:
parent
7c9ff342fa
commit
44eff9ed95
@ -397,16 +397,19 @@ class LocationDistancePickerScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
}
|
||||
}
|
||||
|
||||
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
|
||||
func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
|
||||
let font = Font.regular(17.0)
|
||||
let string: String
|
||||
if component == 0 {
|
||||
let value = unitValues[row]
|
||||
return "\(value)"
|
||||
string = "\(value)"
|
||||
} else if component == 1 {
|
||||
let value = String(format: "%.2d", smallUnitValues[row])
|
||||
return ".\(value)"
|
||||
string = ".\(value)"
|
||||
} else {
|
||||
return self.usesMetricSystem() ? self.presentationData.strings.Location_ProximityNotification_DistanceKM : self.presentationData.strings.Location_ProximityNotification_DistanceMI
|
||||
string = self.usesMetricSystem() ? self.presentationData.strings.Location_ProximityNotification_DistanceKM : self.presentationData.strings.Location_ProximityNotification_DistanceMI
|
||||
}
|
||||
return NSAttributedString(string: string, font: font, textColor: self.presentationData.theme.actionSheet.primaryTextColor)
|
||||
}
|
||||
|
||||
func updatePresentationData(_ presentationData: PresentationData) {
|
||||
@ -431,6 +434,8 @@ class LocationDistancePickerScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
|
||||
self.cancelButton.setTitle(self.presentationData.strings.Common_Cancel, with: Font.regular(17.0), with: self.presentationData.theme.actionSheet.controlAccentColor, for: .normal)
|
||||
self.doneButton.updateTheme(SolidRoundedButtonTheme(theme: self.presentationData.theme))
|
||||
|
||||
self.updateDoneButtonTitle()
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
|
@ -26,6 +26,23 @@ public enum LocationMapMode {
|
||||
}
|
||||
}
|
||||
|
||||
public enum LocationTrackingMode {
|
||||
case none
|
||||
case follow
|
||||
case followWithHeading
|
||||
|
||||
var userTrackingMode: MKUserTrackingMode {
|
||||
switch self {
|
||||
case .follow:
|
||||
return .follow
|
||||
case .followWithHeading:
|
||||
return .followWithHeading
|
||||
default:
|
||||
return .none
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PickerAnnotationContainerView: UIView {
|
||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
let result = super.hitTest(point, with: event)
|
||||
@ -352,6 +369,12 @@ final class LocationMapNode: ASDisplayNode, MKMapViewDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
var trackingMode: LocationTrackingMode = .none {
|
||||
didSet {
|
||||
self.mapView?.userTrackingMode = self.trackingMode.userTrackingMode
|
||||
}
|
||||
}
|
||||
|
||||
func setMapCenter(coordinate: CLLocationCoordinate2D, span: MKCoordinateSpan = defaultMapSpan, offset: CGPoint = CGPoint(), isUserLocation: Bool = false, hidePicker: Bool = false, animated: Bool = false) {
|
||||
let region = MKCoordinateRegion(center: coordinate, span: span)
|
||||
self.ignoreRegionChanges = true
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Location/TrackActiveIcon.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Location/TrackActiveIcon.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "ic_gps_filled.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Location/TrackActiveIcon.imageset/ic_gps_filled.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Location/TrackActiveIcon.imageset/ic_gps_filled.pdf
vendored
Normal file
Binary file not shown.
12
submodules/TelegramUI/Images.xcassets/Location/TrackHeadingIcon.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Location/TrackHeadingIcon.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "ic_gps_2.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Location/TrackHeadingIcon.imageset/ic_gps_2.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Location/TrackHeadingIcon.imageset/ic_gps_2.pdf
vendored
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user