From 26b539041d24e2ce10ce6f578f7c995f8c41eab3 Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Fri, 7 Jun 2024 15:44:12 +0400 Subject: [PATCH] Fix merge conflicts --- .../AccountContext/Sources/AccountContext.swift | 2 +- .../Sources/HashtagSearchControllerNode.swift | 2 +- .../ApiUtils/StoreMessage_Telegram.swift | 17 ++++++++++++----- .../Sources/Drawing/CodableDrawingEntity.swift | 3 +-- .../Sources/StorySearchGridScreen.swift | 13 ++++++++----- .../Sources/PeerInfoStoryPaneNode.swift | 10 +++++----- .../StoryItemSetContainerViewSendMessage.swift | 6 +++--- 7 files changed, 31 insertions(+), 22 deletions(-) diff --git a/submodules/AccountContext/Sources/AccountContext.swift b/submodules/AccountContext/Sources/AccountContext.swift index 176347e7c9..c531adf03a 100644 --- a/submodules/AccountContext/Sources/AccountContext.swift +++ b/submodules/AccountContext/Sources/AccountContext.swift @@ -886,7 +886,7 @@ public enum CollectibleItemInfoScreenSubject { public enum StorySearchControllerScope { case query(String) - case location(coordinates: MediaArea.Coordinates, venue: MediaArea.Venue, address: MediaArea.Address?) + case location(coordinates: MediaArea.Coordinates, venue: MediaArea.Venue) } public protocol SharedAccountContext: AnyObject { diff --git a/submodules/HashtagSearchUI/Sources/HashtagSearchControllerNode.swift b/submodules/HashtagSearchUI/Sources/HashtagSearchControllerNode.swift index 55b39a4f9a..54f77a019c 100644 --- a/submodules/HashtagSearchUI/Sources/HashtagSearchControllerNode.swift +++ b/submodules/HashtagSearchUI/Sources/HashtagSearchControllerNode.swift @@ -478,7 +478,7 @@ final class HashtagSearchControllerNode: ASDisplayNode, ASGestureRecognizerDeleg guard let self else { return } - let searchController = self.context.sharedContext.makeStorySearchController(context: self.context, query: self.query, listContext: self.globalStorySearchContext) + let searchController = self.context.sharedContext.makeStorySearchController(context: self.context, scope: .query(self.query), listContext: self.globalStorySearchContext) self.controller?.push(searchController) } )), diff --git a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift index f726bc449b..c6c1321f44 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift @@ -494,12 +494,12 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? { longitude = 0.0 } - var mappedAddress: MediaArea.Address? + var mappedAddress: MapGeoAddress? if let address { switch address { case let .geoPointAddress(_, countryIso2, state, city, street): - mappedAddress = MediaArea.Address( - countryIso2: countryIso2, + mappedAddress = MapGeoAddress( + country: countryIso2, state: state, city: city, street: street @@ -507,7 +507,14 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? { } } - return .venue(coordinates: coodinatesFromApiMediaAreaCoordinates(coordinates), venue: MediaArea.Venue(latitude: latitude, longitude: longitude, venue: nil, queryId: nil, resultId: nil), address: mappedAddress) + return .venue(coordinates: coodinatesFromApiMediaAreaCoordinates(coordinates), venue: MediaArea.Venue( + latitude: latitude, + longitude: longitude, + venue: nil, + address: mappedAddress, + queryId: nil, + resultId: nil + )) case let .mediaAreaVenue(coordinates, geo, title, address, provider, venueId, venueType): let latitude: Double let longitude: Double @@ -546,7 +553,7 @@ func apiMediaAreasFromMediaAreas(_ mediaAreas: [MediaArea], transaction: Transac let coordinates = area.coordinates let inputCoordinates = Api.MediaAreaCoordinates.mediaAreaCoordinates(x: coordinates.x, y: coordinates.y, w: coordinates.width, h: coordinates.height, rotation: coordinates.rotation) switch area { - case let .venue(_, venue, address): + case let .venue(_, venue): if let queryId = venue.queryId, let resultId = venue.resultId { apiMediaAreas.append(.inputMediaAreaVenue(coordinates: inputCoordinates, queryId: queryId, resultId: resultId)) } else if let venueInfo = venue.venue { diff --git a/submodules/TelegramUI/Components/MediaEditor/Sources/Drawing/CodableDrawingEntity.swift b/submodules/TelegramUI/Components/MediaEditor/Sources/Drawing/CodableDrawingEntity.swift index 527be5678f..60bb5521f4 100644 --- a/submodules/TelegramUI/Components/MediaEditor/Sources/Drawing/CodableDrawingEntity.swift +++ b/submodules/TelegramUI/Components/MediaEditor/Sources/Drawing/CodableDrawingEntity.swift @@ -119,8 +119,7 @@ public enum CodableDrawingEntity: Equatable { address: entity.location.address, queryId: entity.queryId, resultId: entity.resultId - ), - address: nil + ) ) case let .sticker(entity): if case let .link(url, _, _, _, _, _, _) = entity.content { diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoStoryGridScreen/Sources/StorySearchGridScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoStoryGridScreen/Sources/StorySearchGridScreen.swift index 4c291ade78..c78ed84d60 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoStoryGridScreen/Sources/StorySearchGridScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoStoryGridScreen/Sources/StorySearchGridScreen.swift @@ -24,13 +24,16 @@ final class StorySearchGridScreenComponent: Component { let context: AccountContext let scope: StorySearchControllerScope + let listContext: SearchStoryListContext? init( context: AccountContext, - scope: StorySearchControllerScope + scope: StorySearchControllerScope, + listContext: SearchStoryListContext? ) { self.context = context self.scope = scope + self.listContext = listContext } static func ==(lhs: StorySearchGridScreenComponent, rhs: StorySearchGridScreenComponent) -> Bool { @@ -98,8 +101,8 @@ final class StorySearchGridScreenComponent: Component { switch component.scope { case let .query(query): paneNodeScope = .search(query: query) - case let .location(coordinates, venue, address): - paneNodeScope = .location(coordinates: coordinates, venue: venue, address: address) + case let .location(coordinates, venue): + paneNodeScope = .location(coordinates: coordinates, venue: venue) } paneNode = PeerInfoStoryPaneNode( @@ -235,10 +238,10 @@ public final class StorySearchGridScreen: ViewControllerComponentContainer { } @objc private func sharePressed() { - guard case let .location(_, venue, _) = self.scope else { + guard case let .location(_, venue) = self.scope else { return } - let locationMap = TelegramMediaMap(latitude: venue.latitude, longitude: venue.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil) + let locationMap = TelegramMediaMap(latitude: venue.latitude, longitude: venue.longitude, heading: nil, accuracyRadius: nil, venue: nil, address: venue.address, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil) let presentationData = self.context.sharedContext.currentPresentationData.with({ $0 }) diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift index 5690d3832c..5b35ef2aa5 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift @@ -1445,7 +1445,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr public enum Scope { case peer(id: EnginePeer.Id, isSaved: Bool, isArchived: Bool) case search(query: String) - case location(coordinates: MediaArea.Coordinates, venue: MediaArea.Venue, address: MediaArea.Address?) + case location(coordinates: MediaArea.Coordinates, venue: MediaArea.Venue) } public struct ZoomLevel { @@ -1667,8 +1667,8 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr self.listSource = PeerStoryListContext(account: context.account, peerId: id, isArchived: isArchived) case let .search(query): self.listSource = SearchStoryListContext(account: context.account, source: .hashtag(query)) - case let .location(coordinates, venue, address): - self.listSource = SearchStoryListContext(account: context.account, source: .location(coordinates: coordinates, venue: venue, address: address)) + case let .location(coordinates, venue): + self.listSource = SearchStoryListContext(account: context.account, source: .mediaArea(.venue(coordinates: coordinates, venue: venue))) } } self.calendarSource = nil @@ -2163,7 +2163,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr self.preloadArchiveListContext = PeerStoryListContext(account: context.account, peerId: context.account.peerId, isArchived: true) } - if case let .location(_, venue, _) = scope, let mapNode = self.mapNode { + if case let .location(_, venue) = scope, let mapNode = self.mapNode { let locationCoordinate = CLLocationCoordinate2D(latitude: venue.latitude, longitude: venue.longitude) var initialMapState = LocationViewState() @@ -2230,7 +2230,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr let subjectLocation = CLLocation(latitude: locationCoordinate.latitude, longitude: locationCoordinate.longitude) let distance = userLocation.flatMap { subjectLocation.distance(from: $0) } - let locationMap = TelegramMediaMap(latitude: locationCoordinate.latitude, longitude: locationCoordinate.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil) + let locationMap = TelegramMediaMap(latitude: locationCoordinate.latitude, longitude: locationCoordinate.longitude, heading: nil, accuracyRadius: nil, venue: nil, address: venue.address, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil) let mapInfoData = MapInfoData( location: locationMap, diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift index 442ebe0e45..4833f9c4ba 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift @@ -2919,7 +2919,7 @@ final class StoryItemSetContainerSendMessage { } if !hashtag.isEmpty { if peerName == nil { - let searchController = component.context.sharedContext.makeStorySearchController(context: component.context, scope: .query(hashtag)) + let searchController = component.context.sharedContext.makeStorySearchController(context: component.context, scope: .query(hashtag), listContext: nil) navigationController.pushViewController(searchController) } else { let searchController = component.context.sharedContext.makeHashtagSearchController(context: component.context, peer: peer.flatMap(EnginePeer.init), query: hashtag, all: true) @@ -3346,7 +3346,7 @@ final class StoryItemSetContainerSendMessage { var actions: [ContextMenuAction] = [] switch mediaArea { - case let .venue(_, venue): + case let .venue(coordinates, venue): let action = { [weak controller, weak view] in let _ = view /*let subject = EngineMessage(stableId: 0, stableVersion: 0, id: EngineMessage.Id(peerId: PeerId(0), namespace: 0, id: 0), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 0, flags: [], tags: [], globalTags: [], localTags: [], customTags: [], forwardInfo: nil, author: nil, text: "", attributes: [], media: [.geo(TelegramMediaMap(latitude: venue.latitude, longitude: venue.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: venue.venue, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil))], peers: [:], associatedMessages: [:], associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:]) @@ -3373,7 +3373,7 @@ final class StoryItemSetContainerSendMessage { } controller?.push(locationController)*/ - let searchController = context.sharedContext.makeStorySearchController(context: context, scope: .location(coordinates: coordinates, venue: venue, address: address)) + let searchController = context.sharedContext.makeStorySearchController(context: context, scope: .location(coordinates: coordinates, venue: venue), listContext: nil) controller?.push(searchController) } if immediate {