mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-07 14:53:35 +00:00
Fix location picker crash
This commit is contained in:
parent
ed41f81398
commit
27a1c1a4b3
@ -95,29 +95,8 @@ public final class LocationPickerController: ViewController {
|
|||||||
strongSelf.searchNavigationContentNode?.updatePresentationData(strongSelf.presentationData)
|
strongSelf.searchNavigationContentNode?.updatePresentationData(strongSelf.presentationData)
|
||||||
strongSelf.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCompactSearchIcon(strongSelf.presentationData.theme), style: .plain, target: strongSelf, action: #selector(strongSelf.searchPressed))
|
strongSelf.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCompactSearchIcon(strongSelf.presentationData.theme), style: .plain, target: strongSelf, action: #selector(strongSelf.searchPressed))
|
||||||
|
|
||||||
strongSelf.controllerNode.updatePresentationData(presentationData)
|
if strongSelf.isNodeLoaded {
|
||||||
})
|
strongSelf.controllerNode.updatePresentationData(presentationData)
|
||||||
|
|
||||||
self.permissionDisposable = (DeviceAccess.authorizationStatus(subject: .location(.send))
|
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] next in
|
|
||||||
guard let strongSelf = self else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
switch next {
|
|
||||||
case .notDetermined:
|
|
||||||
DeviceAccess.authorizeAccess(to: .location(.send), locationManager: strongSelf.locationManager, presentationData: strongSelf.presentationData, present: { c, a in
|
|
||||||
strongSelf.present(c, in: .window(.root), with: a)
|
|
||||||
}, openSettings: {
|
|
||||||
strongSelf.context.sharedContext.applicationBindings.openSettings()
|
|
||||||
})
|
|
||||||
case .denied:
|
|
||||||
strongSelf.controllerNode.updateState { state in
|
|
||||||
var state = state
|
|
||||||
state.forceSelection = true
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -310,6 +289,29 @@ public final class LocationPickerController: ViewController {
|
|||||||
|
|
||||||
self.displayNode = LocationPickerControllerNode(context: self.context, presentationData: self.presentationData, mode: self.mode, interaction: interaction)
|
self.displayNode = LocationPickerControllerNode(context: self.context, presentationData: self.presentationData, mode: self.mode, interaction: interaction)
|
||||||
self.displayNodeDidLoad()
|
self.displayNodeDidLoad()
|
||||||
|
|
||||||
|
self.permissionDisposable = (DeviceAccess.authorizationStatus(subject: .location(.send))
|
||||||
|
|> deliverOnMainQueue).start(next: { [weak self] next in
|
||||||
|
guard let strongSelf = self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch next {
|
||||||
|
case .notDetermined:
|
||||||
|
DeviceAccess.authorizeAccess(to: .location(.send), locationManager: strongSelf.locationManager, presentationData: strongSelf.presentationData, present: { c, a in
|
||||||
|
strongSelf.present(c, in: .window(.root), with: a)
|
||||||
|
}, openSettings: {
|
||||||
|
strongSelf.context.sharedContext.applicationBindings.openSettings()
|
||||||
|
})
|
||||||
|
case .denied:
|
||||||
|
strongSelf.controllerNode.updateState { state in
|
||||||
|
var state = state
|
||||||
|
state.forceSelection = true
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user