mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Refactor string generation
This commit is contained in:
@@ -71,14 +71,14 @@ private enum ResetPasswordEntry: ItemListNodeEntry, Equatable {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! ResetPasswordControllerArguments
|
||||
switch self {
|
||||
case let .code(theme, strings, text, value):
|
||||
case let .code(theme, _, text, value):
|
||||
return ItemListSingleLineInputItem(presentationData: presentationData, title: NSAttributedString(string: text, textColor: theme.list.itemPrimaryTextColor), text: value, placeholder: "", type: .number, spacing: 10.0, tag: ResetPasswordEntryTag.code, sectionId: self.section, textUpdated: { updatedText in
|
||||
arguments.updateCodeText(updatedText)
|
||||
}, action: {
|
||||
})
|
||||
case let .codeInfo(theme, text):
|
||||
case let .codeInfo(_, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||
case let .helpInfo(theme, text):
|
||||
case let .helpInfo(_, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .markdown(text), sectionId: self.section, linkAction: { action in
|
||||
if case .tap = action {
|
||||
arguments.openHelp()
|
||||
@@ -100,10 +100,10 @@ private func resetPasswordControllerEntries(presentationData: PresentationData,
|
||||
entries.append(.codeInfo(presentationData.theme, presentationData.strings.TwoStepAuth_RecoveryCodeHelp))
|
||||
|
||||
let stringData = presentationData.strings.TwoStepAuth_RecoveryEmailUnavailable(pattern)
|
||||
var string = stringData.0
|
||||
if let (_, range) = stringData.1.first {
|
||||
string.insert(contentsOf: "]()", at: string.index(string.startIndex, offsetBy: range.upperBound))
|
||||
string.insert(contentsOf: "[", at: string.index(string.startIndex, offsetBy: range.lowerBound))
|
||||
var string = stringData.string
|
||||
if let range = stringData.ranges.first {
|
||||
string.insert(contentsOf: "]()", at: string.index(string.startIndex, offsetBy: range.range.upperBound))
|
||||
string.insert(contentsOf: "[", at: string.index(string.startIndex, offsetBy: range.range.lowerBound))
|
||||
}
|
||||
entries.append(.helpInfo(presentationData.theme, string))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user