Fix merge conflicts

This commit is contained in:
Isaac 2024-06-07 15:44:12 +04:00
parent a2bbf58b76
commit 26b539041d
7 changed files with 31 additions and 22 deletions

View File

@ -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 {

View File

@ -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)
}
)),

View File

@ -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 {

View File

@ -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 {

View File

@ -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 })

View File

@ -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,

View File

@ -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 {