Various fixes

This commit is contained in:
Ilya Laktyushin 2020-10-29 15:05:24 +04:00
parent 968e59077f
commit 5c1155d66d
5 changed files with 26 additions and 7 deletions

View File

@ -311,6 +311,7 @@ class LocationPinAnnotationView: MKAnnotationView {
self.smallNode.image = generateSmallBackgroundImage(color: color)
self.dotNode.image = generateFilledCircleImage(diameter: 6.0, color: color)
self.iconNode.isHidden = false
self.dotNode.isHidden = false
if !self.isSelected {
@ -354,6 +355,7 @@ class LocationPinAnnotationView: MKAnnotationView {
}
override func prepareForReuse() {
self.previousPeerId = nil
self.smallNode.isHidden = true
self.backgroundNode.isHidden = false
self.appeared = false

View File

@ -372,10 +372,6 @@ class LocationDistancePickerScreenNode: ViewControllerTracingNode, UIScrollViewD
let smallValue = smallUnitValues[selectedSmallRow]
var value = largeValue * 1000 + smallValue * 10
if !self.usesMetricSystem {
value = Int32(Double(value) * 1.60934)
}
var formattedValue = String(format: "%0.1f", CGFloat(value) / 1000.0)
if smallValue == 5 {
formattedValue = formattedValue.replacingOccurrences(of: ".1", with: ".05").replacingOccurrences(of: ",1", with: ",05")

View File

@ -255,11 +255,16 @@ final class LocationMapNode: ASDisplayNode, MKMapViewDelegate {
self.mapView?.showsUserLocation = true
self.mapView?.showsPointsOfInterest = false
self.mapView?.customHitTest = { [weak self] point in
guard let strongSelf = self, let annotationView = strongSelf.customUserLocationAnnotationView else {
guard let strongSelf = self else {
return false
}
if let annotationRect = annotationView.superview?.convert(annotationView.frame.insetBy(dx: -16.0, dy: -16.0), to: strongSelf.mapView), annotationRect.contains(point) {
if let annotationView = strongSelf.customUserLocationAnnotationView, let annotationRect = annotationView.superview?.convert(annotationView.frame.insetBy(dx: -16.0, dy: -16.0), to: strongSelf.mapView), annotationRect.contains(point) {
strongSelf.userLocationAnnotationSelected?()
return true
}
if let userAnnotation = strongSelf.defaultUserLocationAnnotation, let annotationView = strongSelf.mapView?.view(for: userAnnotation), let annotationRect = annotationView.superview?.convert(annotationView.frame.insetBy(dx: -16.0, dy: -16.0), to: strongSelf.mapView), annotationRect.contains(point) {
strongSelf.userLocationAnnotationSelected?()
return true
}
@ -393,6 +398,7 @@ final class LocationMapNode: ASDisplayNode, MKMapViewDelegate {
for view in views {
if view.annotation is MKUserLocation {
self.defaultUserLocationAnnotation = view.annotation
view.canShowCallout = false
self.userLocationAnnotationView = view
if let headingArrowView = self.headingArrowView {

View File

@ -557,6 +557,21 @@ final class LocationViewControllerNode: ViewControllerTracingNode, CLLocationMan
}
}
self.headerNode.mapNode.annotationSelected = { [weak self] annotation in
guard let strongSelf = self else {
return
}
if let annotation = annotation {
strongSelf.interaction.goToCoordinate(annotation.coordinate)
}
}
self.headerNode.mapNode.userLocationAnnotationSelected = { [weak self] in
if let strongSelf = self, let location = strongSelf.headerNode.mapNode.currentUserLocation {
strongSelf.interaction.goToCoordinate(location.coordinate)
}
}
self.locationManager.manager.startUpdatingHeading()
self.locationManager.manager.delegate = self
}

View File

@ -829,7 +829,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
wasCheck = true
}
if isAudio && !isVoice {
if isAudio && !isVoice && !isSending {
state = .play
} else {
if message.groupingKey != nil, adjustedProgress.isEqual(to: 1.0), (message.flags.contains(.Unsent) || wasCheck) {