mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
f720277d29
commit
a651bb589d
@ -1441,7 +1441,6 @@ public final class ChatListNode: ListView {
|
||||
return
|
||||
}
|
||||
var didBeginSelecting = false
|
||||
var count = 0
|
||||
strongSelf.updateState { [weak self] state in
|
||||
var state = state
|
||||
if state.selectedPeerIds.contains(peer.id) {
|
||||
@ -1457,10 +1456,8 @@ public final class ChatListNode: ListView {
|
||||
self?.reachedSelectionLimit?(Int32(state.selectedPeerIds.count))
|
||||
}
|
||||
}
|
||||
count = state.selectedPeerIds.count
|
||||
return state
|
||||
}
|
||||
strongSelf.selectionCountChanged?(count)
|
||||
if didBeginSelecting {
|
||||
strongSelf.didBeginSelectingChats?()
|
||||
}
|
||||
@ -3461,6 +3458,7 @@ public final class ChatListNode: ListView {
|
||||
if state != self.currentState {
|
||||
self.currentState = state
|
||||
self.statePromise.set(state)
|
||||
self.selectionCountChanged?(state.selectedPeerIds.count)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
let sideInset: CGFloat = params.leftInset + 16.0
|
||||
let rightInset: CGFloat = sideInset + 24.0
|
||||
var titleRightInset = rightInset
|
||||
var titleRightInset = rightInset - 4.0
|
||||
let verticalInset: CGFloat = 9.0
|
||||
var spacing: CGFloat = 0.0
|
||||
|
||||
|
@ -1094,6 +1094,15 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
|
||||
additionalTitleInset += arrowButtonImage.size.width + 4.0
|
||||
}
|
||||
|
||||
var actionButtonTitleLayoutAndApply: (TextNodeLayout, () -> TextNode)?
|
||||
if let buttonAction = item.buttonAction {
|
||||
actionButtonTitleLayoutAndApply = makeActionButtonTitleLayuout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: buttonAction.title, font: Font.semibold(15.0), textColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
if let (actionButtonTitleLayout, _) = actionButtonTitleLayoutAndApply {
|
||||
additionalTitleInset += actionButtonTitleLayout.size.width + 32.0
|
||||
}
|
||||
}
|
||||
|
||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(0.0, params.width - leftInset - rightInset - additionalTitleInset), height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
var maxStatusWidth: CGFloat = params.width - leftInset - rightInset - badgeSize
|
||||
@ -1123,11 +1132,6 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
|
||||
statusHeightComponent = -1.0 + statusLayout.size.height
|
||||
}
|
||||
|
||||
var actionButtonTitleLayoutAndApply: (TextNodeLayout, () -> TextNode)?
|
||||
if let buttonAction = item.buttonAction {
|
||||
actionButtonTitleLayoutAndApply = makeActionButtonTitleLayuout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: buttonAction.title, font: Font.semibold(15.0), textColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
}
|
||||
|
||||
let nodeLayout = ListViewItemNodeLayout(contentSize: CGSize(width: params.width, height: verticalInset * 2.0 + titleLayout.size.height + statusHeightComponent), insets: UIEdgeInsets(top: firstWithHeader ? 29.0 : 0.0, left: 0.0, bottom: 0.0, right: 0.0))
|
||||
|
||||
let titleFrame: CGRect
|
||||
|
@ -661,7 +661,7 @@ final class GiftOptionsScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
)
|
||||
controller.present(alertController, in: .window(.root))
|
||||
controller.present(alertController, in: .current)
|
||||
|
||||
dismissAlertImpl = { [weak alertController] in
|
||||
alertController?.dismissAnimated()
|
||||
|
@ -6376,6 +6376,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
isPremiumRequiredForMessaging = .single(false)
|
||||
}
|
||||
|
||||
let globalPrivacySettings = context.engine.data.get(TelegramEngine.EngineData.Item.Configuration.GlobalPrivacy())
|
||||
|
||||
self.titleDisposable.set(nil)
|
||||
self.peerDisposable.set((combineLatest(queue: Queue.mainQueue(),
|
||||
peerView,
|
||||
@ -6386,9 +6388,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
hasSearchTags,
|
||||
hasSavedChats,
|
||||
isPremiumRequiredForMessaging,
|
||||
managingBot
|
||||
managingBot,
|
||||
globalPrivacySettings
|
||||
)
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] peerView, messageAndTopic, savedMessagesPeer, onlineMemberCount, hasScheduledMessages, hasSearchTags, hasSavedChats, isPremiumRequiredForMessaging, managingBot in
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] peerView, messageAndTopic, savedMessagesPeer, onlineMemberCount, hasScheduledMessages, hasSearchTags, hasSavedChats, isPremiumRequiredForMessaging, managingBot, globalPrivacySettings in
|
||||
if let strongSelf = self {
|
||||
strongSelf.hasScheduledMessages = hasScheduledMessages
|
||||
|
||||
@ -6407,7 +6410,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
businessIntro = value
|
||||
}
|
||||
if cachedData.disallowedGifts != .All {
|
||||
alwaysShowGiftButton = cachedData.flags.contains(.displayGiftButton)
|
||||
alwaysShowGiftButton = globalPrivacySettings.displayGiftButton || cachedData.flags.contains(.displayGiftButton)
|
||||
}
|
||||
disallowedGifts = cachedData.disallowedGifts
|
||||
} else if let cachedData = peerView.cachedData as? CachedGroupData {
|
||||
|
@ -3049,7 +3049,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
}
|
||||
}
|
||||
)
|
||||
controller.present(alertController, in: .window(.root))
|
||||
controller.present(alertController, in: .current)
|
||||
|
||||
dismissAlertImpl = { [weak alertController] in
|
||||
alertController?.dismissAnimated()
|
||||
|
@ -32,6 +32,7 @@ final class PeerNameColorChatPreviewItem: ListViewItem, ItemListItem, ListItemCo
|
||||
let text: String
|
||||
let entities: TextEntitiesMessageAttribute?
|
||||
let media: [Media]
|
||||
let replyMarkup: ReplyMarkupMessageAttribute?
|
||||
let botAddress: String
|
||||
}
|
||||
|
||||
@ -202,6 +203,9 @@ final class PeerNameColorChatPreviewItemNode: ListViewItemNode {
|
||||
if let entities = messageItem.entities {
|
||||
attributes.append(entities)
|
||||
}
|
||||
if let replyMarkup = messageItem.replyMarkup {
|
||||
attributes.append(replyMarkup)
|
||||
}
|
||||
|
||||
attributes.append(InlineBotMessageAttribute(peerId: botPeerId, title: nil))
|
||||
|
||||
|
@ -129,11 +129,12 @@ private final class SheetContent: CombinedComponent {
|
||||
var text: String = ""
|
||||
var entities: TextEntitiesMessageAttribute?
|
||||
var media: [Media] = []
|
||||
var replyMarkup: ReplyMarkupMessageAttribute?
|
||||
|
||||
switch component.preparedMessage.result {
|
||||
case let .internalReference(reference):
|
||||
switch reference.message {
|
||||
case let .auto(textValue, entitiesValue, _):
|
||||
case let .auto(textValue, entitiesValue, replyMarkupValue):
|
||||
text = textValue
|
||||
entities = entitiesValue
|
||||
if let file = reference.file {
|
||||
@ -141,39 +142,49 @@ private final class SheetContent: CombinedComponent {
|
||||
} else if let image = reference.image {
|
||||
media = [image]
|
||||
}
|
||||
case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, _):
|
||||
replyMarkup = replyMarkupValue
|
||||
case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, replyMarkupValue):
|
||||
text = textValue
|
||||
entities = entitiesValue
|
||||
let _ = disableUrlPreview
|
||||
let _ = previewParameters
|
||||
case let .contact(contact, _):
|
||||
replyMarkup = replyMarkupValue
|
||||
case let .contact(contact, replyMarkupValue):
|
||||
media = [contact]
|
||||
case let .mapLocation(map, _):
|
||||
replyMarkup = replyMarkupValue
|
||||
case let .mapLocation(map, replyMarkupValue):
|
||||
media = [map]
|
||||
case let .invoice(invoice, _):
|
||||
replyMarkup = replyMarkupValue
|
||||
case let .invoice(invoice, replyMarkupValue):
|
||||
media = [invoice]
|
||||
replyMarkup = replyMarkupValue
|
||||
default:
|
||||
break
|
||||
}
|
||||
case let .externalReference(reference):
|
||||
switch reference.message {
|
||||
case let .auto(textValue, entitiesValue, _):
|
||||
case let .auto(textValue, entitiesValue, replyMarkupValue):
|
||||
text = textValue
|
||||
entities = entitiesValue
|
||||
if let content = reference.content {
|
||||
media = [content]
|
||||
}
|
||||
case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, _):
|
||||
replyMarkup = replyMarkupValue
|
||||
case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, replyMarkupValue):
|
||||
text = textValue
|
||||
entities = entitiesValue
|
||||
let _ = disableUrlPreview
|
||||
let _ = previewParameters
|
||||
case let .contact(contact, _):
|
||||
replyMarkup = replyMarkupValue
|
||||
case let .contact(contact, replyMarkupValue):
|
||||
media = [contact]
|
||||
case let .mapLocation(map, _):
|
||||
replyMarkup = replyMarkupValue
|
||||
case let .mapLocation(map, replyMarkupValue):
|
||||
media = [map]
|
||||
case let .invoice(invoice, _):
|
||||
replyMarkup = replyMarkupValue
|
||||
case let .invoice(invoice, replyMarkupValue):
|
||||
media = [invoice]
|
||||
replyMarkup = replyMarkupValue
|
||||
default:
|
||||
break
|
||||
}
|
||||
@ -183,6 +194,7 @@ private final class SheetContent: CombinedComponent {
|
||||
text: text,
|
||||
entities: entities,
|
||||
media: media,
|
||||
replyMarkup: replyMarkup,
|
||||
botAddress: component.botAddress
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user