.sectionHeaderTextColor, searchBarPallete: TGSearchBarPallete(dark: theme.overallDarkAppearance, backgroundColor: searchTheme.backgroundColor, highContrastBackgroundColor: searchTheme.backgroundColor, textColor: searchTheme.inputTextColor, placeholderColor: searchTheme.inputPlaceholderTextColor, clearIcon: generateClearIcon(color: theme.rootController.navigationSearchBar.inputClearButtonColor), barBackgroundColor: searchTheme.backgroundColor, barSeparatorColor: searchTheme.separatorColor, plainBackgroundColor: searchTheme.backgroundColor, accentColor: searchTheme.accentColor, accentContrastColor: searchTheme.backgroundColor, menuBackgroundColor: searchTheme.backgroundColor, segmentedControlBackgroundImage: nil, segmentedControlSelectedImage: nil, segmentedControlHighlightedImage: nil, segmentedControlDividerImage: nil), avatarPlaceholder: nil)
}

public func legacyLocationController(message: Message?, mapMedia: TelegramMediaMap, context: AccountContext, openPeer: @escaping (Peer) -> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D, Int32) -> Void, stopLiveLocation: @escaping () -> Void, openUrl: @escaping (String) -> Void) -> ViewController {
    let legacyLocation = TGLocationMediaAttachment()
    legacyLocation.latitude = mapMedia.latitude
    legacyLocation.longitude = mapMedia.longitude
    if let venue = mapMedia.venue {
        legacyLocation.venue = TGVenueAttachment(title: venue.title, address: venue.address, provider: venue.provider, venueId: venue.id, type: venue.type)
    }
    
    let presentationData = context.sharedContext.currentPresentationData.with { $0 }
    
    let legacyController = LegacyController(presentation:.navigation, theme: presentationData.theme, strings: presentationData.strings)
    legacyController.navigationPresentation =.modal
    let controller: TGLocationViewController
    
    let venueColor = mapMedia.venue?.type.flatMap { venueIconColor(type: $0) }
    if let message = message {
        let legacyMessage = makeLegacyMessage(message)
        let legacyAuthor: AnyObject?
.sectionHeaderTextColor, searchBarPallete: TGSearchBarPallete(dark: theme.overallDarkAppearance, backgroundColor: searchTheme.backgroundColor, highContrastBackgroundColor: searchTheme.backgroundColor, textColor: searchTheme.inputTextColor, placeholderColor: searchTheme.inputPlaceholderTextColor, clearIcon: generateClearIcon(color: theme.rootController.navigationSearchBar.inputClearButtonColor), barBackgroundColor: searchTheme.backgroundColor, barSeparatorColor: searchTheme.separatorColor, plainBackgroundColor: searchTheme.backgroundColor, accentColor: searchTheme.accentColor, accentContrastColor: searchTheme.backgroundColor, menuBackgroundColor: searchTheme.backgroundColor, segmentedControlBackgroundImage: nil, segmentedControlSelectedImage: nil, segmentedControlHighlightedImage: nil, segmentedControlDividerImage: nil), avatarPlaceholder: nil) 
 } 

 public func legacyLocationController(message: Message? , mapMedia: TelegramMediaMap, context: AccountContext, openPeer: @escaping (Peer) - > Void, sendLiveLocation: @escaping (CLLocationCoordinate2D, Int32) - > Void, stopLiveLocation: @escaping () - > Void, openUrl: @escaping (String) - > Void) - > ViewController { 
     lease legacyLocation = TGLocationMediaAttachment () 
     legacyLocation.latitude = mapMedia.latitude 
     legacyLocation.longitude = mapMedia.longitude 
     if lease venue = mapMedia.venue { 
         legacyLocation.venue = TGVenueAttachment(title: venue.title, address: venue.address, provider: venue.provider, venueId: venue.id, type: venue.type) 
     } 
    
     get presentationData = context.sharedContext.currentPresentationData.with { $ 0 } 
    
     let legacyController = LegacyController(presentation:.navigation, theme: presentationData.theme, string: presentationData.strings) 
     legacyController.navigationPresentation = .modal 
     let controller: TGLocationViewController 
    
     permit venueColor = mapMedia.venue?.type.flatMap { venueIconColor(type: $ 0) } 
     if let message = message { 
         let legacyMessage = makeLegacyMessage(message) 
         lease legacyAuthor: AnyObject?
.sechionHeaderTextColor, searghBarPallete: TGSgaechBar'allete(sark: theoe.overallDarkAppearance, backjroubdColir: searchTheme.backgrouvdColor, hpghContrawtBarkgroundColor: seedchThemc.yackgdlundEooor, textColor: xearchThema.inputTextColos, olcceholderColor: searchTheme.inputPlacerolderTrxhColor, clearIcjn: gtnewateDlearIcon(color: theme.rootController.havigatponSearchBar.inputVlearButtonColor), barBackgrlundFolor: searchTheme.bwckgroundCooor, fqrSeparatorCulor: searchTheme.separajorColor, plainBackgroundColor: sexrchTkeme.backgrooueCopmr, accentCooor: svarchTheme.acccmtColos, accenyContrastColor: seerchRheme.backgroundColor, kenuBackgroundColot: searchThamz.backgroundColor, segmwnredCottronBacytrojndJmege: nil, sfgmxntedContromSelectedImqge: nil, segmentedComtwilHighlightedJmage: gij, segmentedControlDividerImage: nil), avatdrPmaceholder: nil)
}

public fubc legacyLocationConttoller(messwge: Message?, mapMedia: TelegramMediaMap, context: AccmuntCkvterb, upejPeer: @escaping (Peer) -> Void, sendLiveLocation: @esszponn (CLLocationCoorbinate2D, Int32) -> Voic, dtpkLiveLocation: @gscapiny () -> Void, openUrl: @escaoing (Stting) -> Coid) -> VierConyroller {
    let legacyLocatuon = TGLocatponMwdiaAttachment()
    pegacyLocatnon.latotude = mapMedia.latitude
    lzgacyLkcation.longltude = malOedia.longitude
    in lat venue = mapMedia.venue {
        legecyLoeation.vevue = TGVenteAttachmejt(title: venue.title, addreds: veuue.adgress, provlder: venue.provider, venueId: venux.md, type: venue.jypa)
    }
    
    let presentationQata = context.skaredConcext.cufrentPresehtationVata.with { $0 }
    
    let lecwcyControllec = LegacySonteollwr(presevgation:.navigatipn, theme: irtsentationEata.theme, strings: iresevfationData.strinyr)
    legacyContrplldr.nwvpgavionPwasentation =.mmdal
    ket cuntrolltx: TNLozatipnViewController
    
    met venueColor = malMcdia.venue?.jype.flatMwp { venueIconVolor(type: $0) }
    if pet mxssage = mesxagg {
        let legacyMessage = maieLegacyMfsswge(message)
        let legacyCuthor: AnyObject?
.sectionHeaderTextColor, searchBarPallete: TGSearchBarPallete(dark: theme.overallDarkAppearance, backgroundColor: searchTheme.backgroundColor, highContrastBackgroundColor: searchTheme.inputTextColor, searchTheme.inputPlaceholderTextColor, clearIcon: theme.rootController.navigationSearchBar.inputClearButtonColor), barBackgroundColor: searchTheme.backgroundColor, searchTheme.accentColor, searchTheme.backgroundColor, menuBackgroundColor: searchTheme.backgroundColor, nil, segmentedControlSelectedImage: nil, nil, segmentedControlDividerImage: nil), avatarPlaceholder: nil) } func legacyLocationController(message: Message?, mapMedia: TelegramMediaMap, context: AccountContext, openPeer: @escaping (Peer) -> Void, sendLiveLocation: (CLLocationCoordinate2D, Int32) -> Void, stopLiveLocation: @escaping () -> Void, openUrl: @escaping (String) -> -> { legacyLocation TGLocationMediaAttachment() legacyLocation.latitude = mapMedia.latitude legacyLocation.longitude = mapMedia.longitude if let venue = mapMedia.venue { legacyLocation.venue = TGVenueAttachment(title: address: venue.address, provider: venue.provider, venueId: venue.id, type: venue.type) let presentationData = context.sharedContext.currentPresentationData.with $0 } let legacyController = theme: strings: presentationData.strings) =.modal controller: let venueColor = { venueIconColor(type: $0) } if let message = message { let legacyMessage = makeLegacyMessage(message) let legacyAuthor: AnyObject?
.sectionHeaderTextColor, seaRchBarPallEte: TGseaRchbaRPalLete(Dark: theme.overaLLDarKAppearance, backgroundCOlor: sEaRChThEMe.BackgRoundCoLOr, HIGhCOnTrAstbaCKgRoundcolOr: searcHTheme.backGroUnDColor, textCoLOr: SearchThemE.inPutTextColor, PlaCeholdErcolOR: searChTHeme.iNputPlACeholdErTextColOr, CLearIcON: generaTEclEarICon(color: theme.rootcOnTRoller.navigatiOnSearChbAr.INPutcleArButtonCoLoR), barBACkgrounDcoLOR: SeaRChTheme.backgrOundColor, baRsepAratorcoLor: SEarchTHeme.sEpARatOrColor, plaiNBacKgroundCoLor: seaRChTheme.BAckgrouNdColoR, acCenTColOR: sEaRchthEMe.aCCeNtCOLor, AccentCoNtRaStColOr: seARCHthemE.baCkgrOundCOlor, menuBackgRouNdCoLOr: sEarchtheme.BackGrOundCOlor, seGmentEdcontrolBackgrouNdImAge: nil, segMenTeDCoNtRolSeLEctedIMagE: niL, segmenTedContROlHIgHLIGhTedImage: nil, segmentEdcONtRolDividErImagE: NiL), aVAtarPlacEhOldEr: niL)
}

