mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Various fixes
This commit is contained in:
parent
1b9e7a43a8
commit
6f60e7c89e
@ -13121,5 +13121,5 @@ Sorry for the inconvenience.";
|
||||
"ChatList.Search.TopAppsInfo" = "Which apps are included here? [Learn >]()";
|
||||
|
||||
"TopApps.Info.Title" = "Top Mini Apps";
|
||||
"TopApps.Info.Text" = "This catalogue ranks mini apps based on their daily revenue, measured in Stars. To be listed, developers must set their main mini app in [@botfather]() (as described [here]()), have over **1,000** daily users, and earn a daily revenue above **1,000** Stars, based on weekly average.";
|
||||
"TopApps.Info.Text" = "This catalogue ranks mini apps based on their daily revenue, measured in Stars. To be listed, developers must set their main mini app in [@botfather]() (as described [here](https://core.telegram.org/bots/webapps#launching-the-main-mini-app)), have over **1,000** daily users, and earn a daily revenue above **1,000** Stars, based on weekly average.";
|
||||
"TopApps.Info.Done" = "Understood";
|
||||
|
@ -14,8 +14,8 @@ public final class AlertControllerContext {
|
||||
}
|
||||
}
|
||||
|
||||
public func textAlertController(alertContext: AlertControllerContext, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true) -> AlertController {
|
||||
let controller = standardTextAlertController(theme: alertContext.theme, title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap)
|
||||
public func textAlertController(alertContext: AlertControllerContext, 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 {
|
||||
let controller = standardTextAlertController(theme: alertContext.theme, title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction)
|
||||
let presentationDataDisposable = alertContext.themeSignal.start(next: { [weak controller] theme in
|
||||
controller?.theme = theme
|
||||
})
|
||||
|
@ -312,6 +312,7 @@ private enum ChatListRecentEntry: Comparable, Identifiable {
|
||||
buttonAction: buttonAction,
|
||||
index: nil,
|
||||
header: header,
|
||||
alwaysShowLastSeparator: key == .apps,
|
||||
action: { _ in
|
||||
if let chatPeer = peer.peer.peers[peer.peer.peerId] {
|
||||
peerSelected(EnginePeer(chatPeer), nil, section == .recommendedChannels || section == .popularApps)
|
||||
@ -3832,14 +3833,48 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
||||
}, animationCache: strongSelf.animationCache, animationRenderer: strongSelf.animationRenderer, openStories: { peerId, avatarNode in
|
||||
interaction.openStories?(peerId, avatarNode)
|
||||
}, openTopAppsInfo: {
|
||||
var dismissImpl: (() -> Void)?
|
||||
let alertController = textAlertController(
|
||||
context: context,
|
||||
title: presentationData.strings.TopApps_Info_Title,
|
||||
text: presentationData.strings.TopApps_Info_Text,
|
||||
actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.TopApps_Info_Done, action: {})],
|
||||
parseMarkdown: true
|
||||
parseMarkdown: true,
|
||||
linkAction: { attributes, _ in
|
||||
guard let self, let navigationController = self.navigationController else {
|
||||
return
|
||||
}
|
||||
dismissImpl?()
|
||||
if let value = attributes[NSAttributedString.Key(rawValue: "URL")] as? String {
|
||||
if !value.isEmpty {
|
||||
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: value, forceExternal: false, presentationData: context.sharedContext.currentPresentationData.with { $0 }, navigationController: navigationController, dismissInput: {})
|
||||
} else {
|
||||
let _ = (context.engine.peers.resolvePeerByName(name: "botfather")
|
||||
|> mapToSignal { result -> Signal<EnginePeer?, NoError> in
|
||||
guard case let .result(result) = result else {
|
||||
return .complete()
|
||||
}
|
||||
return .single(result)
|
||||
}
|
||||
|> deliverOnMainQueue).start(next: { [weak navigationController] peer in
|
||||
guard let navigationController, let peer else {
|
||||
return
|
||||
}
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(
|
||||
navigationController: navigationController,
|
||||
context: context,
|
||||
chatLocation: .peer(peer),
|
||||
keepStack: .always
|
||||
))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
interaction.present(alertController, nil)
|
||||
dismissImpl = { [weak alertController] in
|
||||
alertController?.dismissAnimated()
|
||||
}
|
||||
},
|
||||
isChannelsTabExpanded: recentItems.isChannelsTabExpanded,
|
||||
toggleChannelsTabExpanded: {
|
||||
|
@ -187,6 +187,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
|
||||
let actionIcon: ContactsPeerItemActionIcon
|
||||
let buttonAction: ContactsPeerItemButtonAction?
|
||||
let searchQuery: String?
|
||||
let alwaysShowLastSeparator: Bool
|
||||
let action: ((ContactsPeerItemPeer) -> Void)?
|
||||
let disabledAction: ((ContactsPeerItemPeer) -> Void)?
|
||||
let setPeerIdWithRevealedOptions: ((EnginePeer.Id?, EnginePeer.Id?) -> Void)?
|
||||
@ -229,6 +230,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
|
||||
index: SortIndex?,
|
||||
header: ListViewItemHeader?,
|
||||
searchQuery: String? = nil,
|
||||
alwaysShowLastSeparator: Bool = false,
|
||||
action: ((ContactsPeerItemPeer) -> Void)?,
|
||||
disabledAction: ((ContactsPeerItemPeer) -> Void)? = nil,
|
||||
setPeerIdWithRevealedOptions: ((EnginePeer.Id?, EnginePeer.Id?) -> Void)? = nil,
|
||||
@ -261,6 +263,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
|
||||
self.actionIcon = actionIcon
|
||||
self.buttonAction = buttonAction
|
||||
self.searchQuery = searchQuery
|
||||
self.alwaysShowLastSeparator = alwaysShowLastSeparator
|
||||
self.action = action
|
||||
self.disabledAction = disabledAction
|
||||
self.setPeerIdWithRevealedOptions = setPeerIdWithRevealedOptions
|
||||
@ -1675,7 +1678,9 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
|
||||
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -nodeLayout.insets.top - topHighlightInset), size: CGSize(width: nodeLayout.size.width, height: nodeLayout.size.height + topHighlightInset))
|
||||
strongSelf.topSeparatorNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(nodeLayout.insets.top, separatorHeight)), size: CGSize(width: nodeLayout.contentSize.width, height: separatorHeight))
|
||||
strongSelf.separatorNode.frame = CGRect(origin: CGPoint(x: leftInset, y: nodeLayout.contentSize.height - separatorHeight), size: CGSize(width: max(0.0, nodeLayout.size.width - leftInset), height: separatorHeight))
|
||||
strongSelf.separatorNode.isHidden = last
|
||||
if !item.alwaysShowLastSeparator {
|
||||
strongSelf.separatorNode.isHidden = last
|
||||
}
|
||||
|
||||
if let userPresence = userPresence {
|
||||
strongSelf.peerPresenceManager?.reset(presence: userPresence)
|
||||
|
@ -188,7 +188,7 @@ public final class TextAlertContentNode: AlertContentNode {
|
||||
}
|
||||
}
|
||||
|
||||
public init(theme: AlertControllerTheme, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout, dismissOnOutsideTap: Bool) {
|
||||
public init(theme: AlertControllerTheme, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout, dismissOnOutsideTap: Bool, linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil) {
|
||||
self.theme = theme
|
||||
self.actionLayout = actionLayout
|
||||
self._dismissOnOutsideTap = dismissOnOutsideTap
|
||||
@ -214,6 +214,15 @@ public final class TextAlertContentNode: AlertContentNode {
|
||||
self.textNode.isAccessibilityElement = true
|
||||
self.textNode.accessibilityLabel = text.string
|
||||
self.textNode.insets = UIEdgeInsets(top: 1.0, left: 1.0, bottom: 1.0, right: 1.0)
|
||||
self.textNode.tapAttributeAction = linkAction
|
||||
self.textNode.highlightAttributeAction = { attributes in
|
||||
if let _ = attributes[NSAttributedString.Key(rawValue: "URL")] {
|
||||
return NSAttributedString.Key(rawValue: "URL")
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
self.textNode.linkHighlightColor = theme.accentColor.withMultipliedAlpha(0.1)
|
||||
if text.length != 0 {
|
||||
if let paragraphStyle = text.attribute(.paragraphStyle, at: 0, effectiveRange: nil) as? NSParagraphStyle {
|
||||
self.textNode.textAlignment = paragraphStyle.alignment
|
||||
@ -450,7 +459,7 @@ public func textAlertController(theme: AlertControllerTheme, title: NSAttributed
|
||||
return AlertController(theme: theme, contentNode: TextAlertContentNode(theme: theme, title: title, text: text, actions: actions, actionLayout: actionLayout, dismissOnOutsideTap: dismissOnOutsideTap))
|
||||
}
|
||||
|
||||
public func standardTextAlertController(theme: AlertControllerTheme, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true) -> 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 {
|
||||
var dismissImpl: (() -> Void)?
|
||||
let attributedText: NSAttributedString
|
||||
if parseMarkdown {
|
||||
@ -470,7 +479,7 @@ public func standardTextAlertController(theme: AlertControllerTheme, title: Stri
|
||||
dismissImpl?()
|
||||
action.action()
|
||||
})
|
||||
}, actionLayout: actionLayout, dismissOnOutsideTap: dismissOnOutsideTap), allowInputInset: allowInputInset)
|
||||
}, actionLayout: actionLayout, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction), allowInputInset: allowInputInset)
|
||||
dismissImpl = { [weak controller] in
|
||||
controller?.dismissAnimated()
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ import AccountContext
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
||||
public func textAlertController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true) -> AlertController {
|
||||
return textAlertController(sharedContext: context.sharedContext, updatedPresentationData: updatedPresentationData, forceTheme: forceTheme, title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap)
|
||||
public func textAlertController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, 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 {
|
||||
return textAlertController(sharedContext: context.sharedContext, updatedPresentationData: updatedPresentationData, forceTheme: forceTheme, title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction)
|
||||
}
|
||||
|
||||
public func textAlertController(sharedContext: SharedAccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true) -> AlertController {
|
||||
public func textAlertController(sharedContext: SharedAccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, 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 {
|
||||
var presentationData = updatedPresentationData?.initial ?? sharedContext.currentPresentationData.with { $0 }
|
||||
if let forceTheme = forceTheme {
|
||||
presentationData = presentationData.withUpdated(theme: forceTheme)
|
||||
@ -21,7 +21,7 @@ public func textAlertController(sharedContext: SharedAccountContext, updatedPres
|
||||
presentationData = presentationData.withUpdated(theme: forceTheme)
|
||||
}
|
||||
return AlertControllerTheme(presentationData: presentationData)
|
||||
}), title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap)
|
||||
}), title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction)
|
||||
}
|
||||
|
||||
public func textAlertController(sharedContext: SharedAccountContext, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, dismissOnOutsideTap: Bool = true) -> AlertController {
|
||||
|
Loading…
x
Reference in New Issue
Block a user