mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various improvements
This commit is contained in:
parent
589e46f52d
commit
d9d1210c1d
156 changed files with 5450 additions and 804 deletions
|
|
@ -1157,7 +1157,23 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||
let isLoading = json["is_progress_visible"] as? Bool
|
||||
let isEnabled = json["is_active"] as? Bool
|
||||
let hasShimmer = json["has_shine_effect"] as? Bool
|
||||
let state = AttachmentMainButtonState(text: text, font: .bold, background: .color(backgroundColor), textColor: textColor, isVisible: isVisible, progress: (isLoading ?? false) ? .center : .none, isEnabled: isEnabled ?? true, hasShimmer: hasShimmer ?? false)
|
||||
|
||||
var iconCustomEmojiId: Int64?
|
||||
if let stringValue = json["icon_custom_emoji_id"] as? String, let intValue = Int64(stringValue) {
|
||||
iconCustomEmojiId = intValue
|
||||
}
|
||||
|
||||
let state = AttachmentMainButtonState(
|
||||
text: text,
|
||||
font: .bold,
|
||||
background: .color(backgroundColor),
|
||||
textColor: textColor,
|
||||
isVisible: isVisible,
|
||||
progress: (isLoading ?? false) ? .center : .none,
|
||||
isEnabled: isEnabled ?? true,
|
||||
hasShimmer: hasShimmer ?? false,
|
||||
iconCustomEmojiId: iconCustomEmojiId
|
||||
)
|
||||
self.mainButtonState = state
|
||||
}
|
||||
}
|
||||
|
|
@ -1181,7 +1197,23 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||
let hasShimmer = json["has_shine_effect"] as? Bool
|
||||
let position = json["position"] as? String
|
||||
|
||||
let state = AttachmentMainButtonState(text: text, font: .bold, background: .color(backgroundColor), textColor: textColor, isVisible: isVisible, progress: (isLoading ?? false) ? .center : .none, isEnabled: isEnabled ?? true, hasShimmer: hasShimmer ?? false, position: position.flatMap { AttachmentMainButtonState.Position(rawValue: $0) })
|
||||
var iconCustomEmojiId: Int64?
|
||||
if let stringValue = json["icon_custom_emoji_id"] as? String, let intValue = Int64(stringValue) {
|
||||
iconCustomEmojiId = intValue
|
||||
}
|
||||
|
||||
let state = AttachmentMainButtonState(
|
||||
text: text,
|
||||
font: .bold,
|
||||
background: .color(backgroundColor),
|
||||
textColor: textColor,
|
||||
isVisible: isVisible,
|
||||
progress: (isLoading ?? false) ? .center : .none,
|
||||
isEnabled: isEnabled ?? true,
|
||||
hasShimmer: hasShimmer ?? false,
|
||||
iconCustomEmojiId: iconCustomEmojiId,
|
||||
position: position.flatMap { AttachmentMainButtonState.Position(rawValue: $0) }
|
||||
)
|
||||
self.secondaryButtonState = state
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ final class PeerNameColorChatPreviewItemNode: ListViewItemNode {
|
|||
attributes.append(InlineBotMessageAttribute(peerId: botPeerId, title: nil))
|
||||
|
||||
let message = Message(stableId: 1, stableVersion: 0, id: MessageId(peerId: authorPeerId, namespace: 0, id: 1), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 66000, flags: [.Incoming], tags: [], globalTags: [], localTags: [], customTags: [], forwardInfo: nil, author: peers[authorPeerId], text: messageItem.text, attributes: attributes, media: media, peers: peers, associatedMessages: messages, associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:])
|
||||
items.append(item.context.sharedContext.makeChatMessagePreviewItem(context: item.context, messages: [message], theme: item.componentTheme, strings: item.strings, wallpaper: item.wallpaper, fontSize: item.fontSize, chatBubbleCorners: item.chatBubbleCorners, dateTimeFormat: item.dateTimeFormat, nameOrder: item.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil, backgroundNode: currentBackgroundNode, availableReactions: nil, accountPeer: nil, isCentered: false, isPreview: true, isStandalone: false))
|
||||
items.append(item.context.sharedContext.makeChatMessagePreviewItem(context: item.context, messages: [message], theme: item.componentTheme, strings: item.strings, wallpaper: item.wallpaper, fontSize: item.fontSize, chatBubbleCorners: item.chatBubbleCorners, dateTimeFormat: item.dateTimeFormat, nameOrder: item.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil, backgroundNode: currentBackgroundNode, availableReactions: nil, accountPeer: nil, isCentered: false, isPreview: true, isStandalone: false, rank: nil, rankRole: nil))
|
||||
}
|
||||
|
||||
var nodes: [ListViewItemNode] = []
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ private final class SheetContent: CombinedComponent {
|
|||
static var body: Body {
|
||||
let closeButton = Child(GlassBarButtonComponent.self)
|
||||
let title = Child(Text.self)
|
||||
let amountSection = Child(ListSectionComponent.self)
|
||||
let previewSection = Child(ListSectionComponent.self)
|
||||
let button = Child(ButtonComponent.self)
|
||||
|
||||
return { context in
|
||||
|
|
@ -117,7 +117,7 @@ private final class SheetContent: CombinedComponent {
|
|||
})
|
||||
|
||||
let amountInfoString = NSMutableAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.WebApp_ShareMessage_Info(component.botName).string, attributes: amountMarkdownAttributes, textAlignment: .natural))
|
||||
let amountFooter = AnyComponent(MultilineTextComponent(
|
||||
let previewFooter = AnyComponent(MultilineTextComponent(
|
||||
text: .plain(amountInfoString),
|
||||
maximumNumberOfLines: 0,
|
||||
highlightColor: environment.theme.list.itemAccentColor.withAlphaComponent(0.1),
|
||||
|
|
@ -210,7 +210,7 @@ private final class SheetContent: CombinedComponent {
|
|||
|
||||
let listItemParams = ListViewItemLayoutParams(width: context.availableSize.width - sideInset * 2.0, leftInset: 0.0, rightInset: 0.0, availableHeight: 10000.0, isStandalone: true)
|
||||
|
||||
let amountSection = amountSection.update(
|
||||
let previewSection = previewSection.update(
|
||||
component: ListSectionComponent(
|
||||
theme: theme,
|
||||
header: AnyComponent(MultilineTextComponent(
|
||||
|
|
@ -221,7 +221,7 @@ private final class SheetContent: CombinedComponent {
|
|||
)),
|
||||
maximumNumberOfLines: 0
|
||||
)),
|
||||
footer: amountFooter,
|
||||
footer: previewFooter,
|
||||
items: [
|
||||
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListItemComponentAdaptor(
|
||||
itemGenerator: PeerNameColorChatPreviewItem(
|
||||
|
|
@ -245,12 +245,12 @@ private final class SheetContent: CombinedComponent {
|
|||
availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0, height: .greatestFiniteMagnitude),
|
||||
transition: context.transition
|
||||
)
|
||||
context.add(amountSection
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + amountSection.size.height / 2.0))
|
||||
context.add(previewSection
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + previewSection.size.height / 2.0))
|
||||
.clipsToBounds(true)
|
||||
.cornerRadius(10.0)
|
||||
)
|
||||
contentSize.height += amountSection.size.height
|
||||
contentSize.height += previewSection.size.height
|
||||
contentSize.height += 32.0
|
||||
|
||||
let buttonString: String = environment.strings.WebApp_ShareMessage_Share
|
||||
|
|
@ -281,8 +281,6 @@ private final class SheetContent: CombinedComponent {
|
|||
transition: .immediate
|
||||
)
|
||||
context.add(button
|
||||
.clipsToBounds(true)
|
||||
.cornerRadius(10.0)
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + button.size.height / 2.0))
|
||||
)
|
||||
contentSize.height += button.size.height
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue