mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 09:20:08 +00:00
Bug fixes
This commit is contained in:
parent
12d239ebbf
commit
83de81228a
@ -11824,9 +11824,9 @@ Sorry for the inconvenience.";
|
|||||||
"Business.Links.CreateAction" = "Create a Link to Chat";
|
"Business.Links.CreateAction" = "Create a Link to Chat";
|
||||||
"Business.Links.LinksSectionHeader" = "LINKS TO CHAT";
|
"Business.Links.LinksSectionHeader" = "LINKS TO CHAT";
|
||||||
|
|
||||||
"Business.Links.SimpleLinkInfoUsernamePhone" = "You can also use a simple link for a chat with you — [t.me/%1$@](username) or [t.me/\u{2060}+\u{2060}%2$@](phone).";
|
"Business.Links.SimpleLinkInfoUsernamePhone" = "You can also use a simple link for a chat with you — [t.me/%1$@](username) or [t.me/\\u{2060}+\\u{2060}%2$@](phone).";
|
||||||
"Business.Links.SimpleLinkInfoUsername" = "You can also use a simple link for a chat with you — [t.me/%@](username).";
|
"Business.Links.SimpleLinkInfoUsername" = "You can also use a simple link for a chat with you — [t.me/%@](username).";
|
||||||
"Business.Links.SimpleLinkInfoPhone" = "You can also use a simple link for a chat with you — [t.me/\u{2060}+\u{2060}%@](phone).";
|
"Business.Links.SimpleLinkInfoPhone" = "You can also use a simple link for a chat with you — [t.me/\\u{2060}+\\u{2060}%@](phone).";
|
||||||
|
|
||||||
"Business.Links.LinkNameTitle" = "Link Name";
|
"Business.Links.LinkNameTitle" = "Link Name";
|
||||||
"Business.Links.LinkNameText" = "Add a name for this link that only you will see.";
|
"Business.Links.LinkNameText" = "Add a name for this link that only you will see.";
|
||||||
|
|||||||
@ -956,8 +956,11 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
let navigationSeparatorAlpha: CGFloat
|
let navigationSeparatorAlpha: CGFloat
|
||||||
if isMediaOnly {
|
if isMediaOnly {
|
||||||
navigationSeparatorAlpha = 0.0
|
navigationSeparatorAlpha = 0.0
|
||||||
|
} else if state.isEditing && self.isSettings {
|
||||||
|
//navigationSeparatorAlpha = min(1.0, contentOffset / (navigationHeight * 0.5))
|
||||||
|
navigationSeparatorAlpha = 0.0
|
||||||
} else {
|
} else {
|
||||||
navigationSeparatorAlpha = state.isEditing && self.isSettings ? min(1.0, contentOffset / (navigationHeight * 0.5)) : 0.0
|
navigationSeparatorAlpha = 0.0
|
||||||
}
|
}
|
||||||
transition.updateAlpha(node: self.navigationBackgroundBackgroundNode, alpha: 1.0 - navigationSeparatorAlpha)
|
transition.updateAlpha(node: self.navigationBackgroundBackgroundNode, alpha: 1.0 - navigationSeparatorAlpha)
|
||||||
transition.updateAlpha(node: self.navigationSeparatorNode, alpha: navigationSeparatorAlpha)
|
transition.updateAlpha(node: self.navigationSeparatorNode, alpha: navigationSeparatorAlpha)
|
||||||
|
|||||||
@ -1117,7 +1117,7 @@ private func settingsEditingItems(data: PeerInfoScreenData?, state: PeerInfoStat
|
|||||||
personalChannelTitle = personalChannel.peer.compactDisplayTitle
|
personalChannelTitle = personalChannel.peer.compactDisplayTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
items[.info]!.append(PeerInfoScreenDisclosureItem(id: ItemPeerPersonalChannel, label: .text(personalChannelTitle ?? presentationData.strings.Settings_PersonalChannelItem), text: presentationData.strings.Settings_PersonalChannelEmptyValue, icon: nil, action: {
|
items[.info]!.append(PeerInfoScreenDisclosureItem(id: ItemPeerPersonalChannel, label: .text(personalChannelTitle ?? presentationData.strings.Settings_PersonalChannelEmptyValue), text: presentationData.strings.Settings_PersonalChannelItem, icon: nil, action: {
|
||||||
interaction.editingOpenPersonalChannel()
|
interaction.editingOpenPersonalChannel()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -426,11 +426,11 @@ final class BusinessLinksSetupScreenComponent: Component {
|
|||||||
))))
|
))))
|
||||||
|
|
||||||
let footerText: String
|
let footerText: String
|
||||||
if let addressName = component.initialData.accountPeer?.addressName, let phoneNumber = component.initialData.accountPeer?.phone {
|
if let addressName = component.initialData.accountPeer?.addressName, let phoneNumber = component.initialData.accountPeer?.phone, component.initialData.displayPhone {
|
||||||
footerText = environment.strings.Business_Links_SimpleLinkInfoUsernamePhone(addressName, phoneNumber).string
|
footerText = environment.strings.Business_Links_SimpleLinkInfoUsernamePhone(addressName, phoneNumber).string
|
||||||
} else if let addressName = component.initialData.accountPeer?.addressName {
|
} else if let addressName = component.initialData.accountPeer?.addressName {
|
||||||
footerText = environment.strings.Business_Links_SimpleLinkInfoUsername(addressName).string
|
footerText = environment.strings.Business_Links_SimpleLinkInfoUsername(addressName).string
|
||||||
} else if let phoneNumber = component.initialData.accountPeer?.phone {
|
} else if let phoneNumber = component.initialData.accountPeer?.phone, component.initialData.displayPhone {
|
||||||
footerText = environment.strings.Business_Links_SimpleLinkInfoPhone(phoneNumber).string
|
footerText = environment.strings.Business_Links_SimpleLinkInfoPhone(phoneNumber).string
|
||||||
} else {
|
} else {
|
||||||
footerText = ""
|
footerText = ""
|
||||||
@ -440,7 +440,7 @@ final class BusinessLinksSetupScreenComponent: Component {
|
|||||||
component: AnyComponent(ListSectionComponent(
|
component: AnyComponent(ListSectionComponent(
|
||||||
theme: environment.theme,
|
theme: environment.theme,
|
||||||
header: nil,
|
header: nil,
|
||||||
footer: AnyComponent(MultilineTextComponent(
|
footer: footerText.isEmpty ? nil : AnyComponent(MultilineTextComponent(
|
||||||
text: .markdown(text: footerText, attributes: MarkdownAttributes(
|
text: .markdown(text: footerText, attributes: MarkdownAttributes(
|
||||||
body: MarkdownAttributeSet(font: Font.regular(15.0), textColor: environment.theme.list.freeTextColor),
|
body: MarkdownAttributeSet(font: Font.regular(15.0), textColor: environment.theme.list.freeTextColor),
|
||||||
bold: MarkdownAttributeSet(font: Font.semibold(15.0), textColor: environment.theme.list.freeTextColor),
|
bold: MarkdownAttributeSet(font: Font.semibold(15.0), textColor: environment.theme.list.freeTextColor),
|
||||||
@ -613,10 +613,12 @@ public final class BusinessLinksSetupScreen: ViewControllerComponentContainer {
|
|||||||
public final class InitialData: BusinessLinksSetupScreenInitialData {
|
public final class InitialData: BusinessLinksSetupScreenInitialData {
|
||||||
fileprivate let accountPeer: TelegramUser?
|
fileprivate let accountPeer: TelegramUser?
|
||||||
fileprivate let businessLinks: TelegramBusinessChatLinks?
|
fileprivate let businessLinks: TelegramBusinessChatLinks?
|
||||||
|
fileprivate let displayPhone: Bool
|
||||||
|
|
||||||
fileprivate init(accountPeer: TelegramUser?, businessLinks: TelegramBusinessChatLinks?) {
|
fileprivate init(accountPeer: TelegramUser?, businessLinks: TelegramBusinessChatLinks?, displayPhone: Bool) {
|
||||||
self.accountPeer = accountPeer
|
self.accountPeer = accountPeer
|
||||||
self.businessLinks = businessLinks
|
self.businessLinks = businessLinks
|
||||||
|
self.displayPhone = displayPhone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,18 +663,39 @@ public final class BusinessLinksSetupScreen: ViewControllerComponentContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func makeInitialData(context: AccountContext) -> Signal<BusinessLinksSetupScreenInitialData, NoError> {
|
public static func makeInitialData(context: AccountContext) -> Signal<BusinessLinksSetupScreenInitialData, NoError> {
|
||||||
return context.engine.data.get(
|
let settingsPromise: Promise<AccountPrivacySettings?>
|
||||||
|
if let rootController = context.sharedContext.mainWindow?.viewController as? TelegramRootControllerInterface, let current = rootController.getPrivacySettings() {
|
||||||
|
settingsPromise = current
|
||||||
|
} else {
|
||||||
|
settingsPromise = Promise()
|
||||||
|
settingsPromise.set(.single(nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
return combineLatest(
|
||||||
|
context.engine.data.get(
|
||||||
TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId),
|
TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId),
|
||||||
TelegramEngine.EngineData.Item.Peer.BusinessChatLinks(id: context.account.peerId)
|
TelegramEngine.EngineData.Item.Peer.BusinessChatLinks(id: context.account.peerId)
|
||||||
|
),
|
||||||
|
settingsPromise.get()
|
||||||
|
|> take(1)
|
||||||
)
|
)
|
||||||
|> map { peer, businessLinks in
|
|> map { data, settings in
|
||||||
|
let (peer, businessLinks) = data
|
||||||
|
|
||||||
var accountPeer: TelegramUser?
|
var accountPeer: TelegramUser?
|
||||||
if case let .user(user) = peer {
|
if case let .user(user) = peer {
|
||||||
accountPeer = user
|
accountPeer = user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var displayPhone = true
|
||||||
|
if let settings {
|
||||||
|
displayPhone = settings.phoneDiscoveryEnabled
|
||||||
|
}
|
||||||
|
|
||||||
return InitialData(
|
return InitialData(
|
||||||
accountPeer: accountPeer,
|
accountPeer: accountPeer,
|
||||||
businessLinks: businessLinks
|
businessLinks: businessLinks,
|
||||||
|
displayPhone: displayPhone
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -674,6 +674,9 @@ final class BusinessIntroSetupScreenComponent: Component {
|
|||||||
contentHeight += environment.navigationHeight
|
contentHeight += environment.navigationHeight
|
||||||
contentHeight += 26.0
|
contentHeight += 26.0
|
||||||
|
|
||||||
|
let maxTitleLength = 32
|
||||||
|
let maxTextLength = 70
|
||||||
|
|
||||||
self.recenterOnTag = nil
|
self.recenterOnTag = nil
|
||||||
if let hint = transition.userData(TextFieldComponent.AnimationHint.self), let targetView = hint.view {
|
if let hint = transition.userData(TextFieldComponent.AnimationHint.self), let targetView = hint.view {
|
||||||
if let titleView = self.introSection.findTaggedView(tag: self.titleInputTag) {
|
if let titleView = self.introSection.findTaggedView(tag: self.titleInputTag) {
|
||||||
@ -703,7 +706,7 @@ final class BusinessIntroSetupScreenComponent: Component {
|
|||||||
autocapitalizationType: .none,
|
autocapitalizationType: .none,
|
||||||
autocorrectionType: .no,
|
autocorrectionType: .no,
|
||||||
returnKeyType: .next,
|
returnKeyType: .next,
|
||||||
characterLimit: 32,
|
characterLimit: maxTitleLength,
|
||||||
displayCharacterLimit: true,
|
displayCharacterLimit: true,
|
||||||
emptyLineHandling: .notAllowed,
|
emptyLineHandling: .notAllowed,
|
||||||
updated: { _ in
|
updated: { _ in
|
||||||
@ -839,14 +842,16 @@ final class BusinessIntroSetupScreenComponent: Component {
|
|||||||
if self.titleInputState.text.string.isEmpty {
|
if self.titleInputState.text.string.isEmpty {
|
||||||
titleText = environment.strings.Conversation_EmptyPlaceholder
|
titleText = environment.strings.Conversation_EmptyPlaceholder
|
||||||
} else {
|
} else {
|
||||||
titleText = self.titleInputState.text.string
|
let rawTitle = self.titleInputState.text.string
|
||||||
|
titleText = rawTitle.count <= maxTitleLength ? rawTitle : String(rawTitle[rawTitle.startIndex ..< rawTitle.index(rawTitle.startIndex, offsetBy: maxTitleLength)])
|
||||||
}
|
}
|
||||||
|
|
||||||
let textText: String
|
let textText: String
|
||||||
if self.textInputState.text.string.isEmpty {
|
if self.textInputState.text.string.isEmpty {
|
||||||
textText = environment.strings.Conversation_GreetingText
|
textText = environment.strings.Conversation_GreetingText
|
||||||
} else {
|
} else {
|
||||||
textText = self.textInputState.text.string
|
let rawText = self.textInputState.text.string
|
||||||
|
textText = rawText.count <= maxTextLength ? rawText : String(rawText[rawText.startIndex ..< rawText.index(rawText.startIndex, offsetBy: maxTextLength)])
|
||||||
}
|
}
|
||||||
|
|
||||||
let introContentSize = self.introContent.update(
|
let introContentSize = self.introContent.update(
|
||||||
|
|||||||
@ -331,6 +331,12 @@ public final class TextFieldComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let attributedString = attributedString {
|
if let attributedString = attributedString {
|
||||||
|
let current = self.inputState
|
||||||
|
let range = NSMakeRange(current.selectionRange.lowerBound, current.selectionRange.count)
|
||||||
|
if !self.chatInputTextNode(shouldChangeTextIn: range, replacementText: attributedString.string) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
self.updateInputState { current in
|
self.updateInputState { current in
|
||||||
if let inputText = current.inputText.mutableCopy() as? NSMutableAttributedString {
|
if let inputText = current.inputText.mutableCopy() as? NSMutableAttributedString {
|
||||||
inputText.replaceCharacters(in: NSMakeRange(current.selectionRange.lowerBound, current.selectionRange.count), with: attributedString)
|
inputText.replaceCharacters(in: NSMakeRange(current.selectionRange.lowerBound, current.selectionRange.count), with: attributedString)
|
||||||
|
|||||||
@ -761,7 +761,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .businessLinkSetup(link):
|
case let .businessLinkSetup(link):
|
||||||
let inputText = strongSelf.presentationInterfaceState.interfaceState.effectiveInputState.inputText
|
var inputText = convertMarkdownToAttributes(strongSelf.presentationInterfaceState.interfaceState.effectiveInputState.inputText)
|
||||||
|
inputText = trimChatInputText(inputText)
|
||||||
let entities = generateChatInputTextEntities(inputText, generateLinks: false)
|
let entities = generateChatInputTextEntities(inputText, generateLinks: false)
|
||||||
|
|
||||||
let message = inputText.string
|
let message = inputText.string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user