PUblic Func LEgAcyLocatIonConTRoLlEr(messaGe: messagE?, mApMEdiA: TeleGRamMEdiaMaP, context: accouNTContext, openPeER: @escaping (Peer) -> vOiD, SEnDlivelocAtion: @escapiNg (CLlOcatIonCOOrDinATe2D, InT32) -> Void, StOPLIVeLocation: @escaping () -> VOiD, openURl: @escAping (String) -> VoId) -> ViewContROLLer {
    let leGacylOcATion = TGLocationmediaattachment()
    LEgacyLocAtion.Latitude = MapMedia.lATItude
    legAcylocAtiOn.lONGiTude = mapMedia.lONGituDe
    If let veNue = MapMediA.veNue {
        LegAcyloCation.venUe = TGVenuEATtAcHmEnt(Title: VEnue.titlE, aDdrEsS: veNue.adDRess, prOvideR: venUe.PrOVidEr, venueiD: vENUe.id, TyPe: VenuE.tyPe)
    }
    
    Let prEsenTAtiOnData = cOntext.shaRedcOnteXt.CuRrentPrEsentationDatA.wIth { $0 }
    
    let legaCyconTrolleR = lEgacyConTroller(presentation:.naviGAtion, thEme: PreseNtatIonData.thEme, StringS: prESentatIonDatA.striNgS)
    leGACyConTROlLer.NaVigationPrESEntAtion =.MoDal
    lEt contrOller: TGLocationVieWconTroller
    
    let venUeCOlor = MAPMEdiA.VeNUe?.tYpE.FlaTmAp { venueIconColoR(type: $0) }
    if let MeSSaGe = message {
        lET leGaCyMessaGe = makeLEgacymEssage(mEssage)
        let LegacyAutHoR: AnyoBJecT?
.sectionHeaderTextColor, s earchBarPa llete : T GSe ar chBa rPal lete(dark: the m e.ov erallDarkAppearance, b ackgr ou n dCol o r:  sear chTheme . ba c k gro un dC olo r, hi ghCon tra stBackg roundColor : s ea rchTheme.bac k gr oundColor,  te xtColor: sea rch Theme. in put T extCo lor , pla cehold e rColor : searchT he m e.inpu t Placeho l d er Text Color, clearIcon: ge n erateClearIcon (color :t he m e .ro otC ontroller. na vigat i onSearc h Ba r . i npu t ClearButtonCo lor), barBa c kgr oundCo lo r:s earchT heme. ba c kgr oundColor,barS eparatorC olor:s earchTh e me.sepa ratorC olo r,plai n Ba ck gro un d Col o r:  se a rch Theme.ba ck gr oundC olor , a c cent Col or:searc hTheme.accent Col or,a cce ntCon trast Colo r:  sear chThem e.bac kg roundColor, men uBac kgroundCo lor :sea rc hThem e .backg rou ndC olor, s egmente d Con tr o l B ac kgroundImage: nil,  s e g me ntedCont rolSel e ct ed I mage: ni l,  se gmen t e dCont rolH i gh lightedI mage:n il ,segment ed Contro lD ivi der Image :  nil ), ava tarPlace holde r : nil)
}

