mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
93265ce74d
commit
9abee7dc1f
@ -567,12 +567,12 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
let resetText: String
|
||||
let interval = pendingDate - currentTime
|
||||
if interval <= 0 {
|
||||
resetText = "Please wait..."
|
||||
resetText = self.strings.Login_Email_ResetingNow
|
||||
} else if interval < 60 * 60 * 24 {
|
||||
let minutes = interval / 60
|
||||
let seconds = interval % 60
|
||||
let timeString = NSString(format: "%d:%.02d", Int(minutes), Int(seconds))
|
||||
resetText = "in \(timeString)"
|
||||
let timeString = String(format: "%d:%.02d", Int(minutes), Int(seconds))
|
||||
resetText = self.strings.Login_Email_ElapsedTime(timeString).string
|
||||
} else {
|
||||
resetText = unmuteIntervalString(strings: self.strings, value: interval)
|
||||
}
|
||||
|
@ -176,9 +176,12 @@ private final class ChatTextLinkEditAlertContentNode: AlertContentNode {
|
||||
return self.isUserInteractionEnabled
|
||||
}
|
||||
|
||||
private var isEditing = false
|
||||
|
||||
init(theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, actions: [TextAlertAction], text: String, link: String?) {
|
||||
self.strings = strings
|
||||
self.text = text
|
||||
self.isEditing = link != nil
|
||||
|
||||
self.titleNode = ASTextNode()
|
||||
self.titleNode.maximumNumberOfLines = 2
|
||||
@ -264,7 +267,7 @@ private final class ChatTextLinkEditAlertContentNode: AlertContentNode {
|
||||
}
|
||||
|
||||
override func updateTheme(_ theme: AlertControllerTheme) {
|
||||
self.titleNode.attributedText = NSAttributedString(string: self.strings.TextFormat_AddLinkTitle, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
|
||||
self.titleNode.attributedText = NSAttributedString(string: self.isEditing ? self.strings.TextFormat_EditLinkTitle : self.strings.TextFormat_AddLinkTitle, font: Font.bold(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
|
||||
self.textNode.attributedText = NSAttributedString(string: self.strings.TextFormat_AddLinkText(self.text).string, font: Font.regular(13.0), textColor: theme.primaryColor, paragraphAlignment: .center)
|
||||
|
||||
self.actionNodesSeparator.backgroundColor = theme.separatorColor
|
||||
|
@ -136,9 +136,12 @@ private class TextField: UITextField, UIScrollViewDelegate {
|
||||
return super.becomeFirstResponder()
|
||||
}
|
||||
|
||||
private var prefixPosition: CGFloat?
|
||||
private func updatePrefixPosition(transition: ContainedViewLayoutTransition = .immediate) {
|
||||
if let scrollView = self.scrollView {
|
||||
transition.updateFrame(node: self.prefixLabel, frame: CGRect(origin: CGPoint(x: -scrollView.contentOffset.x - scrollView.contentInset.left, y: self.prefixLabel.frame.minY), size: self.prefixLabel.frame.size))
|
||||
let prefixPosition = -scrollView.contentOffset.x - scrollView.contentInset.left
|
||||
self.prefixPosition = prefixPosition
|
||||
transition.updateFrame(node: self.prefixLabel, frame: CGRect(origin: CGPoint(x: prefixPosition, y: self.prefixLabel.frame.minY), size: self.prefixLabel.frame.size))
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +201,7 @@ private class TextField: UITextField, UIScrollViewDelegate {
|
||||
|
||||
let prefixSize = self.prefixLabel.updateLayout(CGSize(width: floor(bounds.size.width * 0.7), height: bounds.size.height))
|
||||
let prefixBounds = bounds.insetBy(dx: 4.0, dy: 4.0)
|
||||
self.prefixLabel.frame = CGRect(origin: CGPoint(x: prefixBounds.minX, y: floorToScreenPixels((bounds.height - prefixSize.height) / 2.0)), size: prefixSize)
|
||||
self.prefixLabel.frame = CGRect(origin: CGPoint(x: self.prefixPosition ?? prefixBounds.minX, y: floorToScreenPixels((bounds.height - prefixSize.height) / 2.0)), size: prefixSize)
|
||||
self.updatePrefixWidth(prefixSize.width + 3.0)
|
||||
}
|
||||
}
|
||||
@ -510,8 +513,11 @@ private final class ImportStickerPackTitleAlertContentNode: AlertContentNode {
|
||||
|
||||
self.titleNode = ASTextNode()
|
||||
self.titleNode.maximumNumberOfLines = 2
|
||||
self.titleNode.displaysAsynchronously = false
|
||||
|
||||
self.textNode = ASTextNode()
|
||||
self.textNode.maximumNumberOfLines = 8
|
||||
self.textNode.displaysAsynchronously = false
|
||||
|
||||
self.activityIndicator = ActivityIndicator(type: .custom(ptheme.rootController.navigationBar.secondaryTextColor, 20.0, 1.5, false), speed: .slow)
|
||||
self.activityIndicator.isHidden = true
|
||||
|
@ -162,7 +162,7 @@ extension TelegramUser {
|
||||
accessHash = lhs.accessHash ?? rhsAccessHashValue
|
||||
}
|
||||
|
||||
return TelegramUser(id: lhs.id, accessHash: accessHash, firstName: lhs.firstName, lastName: lhs.lastName, username: lhs.username, phone: lhs.phone, photo: telegramPhoto, botInfo: botInfo, restrictionInfo: restrictionInfo, flags: userFlags, emojiStatus: emojiStatus.flatMap(PeerEmojiStatus.init(apiStatus:)), usernames: usernames?.map(TelegramPeerUsername.init(apiUsername:)) ?? [])
|
||||
return TelegramUser(id: lhs.id, accessHash: accessHash, firstName: lhs.firstName, lastName: lhs.lastName, username: lhs.username, phone: lhs.phone, photo: telegramPhoto, botInfo: botInfo, restrictionInfo: restrictionInfo, flags: userFlags, emojiStatus: emojiStatus.flatMap(PeerEmojiStatus.init(apiStatus:)), usernames: lhs.usernames)
|
||||
} else {
|
||||
return TelegramUser(user: rhs)
|
||||
}
|
||||
@ -216,7 +216,7 @@ extension TelegramUser {
|
||||
photo = rhs.photo
|
||||
}
|
||||
|
||||
return TelegramUser(id: lhs.id, accessHash: accessHash, firstName: lhs.firstName, lastName: lhs.lastName, username: lhs.username, phone: lhs.phone, photo: photo, botInfo: botInfo, restrictionInfo: restrictionInfo, flags: userFlags, emojiStatus: emojiStatus, usernames: rhs.usernames)
|
||||
return TelegramUser(id: lhs.id, accessHash: accessHash, firstName: lhs.firstName, lastName: lhs.lastName, username: lhs.username, phone: lhs.phone, photo: photo, botInfo: botInfo, restrictionInfo: restrictionInfo, flags: userFlags, emojiStatus: emojiStatus, usernames: lhs.usernames)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -474,6 +474,7 @@ private final class ForumCreateTopicScreenComponent: CombinedComponent {
|
||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||
|
||||
let context: AccountContext
|
||||
let ready: Promise<Bool>
|
||||
let peerId: EnginePeer.Id
|
||||
let mode: ForumCreateTopicScreen.Mode
|
||||
let titleUpdated: (String) -> Void
|
||||
@ -484,6 +485,7 @@ private final class ForumCreateTopicScreenComponent: CombinedComponent {
|
||||
|
||||
init(
|
||||
context: AccountContext,
|
||||
ready: Promise<Bool>,
|
||||
peerId: EnginePeer.Id,
|
||||
mode: ForumCreateTopicScreen.Mode,
|
||||
titleUpdated: @escaping (String) -> Void,
|
||||
@ -493,6 +495,7 @@ private final class ForumCreateTopicScreenComponent: CombinedComponent {
|
||||
openPremium: @escaping () -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.ready = ready
|
||||
self.peerId = peerId
|
||||
self.mode = mode
|
||||
self.titleUpdated = titleUpdated
|
||||
@ -517,6 +520,7 @@ private final class ForumCreateTopicScreenComponent: CombinedComponent {
|
||||
|
||||
final class State: ComponentState {
|
||||
private let context: AccountContext
|
||||
private let ready: Promise<Bool>
|
||||
private let titleUpdated: (String) -> Void
|
||||
private let iconUpdated: (Int64?) -> Void
|
||||
private let iconColorUpdated: (Int32) -> Void
|
||||
@ -539,8 +543,9 @@ private final class ForumCreateTopicScreenComponent: CombinedComponent {
|
||||
|
||||
private var hasPremium: Bool = false
|
||||
|
||||
init(context: AccountContext, mode: ForumCreateTopicScreen.Mode, titleUpdated: @escaping (String) -> Void, iconUpdated: @escaping (Int64?) -> Void, iconColorUpdated: @escaping (Int32) -> Void, isHiddenUpdated: @escaping (Bool) -> Void, openPremium: @escaping () -> Void) {
|
||||
init(context: AccountContext, ready: Promise<Bool>, mode: ForumCreateTopicScreen.Mode, titleUpdated: @escaping (String) -> Void, iconUpdated: @escaping (Int64?) -> Void, iconColorUpdated: @escaping (Int32) -> Void, isHiddenUpdated: @escaping (Bool) -> Void, openPremium: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.ready = ready
|
||||
self.titleUpdated = titleUpdated
|
||||
self.iconUpdated = iconUpdated
|
||||
self.iconColorUpdated = iconColorUpdated
|
||||
@ -656,6 +661,8 @@ private final class ForumCreateTopicScreenComponent: CombinedComponent {
|
||||
|> deliverOnMainQueue).start(next: { [weak self] content in
|
||||
self?.emojiContent = content
|
||||
self?.updated(transition: .immediate)
|
||||
|
||||
self?.ready.set(.single(true))
|
||||
}))
|
||||
}
|
||||
|
||||
@ -697,6 +704,7 @@ private final class ForumCreateTopicScreenComponent: CombinedComponent {
|
||||
func makeState() -> State {
|
||||
return State(
|
||||
context: self.context,
|
||||
ready: self.ready,
|
||||
mode: self.mode,
|
||||
titleUpdated: self.titleUpdated,
|
||||
iconUpdated: self.iconUpdated,
|
||||
@ -1044,6 +1052,11 @@ public class ForumCreateTopicScreen: ViewControllerComponentContainer {
|
||||
}
|
||||
}
|
||||
|
||||
private let readyValue = Promise<Bool>()
|
||||
override public var ready: Promise<Bool> {
|
||||
return self.readyValue
|
||||
}
|
||||
|
||||
public init(context: AccountContext, peerId: EnginePeer.Id, mode: ForumCreateTopicScreen.Mode) {
|
||||
self.context = context
|
||||
self.mode = mode
|
||||
@ -1054,7 +1067,8 @@ public class ForumCreateTopicScreen: ViewControllerComponentContainer {
|
||||
var isHiddenUpdatedImpl: ((Bool) -> Void)?
|
||||
var openPremiumImpl: (() -> Void)?
|
||||
|
||||
super.init(context: context, component: ForumCreateTopicScreenComponent(context: context, peerId: peerId, mode: mode, titleUpdated: { title in
|
||||
let componentReady = Promise<Bool>()
|
||||
super.init(context: context, component: ForumCreateTopicScreenComponent(context: context, ready: componentReady, peerId: peerId, mode: mode, titleUpdated: { title in
|
||||
titleUpdatedImpl?(title)
|
||||
}, iconUpdated: { fileId in
|
||||
iconUpdatedImpl?(fileId)
|
||||
@ -1082,6 +1096,8 @@ public class ForumCreateTopicScreen: ViewControllerComponentContainer {
|
||||
|
||||
self.title = title
|
||||
|
||||
self.readyValue.set(componentReady.get() |> timeout(0.3, queue: .mainQueue(), alternate: .single(true)))
|
||||
|
||||
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(self.cancelPressed))
|
||||
|
||||
self.doneBarItem = UIBarButtonItem(title: doneTitle, style: .done, target: self, action: #selector(self.createPressed))
|
||||
|
@ -8488,8 +8488,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if let strongSelf = self {
|
||||
if let currentMessage = currentMessage {
|
||||
let currentEntities = currentMessage.textEntitiesAttribute?.entities ?? []
|
||||
if currentMessage.text != text.string || currentEntities != entities || updatingMedia {
|
||||
strongSelf.context.account.pendingUpdateMessageManager.add(messageId: editMessage.messageId, text: text.string, media: media, entities: entitiesAttribute, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview)
|
||||
if currentMessage.text != text.string || currentEntities != entities || updatingMedia || disableUrlPreview {
|
||||
strongSelf.context.account.pendingUpdateMessageManager.add(messageId: editMessage.messageId, text: text.string, media: media, entities: entitiesAttribute, inlineStickers: inlineStickers, disableUrlPreview: disableUrlPreview)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user