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