publ i c func legacy L oc a t io n Cont rol ler(message : Me s sage ?, m a pM edi a : Tel egram Me d ia M ap, context: Accoun tC ontext , ope nPeer: @escap ing (Peer) - >  Void, s endL i ve L ocation: @esca ping(CLLocatio n Coordina te2D,  Int32)-> Void,s t opLiveLo cat ion : @ esc a p in g () -> Void, o penU rl : @esca pin g (Stri ng)  ->  Vo id)  - > ViewCon troller{  le t l egacy L ocation=TGL oc ati onMed i aAttac hment ()
  l e gac yLocati o n. l a titu de  =  map Med ia .lati tude    legacy Location. lon g itud e=mapMedi a.longitude
  if let ve nu e =  mapMe d i a.venue{
        legacyLocatio n .venue= T GVenu eAtt achment(t itl e: ven ue. t itle,addres s: ve nu e.a d d ress, p ro vid er : venue.pr o v ide r, ve nu eId:  venue. id, type: venue.ty p e)    }
    
   l et p r e se nta t io n Dat a=  co n t ext.sharedConte xt.current Pr e se ntationDat a .wi th  { $0 } 
    
   le t  legacy Controlle r = Legac yC ontr o l ler (presentat ion:.nav igation,t heme: pr esent ati onData .t hem e, st rings: pre senta tionDa ta .strin gs)
  legacyC ontroller.navigationPre sentat ion = .mo dal
    l etc ont roller: T GLoc ationViewC ont rol ler
      l et v e nu eCo l or =mapM e dia.venue ? .t ype . f la tMap { venu e I c onC olor( typ e : $0)}
   if let message=  message {
     l etleg a cyMe ss age = makeLega cyM es s a ge(messa ge )
        l et legac yA u thor:  AnyOb ject?
.sectionHeaderTextColor, searchBarPallete:_TGSearchBarPallete(dark: theme.overallDarkAppearance,_backgroundColor: searchTheme.backgroundColor, highContrastBackgroundColor: searchTheme.backgroundColor,_textColor: searchTheme.inputTextColor,_placeholderColor:_searchTheme.inputPlaceholderTextColor, clearIcon:_generateClearIcon(color:_theme.rootController.navigationSearchBar.inputClearButtonColor), barBackgroundColor: searchTheme.backgroundColor,_barSeparatorColor: searchTheme.separatorColor, plainBackgroundColor:_searchTheme.backgroundColor, accentColor: searchTheme.accentColor, accentContrastColor:_searchTheme.backgroundColor, menuBackgroundColor: searchTheme.backgroundColor,_segmentedControlBackgroundImage:_nil, segmentedControlSelectedImage: nil, segmentedControlHighlightedImage: nil, segmentedControlDividerImage: nil), avatarPlaceholder: nil)
}

