mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
UI fixes
This commit is contained in:
parent
cfc495ff88
commit
63d2bb649b
@ -1823,10 +1823,6 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
||||
return shareButtonNode.view
|
||||
}
|
||||
|
||||
if let avatarNode = self.accessoryItemNode as? ChatMessageAvatarAccessoryItemNode, avatarNode.frame.contains(point) {
|
||||
return self.view
|
||||
}
|
||||
|
||||
if let selectionNode = self.selectionNode {
|
||||
if let result = self.traceSelectionNodes(parent: self, point: point.offsetBy(dx: -42.0, dy: 0.0)) {
|
||||
return result.view
|
||||
@ -1842,6 +1838,10 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
||||
}
|
||||
}
|
||||
|
||||
if let avatarNode = self.accessoryItemNode as? ChatMessageAvatarAccessoryItemNode, avatarNode.frame.contains(point) {
|
||||
return self.view
|
||||
}
|
||||
|
||||
if !self.backgroundNode.frame.contains(point) {
|
||||
if self.actionButtonsNode == nil || !self.actionButtonsNode!.frame.contains(point) {
|
||||
//return nil
|
||||
|
@ -334,7 +334,7 @@ class ItemListSingleLineInputItemNode: ListViewItemNode, UITextFieldDelegate, It
|
||||
}
|
||||
|
||||
private func textUpdated(_ text: String) {
|
||||
self.item?.textUpdated("")
|
||||
self.item?.textUpdated(text)
|
||||
}
|
||||
|
||||
func focus() {
|
||||
|
@ -151,7 +151,7 @@ struct SettingsSearchableItem {
|
||||
|
||||
private func synonyms(_ string: String?) -> [String] {
|
||||
if let string = string, !string.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
return string.components(separatedBy: "|")
|
||||
return string.components(separatedBy: "\n")
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
@ -225,12 +225,12 @@ private func callSearchableItems(context: AccountContext) -> [SettingsSearchable
|
||||
]
|
||||
}
|
||||
|
||||
private func stickerSearchableItems(context: AccountContext, hasArchivedStickerPacks: Bool) -> [SettingsSearchableItem] {
|
||||
private func stickerSearchableItems(context: AccountContext, archivedStickerPacks: [ArchivedStickerPackItem]?) -> [SettingsSearchableItem] {
|
||||
let icon: SettingsSearchableItemIcon = .stickers
|
||||
let strings = context.sharedContext.currentPresentationData.with { $0 }.strings
|
||||
|
||||
let presentStickerSettings: (AccountContext, (SettingsSearchableItemPresentation, ViewController) -> Void, InstalledStickerPacksEntryTag?) -> Void = { context, present, itemTag in
|
||||
present(.push, installedStickerPacksController(context: context, mode: .general, archivedPacks: nil, updatedPacks: { _ in }, focusOnItemTag: itemTag))
|
||||
present(.push, installedStickerPacksController(context: context, mode: .general, archivedPacks: archivedStickerPacks, updatedPacks: { _ in }, focusOnItemTag: itemTag))
|
||||
}
|
||||
|
||||
var items: [SettingsSearchableItem] = []
|
||||
@ -244,9 +244,9 @@ private func stickerSearchableItems(context: AccountContext, hasArchivedStickerP
|
||||
items.append(SettingsSearchableItem(id: .stickers(2), title: strings.StickerPacksSettings_FeaturedPacks, alternate: synonyms(strings.SettingsSearch_Synonyms_Stickers_FeaturedPacks), icon: icon, breadcrumbs: [strings.ChatSettings_Stickers], present: { context, _, present in
|
||||
present(.push, featuredStickerPacksController(context: context))
|
||||
}))
|
||||
if hasArchivedStickerPacks {
|
||||
if !(archivedStickerPacks?.isEmpty ?? true) {
|
||||
items.append(SettingsSearchableItem(id: .stickers(3), title: strings.StickerPacksSettings_ArchivedPacks, alternate: synonyms(strings.SettingsSearch_Synonyms_Stickers_ArchivedPacks), icon: icon, breadcrumbs: [strings.ChatSettings_Stickers], present: { context, _, present in
|
||||
present(.push, archivedStickerPacksController(context: context, mode: .stickers, archived: nil, updatedPacks: { _ in }))
|
||||
present(.push, archivedStickerPacksController(context: context, mode: .stickers, archived: archivedStickerPacks, updatedPacks: { _ in }))
|
||||
}))
|
||||
}
|
||||
items.append(SettingsSearchableItem(id: .stickers(4), title: strings.MaskStickerSettings_Title, alternate: synonyms(strings.SettingsSearch_Synonyms_Stickers_Masks), icon: icon, breadcrumbs: [strings.ChatSettings_Stickers], present: { context, _, present in
|
||||
@ -693,11 +693,8 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
|
||||
return viewSettings
|
||||
}
|
||||
|
||||
let hasArchivedStickerPacks = archivedStickerPacks
|
||||
let archivedStickerPacks = archivedStickerPacks
|
||||
|> take(1)
|
||||
|> map { stickerPacks -> Bool in
|
||||
return !(stickerPacks?.isEmpty ?? true)
|
||||
}
|
||||
|
||||
let proxyServers = context.sharedContext.accountManager.sharedData(keys: [SharedDataKeys.proxySettings])
|
||||
|> map { sharedData -> ProxySettings in
|
||||
@ -711,8 +708,8 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
|
||||
return settings.servers
|
||||
}
|
||||
|
||||
return combineLatest(watchAppInstalled, canAddAccount, notificationSettings, notificationExceptionsList, hasArchivedStickerPacks, proxyServers)
|
||||
|> map { watchAppInstalled, canAddAccount, notificationSettings, notificationExceptionsList, hasArchivedStickerPacks, proxyServers in
|
||||
return combineLatest(watchAppInstalled, canAddAccount, notificationSettings, notificationExceptionsList, archivedStickerPacks, proxyServers)
|
||||
|> map { watchAppInstalled, canAddAccount, notificationSettings, notificationExceptionsList, archivedStickerPacks, proxyServers in
|
||||
let strings = context.sharedContext.currentPresentationData.with { $0 }.strings
|
||||
|
||||
var allItems: [SettingsSearchableItem] = []
|
||||
@ -728,7 +725,7 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
|
||||
let callItems = callSearchableItems(context: context)
|
||||
allItems.append(contentsOf: callItems)
|
||||
|
||||
let stickerItems = stickerSearchableItems(context: context, hasArchivedStickerPacks: hasArchivedStickerPacks)
|
||||
let stickerItems = stickerSearchableItems(context: context, archivedStickerPacks: archivedStickerPacks)
|
||||
allItems.append(contentsOf: stickerItems)
|
||||
|
||||
let notificationItems = notificationSearchableItems(context: context, settings: notificationSettings, exceptionsList: notificationExceptionsList)
|
||||
|
@ -21,6 +21,19 @@ private enum UsernameSetupSection: Int32 {
|
||||
case link
|
||||
}
|
||||
|
||||
public enum UsernameEntryTag: ItemListItemTag {
|
||||
case username
|
||||
|
||||
func isEqual(to other: ItemListItemTag) -> Bool {
|
||||
if let other = other as? UsernameEntryTag, self == other {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private enum UsernameSetupEntry: ItemListNodeEntry {
|
||||
case editablePublicLink(PresentationTheme, String, String?, String)
|
||||
case publicLinkStatus(PresentationTheme, String, AddressNameValidationStatus, String)
|
||||
@ -74,10 +87,9 @@ private enum UsernameSetupEntry: ItemListNodeEntry {
|
||||
func item(_ arguments: UsernameSetupControllerArguments) -> ListViewItem {
|
||||
switch self {
|
||||
case let .editablePublicLink(theme, prefix, currentText, text):
|
||||
return ItemListSingleLineInputItem(theme: theme, title: NSAttributedString(string: prefix, textColor: theme.list.itemPrimaryTextColor), text: text, placeholder: "", type: .username, spacing: 10.0, sectionId: self.section, textUpdated: { updatedText in
|
||||
return ItemListSingleLineInputItem(theme: theme, title: NSAttributedString(string: prefix, textColor: theme.list.itemPrimaryTextColor), text: text, placeholder: "", type: .username, spacing: 10.0, tag: UsernameEntryTag.username, sectionId: self.section, textUpdated: { updatedText in
|
||||
arguments.updatePublicLinkText(currentText, updatedText)
|
||||
}, action: {
|
||||
|
||||
})
|
||||
case let .publicLinkInfo(theme, text):
|
||||
return ItemListTextItem(theme: theme, text: .markdown(text), sectionId: self.section, linkAction: { action in
|
||||
@ -320,7 +332,7 @@ public func usernameSetupController(context: AccountContext) -> ViewController {
|
||||
})
|
||||
|
||||
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.Username_Title), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
|
||||
let listState = ItemListNodeState(entries: usernameSetupControllerEntries(presentationData: presentationData, view: view, state: state), style: .blocks, animateChanges: false)
|
||||
let listState = ItemListNodeState(entries: usernameSetupControllerEntries(presentationData: presentationData, view: view, state: state), style: .blocks, focusItemTag: UsernameEntryTag.username, animateChanges: false)
|
||||
|
||||
return (controllerState, (listState, arguments))
|
||||
} |> afterDisposed {
|
||||
|
Loading…
x
Reference in New Issue
Block a user