mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 03:21:29 +00:00
Various fixes
This commit is contained in:
parent
c8230eb2e0
commit
6e3c3940c2
@ -463,8 +463,8 @@ public final class TextAlertContentNode: AlertContentNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func textAlertController(theme: AlertControllerTheme, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, dismissOnOutsideTap: Bool = true) -> AlertController {
|
public func textAlertController(theme: AlertControllerTheme, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, dismissOnOutsideTap: Bool = true, linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil) -> AlertController {
|
||||||
return AlertController(theme: theme, contentNode: TextAlertContentNode(theme: theme, title: title, text: text, actions: actions, actionLayout: actionLayout, dismissOnOutsideTap: dismissOnOutsideTap))
|
return AlertController(theme: theme, contentNode: TextAlertContentNode(theme: theme, title: title, text: text, actions: actions, actionLayout: actionLayout, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction))
|
||||||
}
|
}
|
||||||
|
|
||||||
public func standardTextAlertController(theme: AlertControllerTheme, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true, linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil) -> AlertController {
|
public func standardTextAlertController(theme: AlertControllerTheme, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true, linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil) -> AlertController {
|
||||||
|
|||||||
@ -434,6 +434,7 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
subject = .uniqueGift(gift: gift, price: nil)
|
subject = .uniqueGift(gift: gift, price: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let context = component.context
|
||||||
let _ = visibleItem.update(
|
let _ = visibleItem.update(
|
||||||
transition: itemTransition,
|
transition: itemTransition,
|
||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
@ -472,12 +473,19 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
let theme = AlertControllerTheme(presentationData: component.context.sharedContext.currentPresentationData.with { $0 })
|
let theme = AlertControllerTheme(presentationData: component.context.sharedContext.currentPresentationData.with { $0 })
|
||||||
let font = Font.regular(floor(theme.baseFontSize * 13.0 / 17.0))
|
let font = Font.regular(floor(theme.baseFontSize * 13.0 / 17.0))
|
||||||
let boldFont = Font.semibold(floor(theme.baseFontSize * 13.0 / 17.0))
|
let boldFont = Font.semibold(floor(theme.baseFontSize * 13.0 / 17.0))
|
||||||
let attributedText = stringWithAppliedEntities(text, entities: entities, baseColor: theme.primaryColor, linkColor: .black, baseFont: font, linkFont: font, boldFont: boldFont, italicFont: font, boldItalicFont: font, fixedFont: font, blockQuoteFont: font, message: nil, paragraphAlignment: .center)
|
let attributedText = stringWithAppliedEntities(text, entities: entities, baseColor: theme.primaryColor, linkColor: theme.accentColor, baseFont: font, linkFont: font, boldFont: boldFont, italicFont: font, boldItalicFont: font, fixedFont: font, blockQuoteFont: font, message: nil, paragraphAlignment: .center)
|
||||||
|
|
||||||
var dismissImpl: (() -> Void)?
|
var dismissImpl: (() -> Void)?
|
||||||
let alertController = textAlertController(theme: theme, title: NSAttributedString(string: strings.Gift_Options_GiftLocked_Title, font: Font.semibold(theme.baseFontSize), textColor: theme.primaryColor, paragraphAlignment: .center), text: attributedText, actions: [TextAlertAction(type: .defaultAction, title: strings.Common_OK, action: {
|
let alertController = textAlertController(theme: theme, title: NSAttributedString(string: strings.Gift_Options_GiftLocked_Title, font: Font.semibold(theme.baseFontSize), textColor: theme.primaryColor, paragraphAlignment: .center), text: attributedText, actions: [TextAlertAction(type: .defaultAction, title: strings.Common_OK, action: {
|
||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
})], actionLayout: .horizontal, dismissOnOutsideTap: true)
|
})], actionLayout: .horizontal, dismissOnOutsideTap: true, linkAction: { [weak controller] attributes, _ in
|
||||||
|
if let value = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] as? String {
|
||||||
|
dismissImpl?()
|
||||||
|
if let navigationController = controller?.navigationController as? NavigationController {
|
||||||
|
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: value, forceExternal: false, presentationData: context.sharedContext.currentPresentationData.with { $0 }, navigationController: navigationController, dismissInput: {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
dismissImpl = { [weak alertController] in
|
dismissImpl = { [weak alertController] in
|
||||||
alertController?.dismissAnimated()
|
alertController?.dismissAnimated()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ public enum PeerInfoPaneKey: Int32 {
|
|||||||
case botPreview
|
case botPreview
|
||||||
case members
|
case members
|
||||||
case stories
|
case stories
|
||||||
case storyArchive
|
|
||||||
case gifts
|
case gifts
|
||||||
case media
|
case media
|
||||||
case savedMessagesChats
|
case savedMessagesChats
|
||||||
@ -23,6 +22,7 @@ public enum PeerInfoPaneKey: Int32 {
|
|||||||
case groupsInCommon
|
case groupsInCommon
|
||||||
case similarChannels
|
case similarChannels
|
||||||
case similarBots
|
case similarBots
|
||||||
|
case storyArchive
|
||||||
|
|
||||||
public init(tab: TelegramProfileTab) {
|
public init(tab: TelegramProfileTab) {
|
||||||
switch tab {
|
switch tab {
|
||||||
|
|||||||
@ -1453,7 +1453,15 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
|
|
||||||
if let previousPanelStatusData = previousPanelStatusData, let currentPanelStatusData = panelStatusData.0, let previousPanelStatusDataKey = previousPanelStatusData.key, let currentPanelStatusDataKey = currentPanelStatusData.key, previousPanelStatusDataKey != currentPanelStatusDataKey {
|
if let previousPanelStatusData = previousPanelStatusData, let currentPanelStatusData = panelStatusData.0, let previousPanelStatusDataKey = previousPanelStatusData.key, let currentPanelStatusDataKey = currentPanelStatusData.key, previousPanelStatusDataKey != currentPanelStatusDataKey {
|
||||||
if let snapshotView = self.panelSubtitleNode.view.snapshotContentTree() {
|
if let snapshotView = self.panelSubtitleNode.view.snapshotContentTree() {
|
||||||
let direction: CGFloat = previousPanelStatusDataKey.rawValue > currentPanelStatusDataKey.rawValue ? 1.0 : -1.0
|
let previousIndex = screenData?.availablePanes.firstIndex(of: previousPanelStatusDataKey)
|
||||||
|
let currentIndex = screenData?.availablePanes.firstIndex(of: currentPanelStatusDataKey)
|
||||||
|
|
||||||
|
let direction: CGFloat
|
||||||
|
if let previousIndex, let currentIndex {
|
||||||
|
direction = previousIndex > currentIndex ? 1.0 : -1.0
|
||||||
|
} else {
|
||||||
|
direction = previousPanelStatusDataKey.rawValue > currentPanelStatusDataKey.rawValue ? 1.0 : -1.0
|
||||||
|
}
|
||||||
|
|
||||||
self.panelSubtitleNode.view.superview?.addSubview(snapshotView)
|
self.panelSubtitleNode.view.superview?.addSubview(snapshotView)
|
||||||
snapshotView.frame = self.panelSubtitleNode.frame
|
snapshotView.frame = self.panelSubtitleNode.frame
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user