Various improvements

This commit is contained in:
Ilya Laktyushin 2024-08-29 02:26:16 +04:00
parent e24ce90363
commit 0d1366e5cc
7 changed files with 40 additions and 13 deletions

View File

@ -3658,7 +3658,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
}
strongSelf.onlineNode.setImage(onlineIcon, color: item.presentationData.theme.list.itemCheckColors.foregroundColor, transition: .immediate)
if isSubscription {
if isSubscription, autoremoveTimeout == nil {
let starView: StarView
if let current = strongSelf.starView {
starView = current

View File

@ -183,7 +183,7 @@ public final class LocationMapHeaderNode: ASDisplayNode {
let mapHeight: CGFloat = floor(layout.size.height * 1.3) + layout.intrinsicInsets.top * 2.0
let mapFrame = CGRect(x: 0.0, y: floorToScreenPixels((size.height - mapHeight + navigationBarHeight) / 2.0) + offset + floor(layout.intrinsicInsets.top * 0.5), width: size.width, height: mapHeight)
transition.updateFrame(node: self.mapNode, frame: mapFrame)
self.mapNode.updateLayout(size: mapFrame.size, topPadding: 0.0)
self.mapNode.updateLayout(size: mapFrame.size, topPadding: topPadding, inset: mapFrame.origin.y * -1.0 + navigationBarHeight, transition: transition)
let inset: CGFloat = 6.0

View File

@ -219,6 +219,7 @@ public final class LocationMapNode: ASDisplayNode, MKMapViewDelegateTarget {
private let pickerAnnotationContainerView: PickerAnnotationContainerView
private weak var userLocationAnnotationView: MKAnnotationView?
private var headingArrowView: UIImageView?
private var compassView: MKCompassButton?
private weak var defaultUserLocationAnnotation: MKAnnotation?
@ -301,11 +302,15 @@ public final class LocationMapNode: ASDisplayNode, MKMapViewDelegateTarget {
override public func didLoad() {
super.didLoad()
guard let mapView = self.mapView else {
return
}
self.headingArrowView = UIImageView()
self.headingArrowView?.frame = CGRect(origin: CGPoint(), size: CGSize(width: 88.0, height: 88.0))
self.headingArrowView?.image = generateHeadingArrowImage()
self.mapView?.interactiveTransitionGestureRecognizerTest = { p in
mapView.interactiveTransitionGestureRecognizerTest = { p in
if p.x > 44.0 {
return true
} else {
@ -313,19 +318,25 @@ public final class LocationMapNode: ASDisplayNode, MKMapViewDelegateTarget {
}
}
self.mapView?.disablesInteractiveTransitionGestureRecognizerNow = { [weak self] in
mapView.disablesInteractiveTransitionGestureRecognizerNow = { [weak self] in
return self?.disableHorizontalTransitionGesture == true
}
let delegateImpl = MKMapViewDelegateImpl(target: self)
self.delegateImpl = delegateImpl
self.mapView?.delegate = delegateImpl
self.mapView?.mapType = self.mapMode.mapType
self.mapView?.isRotateEnabled = self.isRotateEnabled
self.mapView?.showsUserLocation = true
self.mapView?.showsPointsOfInterest = false
self.mapView?.customHitTest = { [weak self] point in
let compassView = MKCompassButton(mapView: mapView)
compassView.isUserInteractionEnabled = true
self.compassView = compassView
mapView.addSubview(compassView)
mapView.delegate = delegateImpl
mapView.mapType = self.mapMode.mapType
mapView.isRotateEnabled = self.isRotateEnabled
mapView.showsUserLocation = true
mapView.showsPointsOfInterest = false
mapView.showsCompass = false
mapView.customHitTest = { [weak self] point in
guard let strongSelf = self else {
return false
}
@ -826,7 +837,7 @@ public final class LocationMapNode: ASDisplayNode, MKMapViewDelegateTarget {
}
}
public func updateLayout(size: CGSize, topPadding: CGFloat) {
public func updateLayout(size: CGSize, topPadding: CGFloat, inset: CGFloat, transition: ContainedViewLayoutTransition) {
self.hasValidLayout = true
self.topPadding = topPadding
@ -837,6 +848,10 @@ public final class LocationMapNode: ASDisplayNode, MKMapViewDelegateTarget {
pickerAnnotationView.center = CGPoint(x: self.pickerAnnotationContainerView.frame.width / 2.0, y: self.pickerAnnotationContainerView.frame.height / 2.0)
}
if let compassView = self.compassView {
transition.updateFrame(view: compassView, frame: CGRect(origin: CGPoint(x: size.width - compassView.frame.width - 11.0, y: inset + 110.0 + topPadding), size: compassView.frame.size))
}
self.applyPendingSetMapCenter()
}
}

View File

@ -321,7 +321,7 @@ final class LocationViewControllerNode: ViewControllerTracingNode, CLLocationMan
self.headerNode = LocationMapHeaderNode(presentationData: presentationData, toggleMapModeSelection: interaction.toggleMapModeSelection, goToUserLocation: interaction.toggleTrackingMode, setupProximityNotification: { reset in
setupProximityNotificationImpl?(reset)
})
self.headerNode.mapNode.isRotateEnabled = false
//self.headerNode.mapNode.isRotateEnabled = false
self.optionsNode = LocationOptionsNode(presentationData: presentationData, updateMapMode: interaction.updateMapMode)

View File

@ -285,7 +285,7 @@ public class ChatMessageGiveawayBubbleContentNode: ChatMessageBubbleContentNode,
}
let badgeString = NSMutableAttributedString(string: badgeText, font: Font.with(size: 10.0, design: .round , weight: .bold, traits: .monospacedNumbers), textColor: badgeTextColor)
if let range = badgeString.string.range(of: "⭐️") {
badgeString.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .stars(tinted: true)), range: NSRange(range, in: badgeString.string))
badgeString.addAttribute(.attachment, value: UIImage(bundleImageName: "Chat/Message/Stars")!, range: NSRange(range, in: badgeString.string))
badgeString.addAttribute(.baselineOffset, value: 1.5, range: NSRange(range, in: badgeString.string))
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "givstars.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}