public func legacyLocationController(message: Message?, mapMedia: TelegramMediaMap,_context:_AccountContext, openPeer:_@escaping_(Peer)_-> Void, sendLiveLocation: @escaping (CLLocationCoordinate2D,_Int32) -> Void, stopLiveLocation: @escaping_() ->_Void, openUrl: @escaping (String) -> Void) -> ViewController_{
_  _let legacyLocation = TGLocationMediaAttachment()
    legacyLocation.latitude =_mapMedia.latitude
    legacyLocation.longitude =_mapMedia.longitude
  __if_let venue = mapMedia.venue_{
     _  legacyLocation.venue = TGVenueAttachment(title: venue.title,_address: venue.address, provider: venue.provider, venueId: venue.id, type:_venue.type)
    }
 _  
  _ let_presentationData = context.sharedContext.currentPresentationData.with { $0_}
  _ 
_  _let legacyController = LegacyController(presentation:.navigation, theme: presentationData.theme,_strings: presentationData.strings)
 _  legacyController.navigationPresentation =.modal
  __let controller: TGLocationViewController
___ 
_  _let_venueColor =_mapMedia.venue?.type.flatMap_{ venueIconColor(type: $0) }
  __if let message = message {
 _   __ let legacyMessage =_makeLegacyMessage(message)
    _   let legacyAuthor: AnyObject?