mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Present undo in current context
This commit is contained in:
parent
b76c0b457e
commit
88aa22a8e4
@ -202,6 +202,7 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)?
|
var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)?
|
||||||
|
var presentInCurrentControllerImpl: ((ViewController) -> Void)?
|
||||||
var pushControllerImpl: ((ViewController) -> Void)?
|
var pushControllerImpl: ((ViewController) -> Void)?
|
||||||
var dismissImpl: (() -> Void)?
|
var dismissImpl: (() -> Void)?
|
||||||
var getController: (() -> ViewController?)?
|
var getController: (() -> ViewController?)?
|
||||||
@ -248,7 +249,16 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .autoDelete(isOn: isOn, title: nil, text: text), elevatedLayout: false, animateInAsReplacement: animateAsReplacement, action: { _ in return false }), nil)
|
if let current = getController?() {
|
||||||
|
current.forEachController { other in
|
||||||
|
if let other = other as? UndoOverlayController {
|
||||||
|
animateAsReplacement = true
|
||||||
|
other.dismiss()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
presentInCurrentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .autoDelete(isOn: isOn, title: nil, text: text), elevatedLayout: false, animateInAsReplacement: animateAsReplacement, action: { _ in return false }))
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTimeoutDisposable.set((context.engine.privacy.updateGlobalMessageRemovalTimeout(timeout: timeout == 0 ? nil : timeout)
|
updateTimeoutDisposable.set((context.engine.privacy.updateGlobalMessageRemovalTimeout(timeout: timeout == 0 ? nil : timeout)
|
||||||
@ -391,7 +401,16 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .autoDelete(isOn: isOn, title: nil, text: text), elevatedLayout: false, animateInAsReplacement: animateAsReplacement, action: { _ in return false }), nil)
|
if let current = getController?() {
|
||||||
|
current.forEachController { other in
|
||||||
|
if let other = other as? UndoOverlayController {
|
||||||
|
animateAsReplacement = true
|
||||||
|
other.dismiss()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
presentInCurrentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .autoDelete(isOn: isOn, title: nil, text: text), elevatedLayout: false, animateInAsReplacement: animateAsReplacement, action: { _ in return false }))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -432,6 +451,12 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32,
|
|||||||
}
|
}
|
||||||
controller.present(c, in: .window(.root), with: p)
|
controller.present(c, in: .window(.root), with: p)
|
||||||
}
|
}
|
||||||
|
presentInCurrentControllerImpl = { [weak controller] c in
|
||||||
|
guard let controller else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
controller.present(c, in: .current, with: nil)
|
||||||
|
}
|
||||||
pushControllerImpl = { [weak controller] c in
|
pushControllerImpl = { [weak controller] c in
|
||||||
controller?.push(c)
|
controller?.push(c)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user