mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Rich bubble: scrollToAnchor + getAnchorRect
Adds a base getAnchorRect on ChatMessageBubbleContentNode, the rich-bubble override (including titleHeight in details recursion), bubble-item forwarding to content nodes, ChatControllerInteraction.scrollToMessageIdWithAnchor, and a scrollToAnchor that lands the anchor at the top of the content area / its line. Threads anchor/scroll params through ChatController and related call sites.
This commit is contained in:
parent
f29af03cd7
commit
fdb2f369ec
26 changed files with 1148 additions and 100 deletions
|
|
@ -21,17 +21,19 @@ public enum InstantPagePresentationFontSize: Int32 {
|
|||
}
|
||||
|
||||
public final class InstantPagePresentationSettings: Codable, Equatable {
|
||||
public static var defaultSettings = InstantPagePresentationSettings(themeType: .light, fontSize: .standard, forceSerif: false, autoNightMode: true, ignoreAutoNightModeUntil: 0)
|
||||
public static var defaultSettings = InstantPagePresentationSettings(themeType: .light, fontSize: .standard, lineSpacingFactor: 1.0, forceSerif: false, autoNightMode: true, ignoreAutoNightModeUntil: 0)
|
||||
|
||||
public var themeType: InstantPageThemeType
|
||||
public var fontSize: InstantPagePresentationFontSize
|
||||
public var lineSpacingFactor: CGFloat
|
||||
public var forceSerif: Bool
|
||||
public var autoNightMode: Bool
|
||||
public var ignoreAutoNightModeUntil: Int32
|
||||
|
||||
public init(themeType: InstantPageThemeType, fontSize: InstantPagePresentationFontSize, forceSerif: Bool, autoNightMode: Bool, ignoreAutoNightModeUntil: Int32) {
|
||||
public init(themeType: InstantPageThemeType, fontSize: InstantPagePresentationFontSize, lineSpacingFactor: CGFloat, forceSerif: Bool, autoNightMode: Bool, ignoreAutoNightModeUntil: Int32) {
|
||||
self.themeType = themeType
|
||||
self.fontSize = fontSize
|
||||
self.lineSpacingFactor = lineSpacingFactor
|
||||
self.forceSerif = forceSerif
|
||||
self.autoNightMode = autoNightMode
|
||||
self.ignoreAutoNightModeUntil = ignoreAutoNightModeUntil
|
||||
|
|
@ -42,6 +44,7 @@ public final class InstantPagePresentationSettings: Codable, Equatable {
|
|||
|
||||
self.themeType = InstantPageThemeType(rawValue: try container.decode(Int32.self, forKey: "themeType"))!
|
||||
self.fontSize = InstantPagePresentationFontSize(rawValue: try container.decode(Int32.self, forKey: "fontSize"))!
|
||||
self.lineSpacingFactor = try container.decodeIfPresent(Double.self, forKey: "lineSpacingFactor") ?? 1.0
|
||||
self.forceSerif = try container.decode(Int32.self, forKey: "forceSerif") != 0
|
||||
self.autoNightMode = try container.decode(Int32.self, forKey: "autoNightMode") != 0
|
||||
self.ignoreAutoNightModeUntil = try container.decode(Int32.self, forKey: "ignoreAutoNightModeUntil")
|
||||
|
|
@ -52,6 +55,7 @@ public final class InstantPagePresentationSettings: Codable, Equatable {
|
|||
|
||||
try container.encode(self.themeType.rawValue, forKey: "themeType")
|
||||
try container.encode(self.fontSize.rawValue, forKey: "fontSize")
|
||||
try container.encode(self.lineSpacingFactor, forKey: "lineSpacingFactor")
|
||||
try container.encode((self.forceSerif ? 1 : 0) as Int32, forKey: "forceSerif")
|
||||
try container.encode((self.autoNightMode ? 1 : 0) as Int32, forKey: "autoNightMode")
|
||||
try container.encode(self.ignoreAutoNightModeUntil, forKey: "ignoreAutoNightModeUntil")
|
||||
|
|
@ -64,6 +68,9 @@ public final class InstantPagePresentationSettings: Codable, Equatable {
|
|||
if lhs.fontSize != rhs.fontSize {
|
||||
return false
|
||||
}
|
||||
if lhs.lineSpacingFactor != rhs.lineSpacingFactor {
|
||||
return false
|
||||
}
|
||||
if lhs.forceSerif != rhs.forceSerif {
|
||||
return false
|
||||
}
|
||||
|
|
@ -77,23 +84,23 @@ public final class InstantPagePresentationSettings: Codable, Equatable {
|
|||
}
|
||||
|
||||
public func withUpdatedThemeType(_ themeType: InstantPageThemeType) -> InstantPagePresentationSettings {
|
||||
return InstantPagePresentationSettings(themeType: themeType, fontSize: self.fontSize, forceSerif: self.forceSerif, autoNightMode: self.autoNightMode, ignoreAutoNightModeUntil: self.ignoreAutoNightModeUntil)
|
||||
return InstantPagePresentationSettings(themeType: themeType, fontSize: self.fontSize, lineSpacingFactor: self.lineSpacingFactor, forceSerif: self.forceSerif, autoNightMode: self.autoNightMode, ignoreAutoNightModeUntil: self.ignoreAutoNightModeUntil)
|
||||
}
|
||||
|
||||
public func withUpdatedFontSize(_ fontSize: InstantPagePresentationFontSize) -> InstantPagePresentationSettings {
|
||||
return InstantPagePresentationSettings(themeType: self.themeType, fontSize: fontSize, forceSerif: self.forceSerif, autoNightMode: self.autoNightMode, ignoreAutoNightModeUntil: self.ignoreAutoNightModeUntil)
|
||||
return InstantPagePresentationSettings(themeType: self.themeType, fontSize: fontSize, lineSpacingFactor: self.lineSpacingFactor, forceSerif: self.forceSerif, autoNightMode: self.autoNightMode, ignoreAutoNightModeUntil: self.ignoreAutoNightModeUntil)
|
||||
}
|
||||
|
||||
public func withUpdatedForceSerif(_ forceSerif: Bool) -> InstantPagePresentationSettings {
|
||||
return InstantPagePresentationSettings(themeType: self.themeType, fontSize: self.fontSize, forceSerif: forceSerif, autoNightMode: self.autoNightMode, ignoreAutoNightModeUntil: self.ignoreAutoNightModeUntil)
|
||||
return InstantPagePresentationSettings(themeType: self.themeType, fontSize: self.fontSize, lineSpacingFactor: self.lineSpacingFactor, forceSerif: forceSerif, autoNightMode: self.autoNightMode, ignoreAutoNightModeUntil: self.ignoreAutoNightModeUntil)
|
||||
}
|
||||
|
||||
public func withUpdatedAutoNightMode(_ autoNightMode: Bool) -> InstantPagePresentationSettings {
|
||||
return InstantPagePresentationSettings(themeType: self.themeType, fontSize: self.fontSize, forceSerif: self.forceSerif, autoNightMode: autoNightMode, ignoreAutoNightModeUntil: self.ignoreAutoNightModeUntil)
|
||||
return InstantPagePresentationSettings(themeType: self.themeType, fontSize: self.fontSize, lineSpacingFactor: self.lineSpacingFactor, forceSerif: self.forceSerif, autoNightMode: autoNightMode, ignoreAutoNightModeUntil: self.ignoreAutoNightModeUntil)
|
||||
}
|
||||
|
||||
public func withUpdatedIgnoreAutoNightModeUntil(_ ignoreAutoNightModeUntil: Int32) -> InstantPagePresentationSettings {
|
||||
return InstantPagePresentationSettings(themeType: self.themeType, fontSize: self.fontSize, forceSerif: self.forceSerif, autoNightMode: autoNightMode, ignoreAutoNightModeUntil: ignoreAutoNightModeUntil)
|
||||
return InstantPagePresentationSettings(themeType: self.themeType, fontSize: self.fontSize, lineSpacingFactor: self.lineSpacingFactor, forceSerif: self.forceSerif, autoNightMode: autoNightMode, ignoreAutoNightModeUntil: ignoreAutoNightModeUntil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue