mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various Fixes
This commit is contained in:
@@ -81,6 +81,7 @@
|
||||
- (void)animateOut:(BOOL)toSmallSize;
|
||||
- (void)addMicLevel:(CGFloat)level;
|
||||
- (void)dismiss;
|
||||
- (void)reset;
|
||||
|
||||
- (void)updateOverlay;
|
||||
|
||||
|
||||
@@ -869,6 +869,11 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reset {
|
||||
_targetTranslation = 0.0;
|
||||
[self updateOverlay];
|
||||
}
|
||||
|
||||
- (void)addMicLevel:(CGFloat)level {
|
||||
_inputLevel = level;
|
||||
[_decoration updateLevel:level];
|
||||
|
||||
@@ -1167,10 +1167,17 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
}
|
||||
|
||||
var scrollAnimationCurve: ListViewAnimationCurve? = nil
|
||||
if let strongSelf = self, strongSelf.appliedPlayingMessageId != currentlyPlayingMessageId, let currentlyPlayingMessageId = currentlyPlayingMessageId {
|
||||
updatedScrollPosition = .index(index: .message(currentlyPlayingMessageId), position: .center(.bottom), directionHint: .Down, animated: true, highlight: true)
|
||||
if let strongSelf = self, case .default = source {
|
||||
if strongSelf.appliedPlayingMessageId != currentlyPlayingMessageId, let currentlyPlayingMessageId = currentlyPlayingMessageId {
|
||||
if isFirstTime {
|
||||
} else if case let .peer(peerId) = chatLocation, currentlyPlayingMessageId.id.peerId != peerId {
|
||||
} else {
|
||||
updatedScrollPosition = .index(index: .message(currentlyPlayingMessageId), position: .center(.bottom), directionHint: .Up, animated: true, highlight: true)
|
||||
scrollAnimationCurve = .Spring(duration: 0.4)
|
||||
}
|
||||
}
|
||||
isFirstTime = false
|
||||
}
|
||||
|
||||
var disableAnimations = false
|
||||
|
||||
|
||||
@@ -98,6 +98,8 @@ private final class ChatTextInputMediaRecordingButtonPresenter : NSObject, TGMod
|
||||
private let presentController: (ViewController) -> Void
|
||||
let container: ChatTextInputMediaRecordingButtonPresenterContainer
|
||||
private var presentationController: ChatTextInputMediaRecordingButtonPresenterController?
|
||||
private var timer: SwiftSignalKit.Timer?
|
||||
fileprivate weak var button: ChatTextInputMediaRecordingButton?
|
||||
|
||||
init(account: Account, presentController: @escaping (ViewController) -> Void) {
|
||||
self.account = account
|
||||
@@ -111,6 +113,7 @@ private final class ChatTextInputMediaRecordingButtonPresenter : NSObject, TGMod
|
||||
presentationController.presentingViewController?.dismiss(animated: false, completion: {})
|
||||
self.presentationController = nil
|
||||
}
|
||||
self.timer?.invalidate()
|
||||
}
|
||||
|
||||
func view() -> UIView! {
|
||||
@@ -124,6 +127,14 @@ private final class ChatTextInputMediaRecordingButtonPresenter : NSObject, TGMod
|
||||
func present() {
|
||||
if let keyboardWindow = LegacyComponentsGlobals.provider().applicationKeyboardWindow(), !keyboardWindow.isHidden {
|
||||
keyboardWindow.addSubview(self.container)
|
||||
|
||||
self.timer = SwiftSignalKit.Timer(timeout: 0.05, repeat: true, completion: { [weak self] in
|
||||
if let keyboardWindow = LegacyComponentsGlobals.provider().applicationKeyboardWindow(), !keyboardWindow.isHidden {
|
||||
} else {
|
||||
self?.present()
|
||||
}
|
||||
}, queue: Queue.mainQueue())
|
||||
self.timer?.start()
|
||||
} else {
|
||||
var presentNow = false
|
||||
if self.presentationController == nil {
|
||||
@@ -137,10 +148,16 @@ private final class ChatTextInputMediaRecordingButtonPresenter : NSObject, TGMod
|
||||
if let presentationController = self.presentationController, presentNow {
|
||||
self.presentController(presentationController)
|
||||
}
|
||||
|
||||
if let timer = self.timer {
|
||||
self.button?.reset()
|
||||
timer.invalidate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func dismiss() {
|
||||
self.timer?.invalidate()
|
||||
self.container.removeFromSuperview()
|
||||
if let presentationController = self.presentationController {
|
||||
presentationController.presentingViewController?.dismiss(animated: false, completion: {})
|
||||
@@ -171,7 +188,7 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
|
||||
|
||||
private var recordingOverlay: ChatTextInputAudioRecordingOverlay?
|
||||
private var startTouchLocation: CGPoint?
|
||||
private(set) var controlsOffset: CGFloat = 0.0
|
||||
fileprivate var controlsOffset: CGFloat = 0.0
|
||||
private(set) var cancelTranslation: CGFloat = 0.0
|
||||
|
||||
private var micLevelDisposable: MetaDisposable?
|
||||
@@ -426,6 +443,7 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
|
||||
|
||||
func micButtonPresenter() -> TGModernConversationInputMicButtonPresentation! {
|
||||
let presenter = ChatTextInputMediaRecordingButtonPresenter(account: self.account!, presentController: self.presentController)
|
||||
presenter.button = self
|
||||
self.currentPresenter = presenter.view()
|
||||
return presenter
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user