mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Fix build
This commit is contained in:
@@ -30,5 +30,6 @@ static_library(
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/CoreLocation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/MapKit.framework",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -8,7 +8,6 @@ import TelegramCore
|
||||
import SyncCore
|
||||
import TelegramPresentationData
|
||||
import ItemListUI
|
||||
import PresentationDataUtils
|
||||
import LocationResources
|
||||
import AppBundle
|
||||
|
||||
@@ -58,7 +57,7 @@ private func generateLocationIcon(theme: PresentationTheme) -> UIImage {
|
||||
context.scaleBy(x: 1.0, y: -1.0)
|
||||
context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0)
|
||||
|
||||
if let image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/LocationPinForeground"), color: theme.chat.inputPanel.actionControlForegroundColor) {
|
||||
if let image = generateTintedImage(image: UIImage(bundleImageName: "Location/SendLocationIcon"), color: theme.chat.inputPanel.actionControlForegroundColor) {
|
||||
context.draw(image.cgImage!, in: CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size))
|
||||
}
|
||||
}!
|
||||
@@ -74,7 +73,7 @@ private func generateLiveLocationIcon(theme: PresentationTheme) -> UIImage {
|
||||
context.scaleBy(x: 1.0, y: -1.0)
|
||||
context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0)
|
||||
|
||||
if let image = generateTintedImage(image: UIImage(bundleImageName: "Location/LiveLocationIcon"), color: theme.chat.inputPanel.actionControlForegroundColor) {
|
||||
if let image = generateTintedImage(image: UIImage(bundleImageName: "Location/SendLiveLocationIcon"), color: theme.chat.inputPanel.actionControlForegroundColor) {
|
||||
context.draw(image.cgImage!, in: CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size))
|
||||
}
|
||||
}!
|
||||
@@ -87,14 +86,16 @@ public class LocationActionListItem: ListViewItem {
|
||||
let subtitle: String
|
||||
let icon: LocationActionListItemIcon
|
||||
let action: () -> Void
|
||||
let highlighted: (Bool) -> Void
|
||||
|
||||
public init(presentationData: ItemListPresentationData, account: Account, title: String, subtitle: String, icon: LocationActionListItemIcon, action: @escaping () -> Void) {
|
||||
public init(presentationData: ItemListPresentationData, account: Account, title: String, subtitle: String, icon: LocationActionListItemIcon, action: @escaping () -> Void, highlighted: @escaping (Bool) -> Void = { _ in }) {
|
||||
self.presentationData = presentationData
|
||||
self.account = account
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
self.icon = icon
|
||||
self.action = action
|
||||
self.highlighted = highlighted
|
||||
}
|
||||
|
||||
public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
|
||||
@@ -130,7 +131,7 @@ public class LocationActionListItem: ListViewItem {
|
||||
}
|
||||
|
||||
public func selected(listView: ListView) {
|
||||
listView.clearHighlightAnimated(true)
|
||||
listView.clearHighlightAnimated(false)
|
||||
self.action()
|
||||
}
|
||||
}
|
||||
@@ -184,6 +185,8 @@ class LocationActionListItemNode: ListViewItemNode {
|
||||
override func setHighlighted(_ highlighted: Bool, at point: CGPoint, animated: Bool) {
|
||||
super.setHighlighted(highlighted, at: point, animated: animated)
|
||||
|
||||
self.item?.highlighted(highlighted)
|
||||
|
||||
if highlighted {
|
||||
self.highlightedBackgroundNode.alpha = 1.0
|
||||
if self.highlightedBackgroundNode.supernode == nil {
|
||||
|
||||
@@ -22,12 +22,12 @@ private func generateBackgroundImage(theme: PresentationTheme) -> UIImage? {
|
||||
}
|
||||
}
|
||||
|
||||
private func generateShadowImage(theme: PresentationTheme) -> UIImage? {
|
||||
private func generateShadowImage(theme: PresentationTheme, highlighted: Bool) -> UIImage? {
|
||||
return generateImage(CGSize(width: 26.0, height: 14.0)) { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
|
||||
context.setShadow(offset: CGSize(), blur: 10.0, color: UIColor(rgb: 0x000000, alpha: 0.2).cgColor)
|
||||
context.setFillColor(theme.list.plainBackgroundColor.cgColor)
|
||||
context.setFillColor(highlighted ? theme.list.itemHighlightedBackgroundColor.cgColor : theme.list.plainBackgroundColor.cgColor)
|
||||
let path = UIBezierPath(roundedRect: CGRect(origin: CGPoint(x: 0.0, y: 4.0), size: CGSize(width: 26.0, height: 20.0)), cornerRadius: 9.0)
|
||||
context.addPath(path.cgPath)
|
||||
context.fillPath()
|
||||
@@ -35,6 +35,7 @@ private func generateShadowImage(theme: PresentationTheme) -> UIImage? {
|
||||
}
|
||||
|
||||
final class LocationMapHeaderNode: ASDisplayNode {
|
||||
private var presentationData: PresentationData
|
||||
private let interaction: LocationPickerInteraction
|
||||
|
||||
let mapNode: LocationMapNode
|
||||
@@ -44,6 +45,7 @@ final class LocationMapHeaderNode: ASDisplayNode {
|
||||
private let shadowNode: ASImageNode
|
||||
|
||||
init(presentationData: PresentationData, interaction: LocationPickerInteraction) {
|
||||
self.presentationData = presentationData
|
||||
self.interaction = interaction
|
||||
|
||||
self.mapNode = LocationMapNode()
|
||||
@@ -66,7 +68,7 @@ final class LocationMapHeaderNode: ASDisplayNode {
|
||||
self.shadowNode.contentMode = .scaleToFill
|
||||
self.shadowNode.displaysAsynchronously = false
|
||||
self.shadowNode.displayWithoutProcessing = true
|
||||
self.shadowNode.image = generateShadowImage(theme: presentationData.theme)
|
||||
self.shadowNode.image = generateShadowImage(theme: presentationData.theme, highlighted: false)
|
||||
|
||||
super.init()
|
||||
|
||||
@@ -88,12 +90,14 @@ final class LocationMapHeaderNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
func updatePresentationData(_ presentationData: PresentationData) {
|
||||
self.presentationData = presentationData
|
||||
|
||||
self.optionsBackgroundNode.image = generateBackgroundImage(theme: presentationData.theme)
|
||||
self.infoButtonNode.setImage(generateTintedImage(image: UIImage(bundleImageName: "Location/InfoIcon"), color: presentationData.theme.rootController.navigationBar.buttonColor), for: .normal)
|
||||
self.infoButtonNode.setImage(generateTintedImage(image: UIImage(bundleImageName: "Location/InfoActiveIcon"), color: presentationData.theme.rootController.navigationBar.buttonColor), for: .selected)
|
||||
self.infoButtonNode.setImage(generateTintedImage(image: UIImage(bundleImageName: "Location/InfoActiveIcon"), color: presentationData.theme.rootController.navigationBar.buttonColor), for: [.selected, .highlighted])
|
||||
self.locationButtonNode.setImage(generateTintedImage(image: UIImage(bundleImageName: "Location/TrackIcon"), color: presentationData.theme.rootController.navigationBar.buttonColor), for: .normal)
|
||||
self.shadowNode.image = generateShadowImage(theme: presentationData.theme)
|
||||
self.shadowNode.image = generateShadowImage(theme: presentationData.theme, highlighted: false)
|
||||
}
|
||||
|
||||
func updateLayout(layout: ContainerViewLayout, navigationBarHeight: CGFloat, padding: CGFloat, size: CGSize, transition: ContainedViewLayoutTransition) {
|
||||
@@ -112,6 +116,10 @@ final class LocationMapHeaderNode: ASDisplayNode {
|
||||
alphaTransition.updateAlpha(node: self.optionsBackgroundNode, alpha: optionsAlpha)
|
||||
}
|
||||
|
||||
func updateHighlight(_ highlighted: Bool) {
|
||||
self.shadowNode.image = generateShadowImage(theme: self.presentationData.theme, highlighted: highlighted)
|
||||
}
|
||||
|
||||
@objc private func infoPressed() {
|
||||
self.interaction.toggleMapModeSelection()
|
||||
}
|
||||
|
||||
@@ -31,7 +31,9 @@ class LocationPickerInteraction {
|
||||
|
||||
let dismissInput: () -> Void
|
||||
|
||||
init(sendLocation: @escaping (CLLocationCoordinate2D) -> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D) -> Void, sendVenue: @escaping (TelegramMediaMap) -> Void, toggleMapModeSelection: @escaping () -> Void, updateMapMode: @escaping (LocationMapMode) -> Void, goToUserLocation: @escaping () -> Void, openSearch: @escaping () -> Void, updateSearchQuery: @escaping (String) -> Void, dismissSearch: @escaping () -> Void, dismissInput: @escaping () -> Void) {
|
||||
let updateSendActionHighlight: (Bool) -> Void
|
||||
|
||||
init(sendLocation: @escaping (CLLocationCoordinate2D) -> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D) -> Void, sendVenue: @escaping (TelegramMediaMap) -> Void, toggleMapModeSelection: @escaping () -> Void, updateMapMode: @escaping (LocationMapMode) -> Void, goToUserLocation: @escaping () -> Void, openSearch: @escaping () -> Void, updateSearchQuery: @escaping (String) -> Void, dismissSearch: @escaping () -> Void, dismissInput: @escaping () -> Void, updateSendActionHighlight: @escaping (Bool) -> Void) {
|
||||
self.sendLocation = sendLocation
|
||||
self.sendLiveLocation = sendLiveLocation
|
||||
self.sendVenue = sendVenue
|
||||
@@ -42,6 +44,7 @@ class LocationPickerInteraction {
|
||||
self.updateSearchQuery = updateSearchQuery
|
||||
self.dismissSearch = dismissSearch
|
||||
self.dismissInput = dismissInput
|
||||
self.updateSendActionHighlight = updateSendActionHighlight
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +215,11 @@ public final class LocationPickerController: ViewController {
|
||||
return
|
||||
}
|
||||
strongSelf.searchNavigationContentNode?.deactivate()
|
||||
}, updateSendActionHighlight: { [weak self] highlighted in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.controllerNode.updateSendActionHighlight(highlighted)
|
||||
})
|
||||
|
||||
self.scrollToTop = { [weak self] in
|
||||
@@ -235,9 +243,6 @@ public final class LocationPickerController: ViewController {
|
||||
}
|
||||
|
||||
self.displayNode = LocationPickerControllerNode(context: self.context, presentationData: self.presentationData, mode: self.mode, interaction: interaction)
|
||||
self.controllerNode.present = { [weak self] c, a in
|
||||
self?.present(c, in: .window(.root), with: a)
|
||||
}
|
||||
self.displayNodeDidLoad()
|
||||
|
||||
self._ready.set(.single(true))
|
||||
|
||||
@@ -138,6 +138,8 @@ private enum LocationPickerEntry: Comparable, Identifiable {
|
||||
if let coordinate = coordinate {
|
||||
interaction?.sendLocation(coordinate)
|
||||
}
|
||||
}, highlighted: { highlighted in
|
||||
interaction?.updateSendActionHighlight(highlighted)
|
||||
})
|
||||
case let .liveLocation(theme, title, subtitle, coordinate):
|
||||
return LocationActionListItem(presentationData: ItemListPresentationData(presentationData), account: account, title: title, subtitle: subtitle, icon: .liveLocation, action: {
|
||||
@@ -218,9 +220,7 @@ final class LocationPickerControllerNode: ViewControllerTracingNode {
|
||||
|
||||
private var validLayout: (layout: ContainerViewLayout, navigationHeight: CGFloat)?
|
||||
private var listOffset: CGFloat?
|
||||
|
||||
var present: ((ViewController, Any?) -> Void)?
|
||||
|
||||
|
||||
init(context: AccountContext, presentationData: PresentationData, mode: LocationPickerMode, interaction: LocationPickerInteraction) {
|
||||
self.context = context
|
||||
self.presentationData = presentationData
|
||||
@@ -606,4 +606,8 @@ final class LocationPickerControllerNode: ViewControllerTracingNode {
|
||||
searchContainerNode.containerLayoutUpdated(ContainerViewLayout(size: layout.size, metrics: LayoutMetrics(), deviceMetrics: layout.deviceMetrics, intrinsicInsets: layout.intrinsicInsets, safeInsets: layout.safeInsets, statusBarHeight: nil, inputHeight: layout.inputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver), navigationBarHeight: navigationHeight, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
func updateSendActionHighlight(_ highlighted: Bool) {
|
||||
self.headerNode.updateHighlight(highlighted)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LocationMessageLiveIcon@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LocationMessageLiveIcon@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB |
12
submodules/TelegramUI/Images.xcassets/Location/SendLiveLocationIcon.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Location/SendLiveLocationIcon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_mappinlive.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
submodules/TelegramUI/Images.xcassets/Location/SendLiveLocationIcon.imageset/ic_mappinlive.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Location/SendLiveLocationIcon.imageset/ic_mappinlive.pdf
vendored
Normal file
Binary file not shown.
12
submodules/TelegramUI/Images.xcassets/Location/SendLocationIcon.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Location/SendLocationIcon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "ic_mappin.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
submodules/TelegramUI/Images.xcassets/Location/SendLocationIcon.imageset/ic_mappin.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Location/SendLocationIcon.imageset/ic_mappin.pdf
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user