mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Refactor TextFormat
This commit is contained in:
22
submodules/TextFormat/Info.plist
Normal file
22
submodules/TextFormat/Info.plist
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>$(PRODUCT_NAME)</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -7,19 +7,19 @@ import TelegramPresentationData
|
|||||||
|
|
||||||
private let alphanumericCharacters = CharacterSet.alphanumerics
|
private let alphanumericCharacters = CharacterSet.alphanumerics
|
||||||
|
|
||||||
struct ChatTextInputAttributes {
|
public struct ChatTextInputAttributes {
|
||||||
static let bold = NSAttributedStringKey(rawValue: "Attribute__Bold")
|
public static let bold = NSAttributedString.Key(rawValue: "Attribute__Bold")
|
||||||
static let italic = NSAttributedStringKey(rawValue: "Attribute__Italic")
|
public static let italic = NSAttributedString.Key(rawValue: "Attribute__Italic")
|
||||||
static let monospace = NSAttributedStringKey(rawValue: "Attribute__Monospace")
|
public static let monospace = NSAttributedString.Key(rawValue: "Attribute__Monospace")
|
||||||
static let strikethrough = NSAttributedStringKey(rawValue: "Attribute__Strikethrough")
|
public static let strikethrough = NSAttributedString.Key(rawValue: "Attribute__Strikethrough")
|
||||||
static let underline = NSAttributedStringKey(rawValue: "Attribute__Underline")
|
public static let underline = NSAttributedString.Key(rawValue: "Attribute__Underline")
|
||||||
static let textMention = NSAttributedStringKey(rawValue: "Attribute__TextMention")
|
public static let textMention = NSAttributedString.Key(rawValue: "Attribute__TextMention")
|
||||||
static let textUrl = NSAttributedStringKey(rawValue: "Attribute__TextUrl")
|
public static let textUrl = NSAttributedString.Key(rawValue: "Attribute__TextUrl")
|
||||||
|
|
||||||
static let allAttributes = [ChatTextInputAttributes.bold, ChatTextInputAttributes.italic, ChatTextInputAttributes.monospace, ChatTextInputAttributes.strikethrough, ChatTextInputAttributes.underline, ChatTextInputAttributes.textMention, ChatTextInputAttributes.textUrl]
|
public static let allAttributes = [ChatTextInputAttributes.bold, ChatTextInputAttributes.italic, ChatTextInputAttributes.monospace, ChatTextInputAttributes.strikethrough, ChatTextInputAttributes.underline, ChatTextInputAttributes.textMention, ChatTextInputAttributes.textUrl]
|
||||||
}
|
}
|
||||||
|
|
||||||
func stateAttributedStringForText(_ text: NSAttributedString) -> NSAttributedString {
|
public func stateAttributedStringForText(_ text: NSAttributedString) -> NSAttributedString {
|
||||||
let result = NSMutableAttributedString(string: text.string)
|
let result = NSMutableAttributedString(string: text.string)
|
||||||
let fullRange = NSRange(location: 0, length: result.length)
|
let fullRange = NSRange(location: 0, length: result.length)
|
||||||
|
|
||||||
@@ -33,21 +33,25 @@ func stateAttributedStringForText(_ text: NSAttributedString) -> NSAttributedStr
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ChatTextFontAttributes: OptionSet {
|
public struct ChatTextFontAttributes: OptionSet {
|
||||||
var rawValue: Int32 = 0
|
public var rawValue: Int32 = 0
|
||||||
|
|
||||||
static let bold = ChatTextFontAttributes(rawValue: 1 << 0)
|
public init(rawValue: Int32) {
|
||||||
static let italic = ChatTextFontAttributes(rawValue: 1 << 1)
|
self.rawValue = rawValue
|
||||||
static let monospace = ChatTextFontAttributes(rawValue: 1 << 2)
|
}
|
||||||
static let blockQuote = ChatTextFontAttributes(rawValue: 1 << 3)
|
|
||||||
|
public static let bold = ChatTextFontAttributes(rawValue: 1 << 0)
|
||||||
|
public static let italic = ChatTextFontAttributes(rawValue: 1 << 1)
|
||||||
|
public static let monospace = ChatTextFontAttributes(rawValue: 1 << 2)
|
||||||
|
public static let blockQuote = ChatTextFontAttributes(rawValue: 1 << 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func textAttributedStringForStateText(_ stateText: NSAttributedString, fontSize: CGFloat, textColor: UIColor, accentTextColor: UIColor) -> NSAttributedString {
|
public func textAttributedStringForStateText(_ stateText: NSAttributedString, fontSize: CGFloat, textColor: UIColor, accentTextColor: UIColor) -> NSAttributedString {
|
||||||
let result = NSMutableAttributedString(string: stateText.string)
|
let result = NSMutableAttributedString(string: stateText.string)
|
||||||
let fullRange = NSRange(location: 0, length: result.length)
|
let fullRange = NSRange(location: 0, length: result.length)
|
||||||
|
|
||||||
result.addAttribute(NSAttributedStringKey.font, value: Font.regular(fontSize), range: fullRange)
|
result.addAttribute(NSAttributedString.Key.font, value: Font.regular(fontSize), range: fullRange)
|
||||||
result.addAttribute(NSAttributedStringKey.foregroundColor, value: textColor, range: fullRange)
|
result.addAttribute(NSAttributedString.Key.foregroundColor, value: textColor, range: fullRange)
|
||||||
|
|
||||||
stateText.enumerateAttributes(in: fullRange, options: [], using: { attributes, range, _ in
|
stateText.enumerateAttributes(in: fullRange, options: [], using: { attributes, range, _ in
|
||||||
var fontAttributes: ChatTextFontAttributes = []
|
var fontAttributes: ChatTextFontAttributes = []
|
||||||
@@ -55,9 +59,9 @@ func textAttributedStringForStateText(_ stateText: NSAttributedString, fontSize:
|
|||||||
for (key, value) in attributes {
|
for (key, value) in attributes {
|
||||||
if key == ChatTextInputAttributes.textMention || key == ChatTextInputAttributes.textUrl {
|
if key == ChatTextInputAttributes.textMention || key == ChatTextInputAttributes.textUrl {
|
||||||
result.addAttribute(key, value: value, range: range)
|
result.addAttribute(key, value: value, range: range)
|
||||||
result.addAttribute(NSAttributedStringKey.foregroundColor, value: accentTextColor, range: range)
|
result.addAttribute(NSAttributedString.Key.foregroundColor, value: accentTextColor, range: range)
|
||||||
if accentTextColor.isEqual(textColor) {
|
if accentTextColor.isEqual(textColor) {
|
||||||
result.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
result.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
} else if key == ChatTextInputAttributes.bold {
|
} else if key == ChatTextInputAttributes.bold {
|
||||||
result.addAttribute(key, value: value, range: range)
|
result.addAttribute(key, value: value, range: range)
|
||||||
@@ -70,10 +74,10 @@ func textAttributedStringForStateText(_ stateText: NSAttributedString, fontSize:
|
|||||||
fontAttributes.insert(.monospace)
|
fontAttributes.insert(.monospace)
|
||||||
} else if key == ChatTextInputAttributes.strikethrough {
|
} else if key == ChatTextInputAttributes.strikethrough {
|
||||||
result.addAttribute(key, value: value, range: range)
|
result.addAttribute(key, value: value, range: range)
|
||||||
result.addAttribute(NSAttributedStringKey.strikethroughStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
result.addAttribute(NSAttributedString.Key.strikethroughStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
} else if key == ChatTextInputAttributes.underline {
|
} else if key == ChatTextInputAttributes.underline {
|
||||||
result.addAttribute(key, value: value, range: range)
|
result.addAttribute(key, value: value, range: range)
|
||||||
result.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
result.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,23 +100,23 @@ func textAttributedStringForStateText(_ stateText: NSAttributedString, fontSize:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let font = font {
|
if let font = font {
|
||||||
result.addAttribute(NSAttributedStringKey.font, value: font, range: range)
|
result.addAttribute(NSAttributedString.Key.font, value: font, range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
final class ChatTextInputTextMentionAttribute: NSObject {
|
public final class ChatTextInputTextMentionAttribute: NSObject {
|
||||||
let peerId: PeerId
|
public let peerId: PeerId
|
||||||
|
|
||||||
init(peerId: PeerId) {
|
public init(peerId: PeerId) {
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func isEqual(_ object: Any?) -> Bool {
|
override public func isEqual(_ object: Any?) -> Bool {
|
||||||
if let other = object as? ChatTextInputTextMentionAttribute {
|
if let other = object as? ChatTextInputTextMentionAttribute {
|
||||||
return self.peerId == other.peerId
|
return self.peerId == other.peerId
|
||||||
} else {
|
} else {
|
||||||
@@ -133,16 +137,16 @@ private func textMentionRangesEqual(_ lhs: [(NSRange, ChatTextInputTextMentionAt
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
final class ChatTextInputTextUrlAttribute: NSObject {
|
public final class ChatTextInputTextUrlAttribute: NSObject {
|
||||||
let url: String
|
public let url: String
|
||||||
|
|
||||||
init(url: String) {
|
public init(url: String) {
|
||||||
self.url = url
|
self.url = url
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func isEqual(_ object: Any?) -> Bool {
|
override public func isEqual(_ object: Any?) -> Bool {
|
||||||
if let other = object as? ChatTextInputTextUrlAttribute {
|
if let other = object as? ChatTextInputTextUrlAttribute {
|
||||||
return self.url == other.url
|
return self.url == other.url
|
||||||
} else {
|
} else {
|
||||||
@@ -395,7 +399,7 @@ private func refreshTextUrls(text: NSString, initialAttributedText: NSAttributed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func refreshChatTextInputAttributes(_ textNode: ASEditableTextNode, theme: PresentationTheme, baseFontSize: CGFloat) {
|
public func refreshChatTextInputAttributes(_ textNode: ASEditableTextNode, theme: PresentationTheme, baseFontSize: CGFloat) {
|
||||||
guard let initialAttributedText = textNode.attributedText, initialAttributedText.length != 0 else {
|
guard let initialAttributedText = textNode.attributedText, initialAttributedText.length != 0 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -415,15 +419,15 @@ func refreshChatTextInputAttributes(_ textNode: ASEditableTextNode, theme: Prese
|
|||||||
resultAttributedText = textAttributedStringForStateText(attributedText, fontSize: baseFontSize, textColor: theme.chat.inputPanel.primaryTextColor, accentTextColor: theme.chat.inputPanel.panelControlAccentColor)
|
resultAttributedText = textAttributedStringForStateText(attributedText, fontSize: baseFontSize, textColor: theme.chat.inputPanel.primaryTextColor, accentTextColor: theme.chat.inputPanel.panelControlAccentColor)
|
||||||
|
|
||||||
if !resultAttributedText.isEqual(to: initialAttributedText) {
|
if !resultAttributedText.isEqual(to: initialAttributedText) {
|
||||||
textNode.textView.textStorage.removeAttribute(NSAttributedStringKey.font, range: fullRange)
|
textNode.textView.textStorage.removeAttribute(NSAttributedString.Key.font, range: fullRange)
|
||||||
textNode.textView.textStorage.removeAttribute(NSAttributedStringKey.foregroundColor, range: fullRange)
|
textNode.textView.textStorage.removeAttribute(NSAttributedString.Key.foregroundColor, range: fullRange)
|
||||||
textNode.textView.textStorage.removeAttribute(NSAttributedStringKey.underlineStyle, range: fullRange)
|
textNode.textView.textStorage.removeAttribute(NSAttributedString.Key.underlineStyle, range: fullRange)
|
||||||
textNode.textView.textStorage.removeAttribute(NSAttributedStringKey.strikethroughStyle, range: fullRange)
|
textNode.textView.textStorage.removeAttribute(NSAttributedString.Key.strikethroughStyle, range: fullRange)
|
||||||
textNode.textView.textStorage.removeAttribute(ChatTextInputAttributes.textMention, range: fullRange)
|
textNode.textView.textStorage.removeAttribute(ChatTextInputAttributes.textMention, range: fullRange)
|
||||||
textNode.textView.textStorage.removeAttribute(ChatTextInputAttributes.textUrl, range: fullRange)
|
textNode.textView.textStorage.removeAttribute(ChatTextInputAttributes.textUrl, range: fullRange)
|
||||||
|
|
||||||
textNode.textView.textStorage.addAttribute(NSAttributedStringKey.font, value: Font.regular(baseFontSize), range: fullRange)
|
textNode.textView.textStorage.addAttribute(NSAttributedString.Key.font, value: Font.regular(baseFontSize), range: fullRange)
|
||||||
textNode.textView.textStorage.addAttribute(NSAttributedStringKey.foregroundColor, value: theme.chat.inputPanel.primaryTextColor, range: fullRange)
|
textNode.textView.textStorage.addAttribute(NSAttributedString.Key.foregroundColor, value: theme.chat.inputPanel.primaryTextColor, range: fullRange)
|
||||||
|
|
||||||
attributedText.enumerateAttributes(in: fullRange, options: [], using: { attributes, range, _ in
|
attributedText.enumerateAttributes(in: fullRange, options: [], using: { attributes, range, _ in
|
||||||
var fontAttributes: ChatTextFontAttributes = []
|
var fontAttributes: ChatTextFontAttributes = []
|
||||||
@@ -431,10 +435,10 @@ func refreshChatTextInputAttributes(_ textNode: ASEditableTextNode, theme: Prese
|
|||||||
for (key, value) in attributes {
|
for (key, value) in attributes {
|
||||||
if key == ChatTextInputAttributes.textMention || key == ChatTextInputAttributes.textUrl {
|
if key == ChatTextInputAttributes.textMention || key == ChatTextInputAttributes.textUrl {
|
||||||
textNode.textView.textStorage.addAttribute(key, value: value, range: range)
|
textNode.textView.textStorage.addAttribute(key, value: value, range: range)
|
||||||
textNode.textView.textStorage.addAttribute(NSAttributedStringKey.foregroundColor, value: theme.chat.inputPanel.panelControlAccentColor, range: range)
|
textNode.textView.textStorage.addAttribute(NSAttributedString.Key.foregroundColor, value: theme.chat.inputPanel.panelControlAccentColor, range: range)
|
||||||
|
|
||||||
if theme.chat.inputPanel.panelControlAccentColor.isEqual(theme.chat.inputPanel.primaryTextColor) {
|
if theme.chat.inputPanel.panelControlAccentColor.isEqual(theme.chat.inputPanel.primaryTextColor) {
|
||||||
textNode.textView.textStorage.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
textNode.textView.textStorage.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
} else if key == ChatTextInputAttributes.bold {
|
} else if key == ChatTextInputAttributes.bold {
|
||||||
textNode.textView.textStorage.addAttribute(key, value: value, range: range)
|
textNode.textView.textStorage.addAttribute(key, value: value, range: range)
|
||||||
@@ -447,10 +451,10 @@ func refreshChatTextInputAttributes(_ textNode: ASEditableTextNode, theme: Prese
|
|||||||
fontAttributes.insert(.monospace)
|
fontAttributes.insert(.monospace)
|
||||||
} else if key == ChatTextInputAttributes.strikethrough {
|
} else if key == ChatTextInputAttributes.strikethrough {
|
||||||
textNode.textView.textStorage.addAttribute(key, value: value, range: range)
|
textNode.textView.textStorage.addAttribute(key, value: value, range: range)
|
||||||
textNode.textView.textStorage.addAttribute(NSAttributedStringKey.strikethroughStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
textNode.textView.textStorage.addAttribute(NSAttributedString.Key.strikethroughStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
} else if key == ChatTextInputAttributes.underline {
|
} else if key == ChatTextInputAttributes.underline {
|
||||||
textNode.textView.textStorage.addAttribute(key, value: value, range: range)
|
textNode.textView.textStorage.addAttribute(key, value: value, range: range)
|
||||||
textNode.textView.textStorage.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
textNode.textView.textStorage.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,109 +477,35 @@ func refreshChatTextInputAttributes(_ textNode: ASEditableTextNode, theme: Prese
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let font = font {
|
if let font = font {
|
||||||
textNode.textView.textStorage.addAttribute(NSAttributedStringKey.font, value: font, range: range)
|
textNode.textView.textStorage.addAttribute(NSAttributedString.Key.font, value: font, range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func refreshChatTextInputTypingAttributes(_ textNode: ASEditableTextNode, theme: PresentationTheme, baseFontSize: CGFloat) {
|
public func refreshChatTextInputTypingAttributes(_ textNode: ASEditableTextNode, theme: PresentationTheme, baseFontSize: CGFloat) {
|
||||||
var filteredAttributes: [String: Any] = [
|
var filteredAttributes: [NSAttributedString.Key: Any] = [
|
||||||
NSAttributedStringKey.font.rawValue: Font.regular(baseFontSize),
|
NSAttributedString.Key.font: Font.regular(baseFontSize),
|
||||||
NSAttributedStringKey.foregroundColor.rawValue: theme.chat.inputPanel.primaryTextColor
|
NSAttributedString.Key.foregroundColor: theme.chat.inputPanel.primaryTextColor
|
||||||
]
|
]
|
||||||
if let attributedText = textNode.attributedText, attributedText.length != 0 {
|
if let attributedText = textNode.attributedText, attributedText.length != 0 {
|
||||||
let attributes = attributedText.attributes(at: max(0, min(textNode.selectedRange.location - 1, attributedText.length - 1)), effectiveRange: nil)
|
let attributes = attributedText.attributes(at: max(0, min(textNode.selectedRange.location - 1, attributedText.length - 1)), effectiveRange: nil)
|
||||||
for (key, value) in attributes {
|
for (key, value) in attributes {
|
||||||
if key == ChatTextInputAttributes.bold {
|
if key == ChatTextInputAttributes.bold {
|
||||||
filteredAttributes[key.rawValue] = value
|
filteredAttributes[key] = value
|
||||||
} else if key == ChatTextInputAttributes.italic {
|
} else if key == ChatTextInputAttributes.italic {
|
||||||
filteredAttributes[key.rawValue] = value
|
filteredAttributes[key] = value
|
||||||
} else if key == ChatTextInputAttributes.monospace {
|
} else if key == ChatTextInputAttributes.monospace {
|
||||||
filteredAttributes[key.rawValue] = value
|
filteredAttributes[key] = value
|
||||||
} else if key == NSAttributedStringKey.font {
|
} else if key == NSAttributedString.Key.font {
|
||||||
filteredAttributes[key.rawValue] = value
|
filteredAttributes[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
textNode.textView.typingAttributes = filteredAttributes
|
textNode.textView.typingAttributes = filteredAttributes
|
||||||
}
|
}
|
||||||
|
|
||||||
func chatTextInputAddFormattingAttribute(_ state: ChatTextInputState, attribute: NSAttributedStringKey) -> ChatTextInputState {
|
|
||||||
if !state.selectionRange.isEmpty {
|
|
||||||
let nsRange = NSRange(location: state.selectionRange.lowerBound, length: state.selectionRange.count)
|
|
||||||
var addAttribute = true
|
|
||||||
var attributesToRemove: [NSAttributedStringKey] = []
|
|
||||||
state.inputText.enumerateAttributes(in: nsRange, options: .longestEffectiveRangeNotRequired) { attributes, range, stop in
|
|
||||||
for (key, _) in attributes {
|
|
||||||
if key == attribute && range == nsRange {
|
|
||||||
addAttribute = false
|
|
||||||
attributesToRemove.append(key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let result = NSMutableAttributedString(attributedString: state.inputText)
|
|
||||||
for attribute in attributesToRemove {
|
|
||||||
result.removeAttribute(attribute, range: nsRange)
|
|
||||||
}
|
|
||||||
if addAttribute {
|
|
||||||
result.addAttribute(attribute, value: true as Bool, range: nsRange)
|
|
||||||
}
|
|
||||||
return ChatTextInputState(inputText: result, selectionRange: state.selectionRange)
|
|
||||||
} else {
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func chatTextInputClearFormattingAttributes(_ state: ChatTextInputState) -> ChatTextInputState {
|
|
||||||
if !state.selectionRange.isEmpty {
|
|
||||||
let nsRange = NSRange(location: state.selectionRange.lowerBound, length: state.selectionRange.count)
|
|
||||||
var attributesToRemove: [NSAttributedStringKey] = []
|
|
||||||
state.inputText.enumerateAttributes(in: nsRange, options: .longestEffectiveRangeNotRequired) { attributes, range, stop in
|
|
||||||
for (key, _) in attributes {
|
|
||||||
attributesToRemove.append(key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let result = NSMutableAttributedString(attributedString: state.inputText)
|
|
||||||
for attribute in attributesToRemove {
|
|
||||||
result.removeAttribute(attribute, range: nsRange)
|
|
||||||
}
|
|
||||||
return ChatTextInputState(inputText: result, selectionRange: state.selectionRange)
|
|
||||||
} else {
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func chatTextInputAddLinkAttribute(_ state: ChatTextInputState, url: String) -> ChatTextInputState {
|
|
||||||
if !state.selectionRange.isEmpty {
|
|
||||||
let nsRange = NSRange(location: state.selectionRange.lowerBound, length: state.selectionRange.count)
|
|
||||||
var linkRange = nsRange
|
|
||||||
var attributesToRemove: [(NSAttributedStringKey, NSRange)] = []
|
|
||||||
state.inputText.enumerateAttributes(in: nsRange, options: .longestEffectiveRangeNotRequired) { attributes, range, stop in
|
|
||||||
for (key, _) in attributes {
|
|
||||||
if key == ChatTextInputAttributes.textUrl {
|
|
||||||
attributesToRemove.append((key, range))
|
|
||||||
linkRange = linkRange.union(range)
|
|
||||||
} else {
|
|
||||||
attributesToRemove.append((key, nsRange))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let result = NSMutableAttributedString(attributedString: state.inputText)
|
|
||||||
for (attribute, range) in attributesToRemove {
|
|
||||||
result.removeAttribute(attribute, range: range)
|
|
||||||
}
|
|
||||||
result.addAttribute(ChatTextInputAttributes.textUrl, value: ChatTextInputTextUrlAttribute(url: url), range: nsRange)
|
|
||||||
return ChatTextInputState(inputText: result, selectionRange: state.selectionRange)
|
|
||||||
} else {
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func trimRangesForChatInputText(_ text: NSAttributedString) -> (Int, Int) {
|
private func trimRangesForChatInputText(_ text: NSAttributedString) -> (Int, Int) {
|
||||||
var lower = 0
|
var lower = 0
|
||||||
var upper = 0
|
var upper = 0
|
||||||
@@ -611,7 +541,7 @@ private func trimRangesForChatInputText(_ text: NSAttributedString) -> (Int, Int
|
|||||||
return (lower, upper)
|
return (lower, upper)
|
||||||
}
|
}
|
||||||
|
|
||||||
func trimChatInputText(_ text: NSAttributedString) -> NSAttributedString {
|
public func trimChatInputText(_ text: NSAttributedString) -> NSAttributedString {
|
||||||
let (lower, upper) = trimRangesForChatInputText(text)
|
let (lower, upper) = trimRangesForChatInputText(text)
|
||||||
if lower == 0 && upper == 0 {
|
if lower == 0 && upper == 0 {
|
||||||
return text
|
return text
|
||||||
@@ -627,7 +557,7 @@ func trimChatInputText(_ text: NSAttributedString) -> NSAttributedString {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func breakChatInputText(_ text: NSAttributedString) -> [NSAttributedString] {
|
public func breakChatInputText(_ text: NSAttributedString) -> [NSAttributedString] {
|
||||||
if text.length <= 4000 {
|
if text.length <= 4000 {
|
||||||
return [text]
|
return [text]
|
||||||
} else {
|
} else {
|
||||||
@@ -656,7 +586,7 @@ func breakChatInputText(_ text: NSAttributedString) -> [NSAttributedString] {
|
|||||||
private let markdownRegexFormat = "(^|\\s|\\n)(````?)([\\s\\S]+?)(````?)([\\s\\n\\.,:?!;]|$)|(^|\\s)(`|\\*\\*|__|~~)([^\\n]+?)\\7([\\s\\.,:?!;]|$)|@(\\d+)\\s*\\((.+?)\\)"
|
private let markdownRegexFormat = "(^|\\s|\\n)(````?)([\\s\\S]+?)(````?)([\\s\\n\\.,:?!;]|$)|(^|\\s)(`|\\*\\*|__|~~)([^\\n]+?)\\7([\\s\\.,:?!;]|$)|@(\\d+)\\s*\\((.+?)\\)"
|
||||||
private let markdownRegex = try? NSRegularExpression(pattern: markdownRegexFormat, options: [.caseInsensitive, .anchorsMatchLines])
|
private let markdownRegex = try? NSRegularExpression(pattern: markdownRegexFormat, options: [.caseInsensitive, .anchorsMatchLines])
|
||||||
|
|
||||||
func convertMarkdownToAttributes(_ text: NSAttributedString) -> NSAttributedString {
|
public func convertMarkdownToAttributes(_ text: NSAttributedString) -> NSAttributedString {
|
||||||
var string = text.string as NSString
|
var string = text.string as NSString
|
||||||
|
|
||||||
var offsetRanges:[(NSRange, Int)] = []
|
var offsetRanges:[(NSRange, Int)] = []
|
||||||
@@ -40,7 +40,7 @@ private let validTimecodeSet: CharacterSet = {
|
|||||||
return set
|
return set
|
||||||
}()
|
}()
|
||||||
|
|
||||||
struct ApplicationSpecificEntityType {
|
public struct ApplicationSpecificEntityType {
|
||||||
public static let Timecode: Int32 = 1
|
public static let Timecode: Int32 = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,16 +53,16 @@ private enum CurrentEntityType {
|
|||||||
|
|
||||||
var type: EnabledEntityTypes {
|
var type: EnabledEntityTypes {
|
||||||
switch self {
|
switch self {
|
||||||
case .command:
|
case .command:
|
||||||
return .command
|
return .command
|
||||||
case .mention:
|
case .mention:
|
||||||
return .mention
|
return .mention
|
||||||
case .hashtag:
|
case .hashtag:
|
||||||
return .hashtag
|
return .hashtag
|
||||||
case .phoneNumber:
|
case .phoneNumber:
|
||||||
return .phoneNumber
|
return .phoneNumber
|
||||||
case .timecode:
|
case .timecode:
|
||||||
return .timecode
|
return .timecode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,17 +99,17 @@ private func commitEntity(_ utf16: String.UTF16View, _ type: CurrentEntityType,
|
|||||||
}
|
}
|
||||||
if !overlaps {
|
if !overlaps {
|
||||||
let entityType: MessageTextEntityType
|
let entityType: MessageTextEntityType
|
||||||
switch type {
|
switch type {
|
||||||
case .command:
|
case .command:
|
||||||
entityType = .BotCommand
|
entityType = .BotCommand
|
||||||
case .mention:
|
case .mention:
|
||||||
entityType = .Mention
|
entityType = .Mention
|
||||||
case .hashtag:
|
case .hashtag:
|
||||||
entityType = .Hashtag
|
entityType = .Hashtag
|
||||||
case .phoneNumber:
|
case .phoneNumber:
|
||||||
entityType = .PhoneNumber
|
entityType = .PhoneNumber
|
||||||
case .timecode:
|
case .timecode:
|
||||||
entityType = .Custom(type: ApplicationSpecificEntityType.Timecode)
|
entityType = .Custom(type: ApplicationSpecificEntityType.Timecode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if case .timecode = type {
|
if case .timecode = type {
|
||||||
@@ -122,7 +122,7 @@ private func commitEntity(_ utf16: String.UTF16View, _ type: CurrentEntityType,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateChatInputTextEntities(_ text: NSAttributedString) -> [MessageTextEntity] {
|
public func generateChatInputTextEntities(_ text: NSAttributedString) -> [MessageTextEntity] {
|
||||||
var entities: [MessageTextEntity] = []
|
var entities: [MessageTextEntity] = []
|
||||||
text.enumerateAttributes(in: NSRange(location: 0, length: text.length), options: [], using: { attributes, range, _ in
|
text.enumerateAttributes(in: NSRange(location: 0, length: text.length), options: [], using: { attributes, range, _ in
|
||||||
for (key, value) in attributes {
|
for (key, value) in attributes {
|
||||||
@@ -220,30 +220,30 @@ public func generateTextEntities(_ text: String, enabledTypes: EnabledEntityType
|
|||||||
}
|
}
|
||||||
currentEntity = (.hashtag, index ..< index)
|
currentEntity = (.hashtag, index ..< index)
|
||||||
}
|
}
|
||||||
|
|
||||||
if notFound {
|
if notFound {
|
||||||
if let (type, range) = currentEntity {
|
if let (type, range) = currentEntity {
|
||||||
switch type {
|
switch type {
|
||||||
case .command, .mention:
|
case .command, .mention:
|
||||||
if validIdentifierSet.contains(scalar) {
|
if validIdentifierSet.contains(scalar) {
|
||||||
currentEntity = (type, range.lowerBound ..< utf16.index(after: index))
|
currentEntity = (type, range.lowerBound ..< utf16.index(after: index))
|
||||||
} else if delimiterSet.contains(scalar) {
|
} else if delimiterSet.contains(scalar) {
|
||||||
if let (type, range) = currentEntity {
|
if let (type, range) = currentEntity {
|
||||||
commitEntity(utf16, type, range, enabledTypes, &entities)
|
commitEntity(utf16, type, range, enabledTypes, &entities)
|
||||||
}
|
|
||||||
currentEntity = nil
|
|
||||||
}
|
}
|
||||||
case .hashtag:
|
currentEntity = nil
|
||||||
if validHashtagSet.contains(scalar) {
|
}
|
||||||
currentEntity = (type, range.lowerBound ..< utf16.index(after: index))
|
case .hashtag:
|
||||||
} else if delimiterSet.contains(scalar) {
|
if validHashtagSet.contains(scalar) {
|
||||||
if let (type, range) = currentEntity {
|
currentEntity = (type, range.lowerBound ..< utf16.index(after: index))
|
||||||
commitEntity(utf16, type, range, enabledTypes, &entities)
|
} else if delimiterSet.contains(scalar) {
|
||||||
}
|
if let (type, range) = currentEntity {
|
||||||
currentEntity = nil
|
commitEntity(utf16, type, range, enabledTypes, &entities)
|
||||||
}
|
}
|
||||||
default:
|
currentEntity = nil
|
||||||
break
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ public func generateTextEntities(_ text: String, enabledTypes: EnabledEntityType
|
|||||||
return entities
|
return entities
|
||||||
}
|
}
|
||||||
|
|
||||||
func addLocallyGeneratedEntities(_ text: String, enabledTypes: EnabledEntityTypes, entities: [MessageTextEntity], mediaDuration: Double? = nil) -> [MessageTextEntity]? {
|
public func addLocallyGeneratedEntities(_ text: String, enabledTypes: EnabledEntityTypes, entities: [MessageTextEntity], mediaDuration: Double? = nil) -> [MessageTextEntity]? {
|
||||||
var resultEntities = entities
|
var resultEntities = entities
|
||||||
|
|
||||||
var hasDigits = false
|
var hasDigits = false
|
||||||
@@ -324,13 +324,13 @@ func addLocallyGeneratedEntities(_ text: String, enabledTypes: EnabledEntityType
|
|||||||
if notFound {
|
if notFound {
|
||||||
if let (type, range) = currentEntity {
|
if let (type, range) = currentEntity {
|
||||||
switch type {
|
switch type {
|
||||||
case .timecode:
|
case .timecode:
|
||||||
if delimiterSet.contains(scalar) {
|
if delimiterSet.contains(scalar) {
|
||||||
commitEntity(utf16, type, range, enabledTypes, &resultEntities, mediaDuration: mediaDuration)
|
commitEntity(utf16, type, range, enabledTypes, &resultEntities, mediaDuration: mediaDuration)
|
||||||
currentEntity = nil
|
currentEntity = nil
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,7 +351,7 @@ func addLocallyGeneratedEntities(_ text: String, enabledTypes: EnabledEntityType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseTimecodeString(_ string: String?) -> Double? {
|
public func parseTimecodeString(_ string: String?) -> Double? {
|
||||||
if let string = string, string.rangeOfCharacter(from: validTimecodeSet.inverted) == nil {
|
if let string = string, string.rangeOfCharacter(from: validTimecodeSet.inverted) == nil {
|
||||||
let components = string.components(separatedBy: ":")
|
let components = string.components(separatedBy: ":")
|
||||||
if components.count > 1 && components.count <= 3 {
|
if components.count > 1 && components.count <= 3 {
|
||||||
@@ -5,25 +5,25 @@ import Display
|
|||||||
private let controlStartCharactersSet = CharacterSet(charactersIn: "[*")
|
private let controlStartCharactersSet = CharacterSet(charactersIn: "[*")
|
||||||
private let controlCharactersSet = CharacterSet(charactersIn: "[]()*_-\\")
|
private let controlCharactersSet = CharacterSet(charactersIn: "[]()*_-\\")
|
||||||
|
|
||||||
final class MarkdownAttributeSet {
|
public final class MarkdownAttributeSet {
|
||||||
let font: UIFont
|
public let font: UIFont
|
||||||
let textColor: UIColor
|
public let textColor: UIColor
|
||||||
let additionalAttributes: [String: Any]
|
public let additionalAttributes: [String: Any]
|
||||||
|
|
||||||
init(font: UIFont, textColor: UIColor, additionalAttributes: [String: Any] = [:]) {
|
public init(font: UIFont, textColor: UIColor, additionalAttributes: [String: Any] = [:]) {
|
||||||
self.font = font
|
self.font = font
|
||||||
self.textColor = textColor
|
self.textColor = textColor
|
||||||
self.additionalAttributes = additionalAttributes
|
self.additionalAttributes = additionalAttributes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class MarkdownAttributes {
|
public final class MarkdownAttributes {
|
||||||
let body: MarkdownAttributeSet
|
public let body: MarkdownAttributeSet
|
||||||
let bold: MarkdownAttributeSet
|
public let bold: MarkdownAttributeSet
|
||||||
let link: MarkdownAttributeSet
|
public let link: MarkdownAttributeSet
|
||||||
let linkAttribute: (String) -> (String, Any)?
|
public let linkAttribute: (String) -> (String, Any)?
|
||||||
|
|
||||||
init(body: MarkdownAttributeSet, bold: MarkdownAttributeSet, link: MarkdownAttributeSet, linkAttribute: @escaping (String) -> (String, Any)?) {
|
public init(body: MarkdownAttributeSet, bold: MarkdownAttributeSet, link: MarkdownAttributeSet, linkAttribute: @escaping (String) -> (String, Any)?) {
|
||||||
self.body = body
|
self.body = body
|
||||||
self.link = link
|
self.link = link
|
||||||
self.bold = bold
|
self.bold = bold
|
||||||
@@ -31,7 +31,7 @@ final class MarkdownAttributes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func escapedPlaintextForMarkdown(_ string: String) -> String {
|
public func escapedPlaintextForMarkdown(_ string: String) -> String {
|
||||||
let nsString = string as NSString
|
let nsString = string as NSString
|
||||||
var remainingRange = NSMakeRange(0, nsString.length)
|
var remainingRange = NSMakeRange(0, nsString.length)
|
||||||
let result = NSMutableString()
|
let result = NSMutableString()
|
||||||
@@ -52,21 +52,21 @@ func escapedPlaintextForMarkdown(_ string: String) -> String {
|
|||||||
return result as String
|
return result as String
|
||||||
}
|
}
|
||||||
|
|
||||||
func paragraphStyleWithAlignment(_ alignment: NSTextAlignment) -> NSParagraphStyle {
|
public func paragraphStyleWithAlignment(_ alignment: NSTextAlignment) -> NSParagraphStyle {
|
||||||
let paragraphStyle = NSMutableParagraphStyle()
|
let paragraphStyle = NSMutableParagraphStyle()
|
||||||
paragraphStyle.alignment = alignment
|
paragraphStyle.alignment = alignment
|
||||||
return paragraphStyle
|
return paragraphStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseMarkdownIntoAttributedString(_ string: String, attributes: MarkdownAttributes, textAlignment: NSTextAlignment = .natural) -> NSAttributedString {
|
public func parseMarkdownIntoAttributedString(_ string: String, attributes: MarkdownAttributes, textAlignment: NSTextAlignment = .natural) -> NSAttributedString {
|
||||||
let nsString = string as NSString
|
let nsString = string as NSString
|
||||||
let result = NSMutableAttributedString()
|
let result = NSMutableAttributedString()
|
||||||
var remainingRange = NSMakeRange(0, nsString.length)
|
var remainingRange = NSMakeRange(0, nsString.length)
|
||||||
|
|
||||||
var bodyAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: attributes.body.font, NSAttributedStringKey.foregroundColor: attributes.body.textColor, NSAttributedStringKey.paragraphStyle: paragraphStyleWithAlignment(textAlignment)]
|
var bodyAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: attributes.body.font, NSAttributedString.Key.foregroundColor: attributes.body.textColor, NSAttributedString.Key.paragraphStyle: paragraphStyleWithAlignment(textAlignment)]
|
||||||
if !attributes.body.additionalAttributes.isEmpty {
|
if !attributes.body.additionalAttributes.isEmpty {
|
||||||
for (key, value) in attributes.body.additionalAttributes {
|
for (key, value) in attributes.body.additionalAttributes {
|
||||||
bodyAttributes[NSAttributedStringKey(rawValue: key)] = value
|
bodyAttributes[NSAttributedString.Key(rawValue: key)] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,14 +82,14 @@ func parseMarkdownIntoAttributedString(_ string: String, attributes: MarkdownAtt
|
|||||||
if character == UInt16(("[" as UnicodeScalar).value) {
|
if character == UInt16(("[" as UnicodeScalar).value) {
|
||||||
remainingRange = NSMakeRange(range.location + range.length, remainingRange.location + remainingRange.length - (range.location + range.length))
|
remainingRange = NSMakeRange(range.location + range.length, remainingRange.location + remainingRange.length - (range.location + range.length))
|
||||||
if let (parsedLinkText, parsedLinkContents) = parseLink(string: nsString, remainingRange: &remainingRange) {
|
if let (parsedLinkText, parsedLinkContents) = parseLink(string: nsString, remainingRange: &remainingRange) {
|
||||||
var linkAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: attributes.link.font, NSAttributedStringKey.foregroundColor: attributes.link.textColor, NSAttributedStringKey.paragraphStyle: paragraphStyleWithAlignment(textAlignment)]
|
var linkAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: attributes.link.font, NSAttributedString.Key.foregroundColor: attributes.link.textColor, NSAttributedString.Key.paragraphStyle: paragraphStyleWithAlignment(textAlignment)]
|
||||||
if !attributes.link.additionalAttributes.isEmpty {
|
if !attributes.link.additionalAttributes.isEmpty {
|
||||||
for (key, value) in attributes.link.additionalAttributes {
|
for (key, value) in attributes.link.additionalAttributes {
|
||||||
linkAttributes[NSAttributedStringKey(rawValue: key)] = value
|
linkAttributes[NSAttributedString.Key(rawValue: key)] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let (attributeName, attributeValue) = attributes.linkAttribute(parsedLinkContents) {
|
if let (attributeName, attributeValue) = attributes.linkAttribute(parsedLinkContents) {
|
||||||
linkAttributes[NSAttributedStringKey(rawValue: attributeName)] = attributeValue
|
linkAttributes[NSAttributedString.Key(rawValue: attributeName)] = attributeValue
|
||||||
}
|
}
|
||||||
result.append(NSAttributedString(string: parsedLinkText, attributes: linkAttributes))
|
result.append(NSAttributedString(string: parsedLinkText, attributes: linkAttributes))
|
||||||
}
|
}
|
||||||
@@ -100,10 +100,10 @@ func parseMarkdownIntoAttributedString(_ string: String, attributes: MarkdownAtt
|
|||||||
remainingRange = NSMakeRange(range.location + range.length + 1, remainingRange.location + remainingRange.length - (range.location + range.length + 1))
|
remainingRange = NSMakeRange(range.location + range.length + 1, remainingRange.location + remainingRange.length - (range.location + range.length + 1))
|
||||||
|
|
||||||
if let bold = parseBold(string: nsString, remainingRange: &remainingRange) {
|
if let bold = parseBold(string: nsString, remainingRange: &remainingRange) {
|
||||||
var boldAttributes: [NSAttributedStringKey: Any] = [NSAttributedStringKey.font: attributes.bold.font, NSAttributedStringKey.foregroundColor: attributes.bold.textColor, NSAttributedStringKey.paragraphStyle: paragraphStyleWithAlignment(textAlignment)]
|
var boldAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: attributes.bold.font, NSAttributedString.Key.foregroundColor: attributes.bold.textColor, NSAttributedString.Key.paragraphStyle: paragraphStyleWithAlignment(textAlignment)]
|
||||||
if !attributes.body.additionalAttributes.isEmpty {
|
if !attributes.body.additionalAttributes.isEmpty {
|
||||||
for (key, value) in attributes.bold.additionalAttributes {
|
for (key, value) in attributes.bold.additionalAttributes {
|
||||||
boldAttributes[NSAttributedStringKey(rawValue: key)] = value
|
boldAttributes[NSAttributedString.Key(rawValue: key)] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.append(NSAttributedString(string: bold, attributes: boldAttributes))
|
result.append(NSAttributedString(string: bold, attributes: boldAttributes))
|
||||||
@@ -163,6 +163,6 @@ private func parseBold(string: NSString, remainingRange: inout NSRange) -> Strin
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func foldMultipleLineBreaks(_ string: String) -> String {
|
public func foldMultipleLineBreaks(_ string: String) -> String {
|
||||||
return string.replacingOccurrences(of: "(([\n\r]\\s*){2,})+", with: "\n\n", options: .regularExpression, range: nil)
|
return string.replacingOccurrences(of: "(([\n\r]\\s*){2,})+", with: "\n\n", options: .regularExpression, range: nil)
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
|
|
||||||
func chatInputStateStringWithAppliedEntities(_ text: String, entities: [MessageTextEntity]) -> NSAttributedString {
|
public func chatInputStateStringWithAppliedEntities(_ text: String, entities: [MessageTextEntity]) -> NSAttributedString {
|
||||||
var nsString: NSString?
|
var nsString: NSString?
|
||||||
let string = NSMutableAttributedString(string: text)
|
let string = NSMutableAttributedString(string: text)
|
||||||
var skipEntity = false
|
var skipEntity = false
|
||||||
@@ -45,9 +45,9 @@ func chatInputStateStringWithAppliedEntities(_ text: String, entities: [MessageT
|
|||||||
return string
|
return string
|
||||||
}
|
}
|
||||||
|
|
||||||
func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], baseColor: UIColor, linkColor: UIColor, baseFont: UIFont, linkFont: UIFont, boldFont: UIFont, italicFont: UIFont, boldItalicFont: UIFont, fixedFont: UIFont, blockQuoteFont: UIFont, underlineLinks: Bool = true, external: Bool = false) -> NSAttributedString {
|
public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], baseColor: UIColor, linkColor: UIColor, baseFont: UIFont, linkFont: UIFont, boldFont: UIFont, italicFont: UIFont, boldItalicFont: UIFont, fixedFont: UIFont, blockQuoteFont: UIFont, underlineLinks: Bool = true, external: Bool = false) -> NSAttributedString {
|
||||||
var nsString: NSString?
|
var nsString: NSString?
|
||||||
let string = NSMutableAttributedString(string: text, attributes: [NSAttributedStringKey.font: baseFont, NSAttributedStringKey.foregroundColor: baseColor])
|
let string = NSMutableAttributedString(string: text, attributes: [NSAttributedString.Key.font: baseFont, NSAttributedString.Key.foregroundColor: baseColor])
|
||||||
var skipEntity = false
|
var skipEntity = false
|
||||||
var underlineAllLinks = false
|
var underlineAllLinks = false
|
||||||
if linkColor.isEqual(baseColor) {
|
if linkColor.isEqual(baseColor) {
|
||||||
@@ -73,44 +73,44 @@ func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], ba
|
|||||||
}
|
}
|
||||||
switch entity.type {
|
switch entity.type {
|
||||||
case .Url:
|
case .Url:
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if underlineLinks {
|
if underlineLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
if nsString == nil {
|
if nsString == nil {
|
||||||
nsString = text as NSString
|
nsString = text as NSString
|
||||||
}
|
}
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.URL), value: nsString!.substring(with: range), range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.URL), value: nsString!.substring(with: range), range: range)
|
||||||
case .Email:
|
case .Email:
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if nsString == nil {
|
if nsString == nil {
|
||||||
nsString = text as NSString
|
nsString = text as NSString
|
||||||
}
|
}
|
||||||
if underlineLinks && underlineAllLinks {
|
if underlineLinks && underlineAllLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.URL), value: "mailto:\(nsString!.substring(with: range))", range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.URL), value: "mailto:\(nsString!.substring(with: range))", range: range)
|
||||||
case .PhoneNumber:
|
case .PhoneNumber:
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if nsString == nil {
|
if nsString == nil {
|
||||||
nsString = text as NSString
|
nsString = text as NSString
|
||||||
}
|
}
|
||||||
if underlineLinks && underlineAllLinks {
|
if underlineLinks && underlineAllLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.URL), value: "tel:\(nsString!.substring(with: range))", range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.URL), value: "tel:\(nsString!.substring(with: range))", range: range)
|
||||||
case let .TextUrl(url):
|
case let .TextUrl(url):
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if nsString == nil {
|
if nsString == nil {
|
||||||
nsString = text as NSString
|
nsString = text as NSString
|
||||||
}
|
}
|
||||||
if underlineLinks && underlineAllLinks {
|
if underlineLinks && underlineAllLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
if external {
|
if external {
|
||||||
string.addAttribute(NSAttributedStringKey.link, value: url, range: range)
|
string.addAttribute(NSAttributedString.Key.link, value: url, range: range)
|
||||||
} else {
|
} else {
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.URL), value: url, range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.URL), value: url, range: range)
|
||||||
}
|
}
|
||||||
case .Bold:
|
case .Bold:
|
||||||
if let fontAttribute = fontAttributes[range] {
|
if let fontAttribute = fontAttributes[range] {
|
||||||
@@ -125,31 +125,31 @@ func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], ba
|
|||||||
fontAttributes[range] = .italic
|
fontAttributes[range] = .italic
|
||||||
}
|
}
|
||||||
case .Mention:
|
case .Mention:
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if underlineLinks && underlineAllLinks {
|
if underlineLinks && underlineAllLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
if linkFont !== baseFont {
|
if linkFont !== baseFont {
|
||||||
string.addAttribute(NSAttributedStringKey.font, value: linkFont, range: range)
|
string.addAttribute(NSAttributedString.Key.font, value: linkFont, range: range)
|
||||||
}
|
}
|
||||||
if nsString == nil {
|
if nsString == nil {
|
||||||
nsString = text as NSString
|
nsString = text as NSString
|
||||||
}
|
}
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.PeerTextMention), value: nsString!.substring(with: range), range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerTextMention), value: nsString!.substring(with: range), range: range)
|
||||||
case .Strikethrough:
|
case .Strikethrough:
|
||||||
string.addAttribute(NSAttributedStringKey.strikethroughStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.strikethroughStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
case .Underline:
|
case .Underline:
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
case let .TextMention(peerId):
|
case let .TextMention(peerId):
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if underlineLinks && underlineAllLinks {
|
if underlineLinks && underlineAllLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
if linkFont !== baseFont {
|
if linkFont !== baseFont {
|
||||||
string.addAttribute(NSAttributedStringKey.font, value: linkFont, range: range)
|
string.addAttribute(NSAttributedString.Key.font, value: linkFont, range: range)
|
||||||
}
|
}
|
||||||
let mention = nsString!.substring(with: range)
|
let mention = nsString!.substring(with: range)
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.PeerMention), value: TelegramPeerMention(peerId: peerId, mention: mention), range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerMention), value: TelegramPeerMention(peerId: peerId, mention: mention), range: range)
|
||||||
case .Hashtag:
|
case .Hashtag:
|
||||||
if nsString == nil {
|
if nsString == nil {
|
||||||
nsString = text as NSString
|
nsString = text as NSString
|
||||||
@@ -163,32 +163,32 @@ func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], ba
|
|||||||
|
|
||||||
skipEntity = true
|
skipEntity = true
|
||||||
let combinedRange = NSRange(location: range.location, length: nextRange.location + nextRange.length - range.location)
|
let combinedRange = NSRange(location: range.location, length: nextRange.location + nextRange.length - range.location)
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: combinedRange)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: combinedRange)
|
||||||
if linkColor.isEqual(baseColor) {
|
if linkColor.isEqual(baseColor) {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: combinedRange)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: combinedRange)
|
||||||
}
|
}
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.Hashtag), value: TelegramHashtag(peerName: peerName, hashtag: hashtag), range: combinedRange)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Hashtag), value: TelegramHashtag(peerName: peerName, hashtag: hashtag), range: combinedRange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !skipEntity {
|
if !skipEntity {
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if underlineLinks && underlineAllLinks {
|
if underlineLinks && underlineAllLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.Hashtag), value: TelegramHashtag(peerName: nil, hashtag: hashtag), range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Hashtag), value: TelegramHashtag(peerName: nil, hashtag: hashtag), range: range)
|
||||||
}
|
}
|
||||||
case .BotCommand:
|
case .BotCommand:
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if underlineLinks && underlineAllLinks {
|
if underlineLinks && underlineAllLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
if nsString == nil {
|
if nsString == nil {
|
||||||
nsString = text as NSString
|
nsString = text as NSString
|
||||||
}
|
}
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.BotCommand), value: nsString!.substring(with: range), range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.BotCommand), value: nsString!.substring(with: range), range: range)
|
||||||
case .Code, .Pre:
|
case .Code, .Pre:
|
||||||
string.addAttribute(NSAttributedStringKey.font, value: fixedFont, range: range)
|
string.addAttribute(NSAttributedString.Key.font, value: fixedFont, range: range)
|
||||||
case .BlockQuote:
|
case .BlockQuote:
|
||||||
if let fontAttribute = fontAttributes[range] {
|
if let fontAttribute = fontAttributes[range] {
|
||||||
fontAttributes[range] = fontAttribute.union(.blockQuote)
|
fontAttributes[range] = fontAttribute.union(.blockQuote)
|
||||||
@@ -204,22 +204,22 @@ func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], ba
|
|||||||
let paragraphStyle = NSMutableParagraphStyle()
|
let paragraphStyle = NSMutableParagraphStyle()
|
||||||
paragraphStyle.headIndent = 10.0
|
paragraphStyle.headIndent = 10.0
|
||||||
paragraphStyle.tabStops = [NSTextTab(textAlignment: .left, location: paragraphStyle.headIndent, options: [:])]
|
paragraphStyle.tabStops = [NSTextTab(textAlignment: .left, location: paragraphStyle.headIndent, options: [:])]
|
||||||
string.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: paragraphRange)
|
string.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: paragraphRange)
|
||||||
|
|
||||||
string.insert(NSAttributedString(string: paragraphBreak), at: paragraphRange.upperBound)
|
string.insert(NSAttributedString(string: paragraphBreak), at: paragraphRange.upperBound)
|
||||||
rangeOffset += paragraphBreak.count
|
rangeOffset += paragraphBreak.count
|
||||||
case let .Custom(type):
|
case let .Custom(type):
|
||||||
if type == ApplicationSpecificEntityType.Timecode {
|
if type == ApplicationSpecificEntityType.Timecode {
|
||||||
string.addAttribute(NSAttributedStringKey.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
if underlineLinks && underlineAllLinks {
|
if underlineLinks && underlineAllLinks {
|
||||||
string.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue as NSNumber, range: range)
|
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
if nsString == nil {
|
if nsString == nil {
|
||||||
nsString = text as NSString
|
nsString = text as NSString
|
||||||
}
|
}
|
||||||
let text = nsString!.substring(with: range)
|
let text = nsString!.substring(with: range)
|
||||||
if let time = parseTimecodeString(text) {
|
if let time = parseTimecodeString(text) {
|
||||||
string.addAttribute(NSAttributedStringKey(rawValue: TelegramTextAttributes.Timecode), value: TelegramTimecode(time: time, text: text), range: range)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Timecode), value: TelegramTimecode(time: time, text: text), range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -238,7 +238,7 @@ func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], ba
|
|||||||
font = italicFont
|
font = italicFont
|
||||||
}
|
}
|
||||||
if let font = font {
|
if let font = font {
|
||||||
string.addAttribute(NSAttributedStringKey.font, value: font, range: range)
|
string.addAttribute(NSAttributedString.Key.font, value: font, range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
42
submodules/TextFormat/Sources/TelegramAttributes.swift
Normal file
42
submodules/TextFormat/Sources/TelegramAttributes.swift
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import Foundation
|
||||||
|
import Postbox
|
||||||
|
|
||||||
|
public final class TelegramHashtag {
|
||||||
|
public let peerName: String?
|
||||||
|
public let hashtag: String
|
||||||
|
|
||||||
|
public init(peerName: String?, hashtag: String) {
|
||||||
|
self.peerName = peerName
|
||||||
|
self.hashtag = hashtag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class TelegramPeerMention {
|
||||||
|
public let peerId: PeerId
|
||||||
|
public let mention: String
|
||||||
|
|
||||||
|
public init(peerId: PeerId, mention: String) {
|
||||||
|
self.peerId = peerId
|
||||||
|
self.mention = mention
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class TelegramTimecode {
|
||||||
|
public let time: Double
|
||||||
|
public let text: String
|
||||||
|
|
||||||
|
public init(time: Double, text: String) {
|
||||||
|
self.time = time
|
||||||
|
self.text = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct TelegramTextAttributes {
|
||||||
|
public static let URL = "UrlAttributeT"
|
||||||
|
public static let PeerMention = "TelegramPeerMention"
|
||||||
|
public static let PeerTextMention = "TelegramPeerTextMention"
|
||||||
|
public static let BotCommand = "TelegramBotCommand"
|
||||||
|
public static let Hashtag = "TelegramHashtag"
|
||||||
|
public static let Timecode = "TelegramTimecode"
|
||||||
|
public static let BlockQuote = "TelegramBlockQuote"
|
||||||
|
}
|
||||||
19
submodules/TextFormat/Sources/TextFormat.h
Normal file
19
submodules/TextFormat/Sources/TextFormat.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// TextFormat.h
|
||||||
|
// TextFormat
|
||||||
|
//
|
||||||
|
// Created by Peter on 8/1/19.
|
||||||
|
// Copyright © 2019 Telegram Messenger LLP. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
//! Project version number for TextFormat.
|
||||||
|
FOUNDATION_EXPORT double TextFormatVersionNumber;
|
||||||
|
|
||||||
|
//! Project version string for TextFormat.
|
||||||
|
FOUNDATION_EXPORT const unsigned char TextFormatVersionString[];
|
||||||
|
|
||||||
|
// In this header, you should import all the public headers of your framework using statements like #import <TextFormat/PublicHeader.h>
|
||||||
|
|
||||||
|
|
||||||
575
submodules/TextFormat/TextFormat_Xcode.xcodeproj/project.pbxproj
Normal file
575
submodules/TextFormat/TextFormat_Xcode.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,575 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 50;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
D06018B122F364DC00796784 /* GenerateTextEntities.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06018B022F364DC00796784 /* GenerateTextEntities.swift */; };
|
||||||
|
D06018B322F3650C00796784 /* ChatTextInputAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06018B222F3650C00796784 /* ChatTextInputAttributes.swift */; };
|
||||||
|
D06018B722F365D800796784 /* StringWithAppliedEntities.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06018B622F365D700796784 /* StringWithAppliedEntities.swift */; };
|
||||||
|
D0A0B53B22F3714F00628AF3 /* TelegramCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A0B53A22F3714F00628AF3 /* TelegramCore.framework */; };
|
||||||
|
D0A0B53D22F3726300628AF3 /* TelegramPresentationData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A0B53C22F3726300628AF3 /* TelegramPresentationData.framework */; };
|
||||||
|
D0D328CA22F3495C00D07EE2 /* TextFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = D0D328C822F3495C00D07EE2 /* TextFormat.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
D0D328D522F349CB00D07EE2 /* Markdown.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D328D422F349CB00D07EE2 /* Markdown.swift */; };
|
||||||
|
D0D328D822F349F400D07EE2 /* Display.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D328D722F349F400D07EE2 /* Display.framework */; };
|
||||||
|
D0D328DA22F349F800D07EE2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D328D922F349F800D07EE2 /* Foundation.framework */; };
|
||||||
|
D0D328DC22F349FB00D07EE2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D328DB22F349FB00D07EE2 /* UIKit.framework */; };
|
||||||
|
D0D328E022F3526000D07EE2 /* TelegramAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D328DF22F3526000D07EE2 /* TelegramAttributes.swift */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
D06018B022F364DC00796784 /* GenerateTextEntities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GenerateTextEntities.swift; sourceTree = "<group>"; };
|
||||||
|
D06018B222F3650C00796784 /* ChatTextInputAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatTextInputAttributes.swift; sourceTree = "<group>"; };
|
||||||
|
D06018B622F365D700796784 /* StringWithAppliedEntities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringWithAppliedEntities.swift; sourceTree = "<group>"; };
|
||||||
|
D0A0B53A22F3714F00628AF3 /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
D0A0B53C22F3726300628AF3 /* TelegramPresentationData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramPresentationData.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
D0D328C522F3495C00D07EE2 /* TextFormat.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TextFormat.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
D0D328C822F3495C00D07EE2 /* TextFormat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextFormat.h; sourceTree = "<group>"; };
|
||||||
|
D0D328C922F3495C00D07EE2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
D0D328D422F349CB00D07EE2 /* Markdown.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Markdown.swift; sourceTree = "<group>"; };
|
||||||
|
D0D328D722F349F400D07EE2 /* Display.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Display.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
D0D328D922F349F800D07EE2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||||
|
D0D328DB22F349FB00D07EE2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||||
|
D0D328DF22F3526000D07EE2 /* TelegramAttributes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TelegramAttributes.swift; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
D0D328C222F3495C00D07EE2 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
D0A0B53D22F3726300628AF3 /* TelegramPresentationData.framework in Frameworks */,
|
||||||
|
D0A0B53B22F3714F00628AF3 /* TelegramCore.framework in Frameworks */,
|
||||||
|
D0D328DC22F349FB00D07EE2 /* UIKit.framework in Frameworks */,
|
||||||
|
D0D328DA22F349F800D07EE2 /* Foundation.framework in Frameworks */,
|
||||||
|
D0D328D822F349F400D07EE2 /* Display.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
D0D328BB22F3495C00D07EE2 = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
D0D328C922F3495C00D07EE2 /* Info.plist */,
|
||||||
|
D0D328C722F3495C00D07EE2 /* Sources */,
|
||||||
|
D0D328C622F3495C00D07EE2 /* Products */,
|
||||||
|
D0D328D622F349F400D07EE2 /* Frameworks */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
D0D328C622F3495C00D07EE2 /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
D0D328C522F3495C00D07EE2 /* TextFormat.framework */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
D0D328C722F3495C00D07EE2 /* Sources */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
D06018B622F365D700796784 /* StringWithAppliedEntities.swift */,
|
||||||
|
D06018B222F3650C00796784 /* ChatTextInputAttributes.swift */,
|
||||||
|
D06018B022F364DC00796784 /* GenerateTextEntities.swift */,
|
||||||
|
D0D328D422F349CB00D07EE2 /* Markdown.swift */,
|
||||||
|
D0D328C822F3495C00D07EE2 /* TextFormat.h */,
|
||||||
|
D0D328DF22F3526000D07EE2 /* TelegramAttributes.swift */,
|
||||||
|
);
|
||||||
|
path = Sources;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
D0D328D622F349F400D07EE2 /* Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
D0A0B53C22F3726300628AF3 /* TelegramPresentationData.framework */,
|
||||||
|
D0A0B53A22F3714F00628AF3 /* TelegramCore.framework */,
|
||||||
|
D0D328DB22F349FB00D07EE2 /* UIKit.framework */,
|
||||||
|
D0D328D922F349F800D07EE2 /* Foundation.framework */,
|
||||||
|
D0D328D722F349F400D07EE2 /* Display.framework */,
|
||||||
|
);
|
||||||
|
name = Frameworks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXHeadersBuildPhase section */
|
||||||
|
D0D328C022F3495C00D07EE2 /* Headers */ = {
|
||||||
|
isa = PBXHeadersBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
D0D328CA22F3495C00D07EE2 /* TextFormat.h in Headers */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXHeadersBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
D0D328C422F3495C00D07EE2 /* TextFormat */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = D0D328CD22F3495C00D07EE2 /* Build configuration list for PBXNativeTarget "TextFormat" */;
|
||||||
|
buildPhases = (
|
||||||
|
D0D328C022F3495C00D07EE2 /* Headers */,
|
||||||
|
D0D328C122F3495C00D07EE2 /* Sources */,
|
||||||
|
D0D328C222F3495C00D07EE2 /* Frameworks */,
|
||||||
|
D0D328C322F3495C00D07EE2 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = TextFormat;
|
||||||
|
productName = TextFormat;
|
||||||
|
productReference = D0D328C522F3495C00D07EE2 /* TextFormat.framework */;
|
||||||
|
productType = "com.apple.product-type.framework";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
D0D328BC22F3495C00D07EE2 /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
DefaultBuildSystemTypeForWorkspace = Latest;
|
||||||
|
LastUpgradeCheck = 1010;
|
||||||
|
ORGANIZATIONNAME = "Telegram Messenger LLP";
|
||||||
|
TargetAttributes = {
|
||||||
|
D0D328C422F3495C00D07EE2 = {
|
||||||
|
CreatedOnToolsVersion = 10.1;
|
||||||
|
LastSwiftMigration = 1010;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buildConfigurationList = D0D328BF22F3495C00D07EE2 /* Build configuration list for PBXProject "TextFormat_Xcode" */;
|
||||||
|
compatibilityVersion = "Xcode 9.3";
|
||||||
|
developmentRegion = en;
|
||||||
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
);
|
||||||
|
mainGroup = D0D328BB22F3495C00D07EE2;
|
||||||
|
productRefGroup = D0D328C622F3495C00D07EE2 /* Products */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
D0D328C422F3495C00D07EE2 /* TextFormat */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
D0D328C322F3495C00D07EE2 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
D0D328C122F3495C00D07EE2 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
D06018B722F365D800796784 /* StringWithAppliedEntities.swift in Sources */,
|
||||||
|
D06018B322F3650C00796784 /* ChatTextInputAttributes.swift in Sources */,
|
||||||
|
D0D328D522F349CB00D07EE2 /* Markdown.swift in Sources */,
|
||||||
|
D0D328E022F3526000D07EE2 /* TelegramAttributes.swift in Sources */,
|
||||||
|
D06018B122F364DC00796784 /* GenerateTextEntities.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
D0D328CB22F3495C00D07EE2 /* DebugAppStoreLLC */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = DebugAppStoreLLC;
|
||||||
|
};
|
||||||
|
D0D328CC22F3495C00D07EE2 /* ReleaseAppStoreLLC */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
VALIDATE_PRODUCT = YES;
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = ReleaseAppStoreLLC;
|
||||||
|
};
|
||||||
|
D0D328CE22F3495C00D07EE2 /* DebugAppStoreLLC */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "";
|
||||||
|
CODE_SIGN_STYLE = Manual;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
MACH_O_TYPE = staticlib;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TextFormat;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 4.2;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = DebugAppStoreLLC;
|
||||||
|
};
|
||||||
|
D0D328CF22F3495C00D07EE2 /* ReleaseAppStoreLLC */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "";
|
||||||
|
CODE_SIGN_STYLE = Manual;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
MACH_O_TYPE = staticlib;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TextFormat;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_VERSION = 4.2;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = ReleaseAppStoreLLC;
|
||||||
|
};
|
||||||
|
D0D328D022F3498E00D07EE2 /* DebugHockeyapp */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = DebugHockeyapp;
|
||||||
|
};
|
||||||
|
D0D328D122F3498E00D07EE2 /* DebugHockeyapp */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "";
|
||||||
|
CODE_SIGN_STYLE = Manual;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
MACH_O_TYPE = staticlib;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TextFormat;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 4.2;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = DebugHockeyapp;
|
||||||
|
};
|
||||||
|
D0D328D222F3499900D07EE2 /* ReleaseHockeyappInternal */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
VALIDATE_PRODUCT = YES;
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = ReleaseHockeyappInternal;
|
||||||
|
};
|
||||||
|
D0D328D322F3499900D07EE2 /* ReleaseHockeyappInternal */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "";
|
||||||
|
CODE_SIGN_STYLE = Manual;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
MACH_O_TYPE = staticlib;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TextFormat;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_VERSION = 4.2;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = ReleaseHockeyappInternal;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
D0D328BF22F3495C00D07EE2 /* Build configuration list for PBXProject "TextFormat_Xcode" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
D0D328CB22F3495C00D07EE2 /* DebugAppStoreLLC */,
|
||||||
|
D0D328D022F3498E00D07EE2 /* DebugHockeyapp */,
|
||||||
|
D0D328CC22F3495C00D07EE2 /* ReleaseAppStoreLLC */,
|
||||||
|
D0D328D222F3499900D07EE2 /* ReleaseHockeyappInternal */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = ReleaseAppStoreLLC;
|
||||||
|
};
|
||||||
|
D0D328CD22F3495C00D07EE2 /* Build configuration list for PBXNativeTarget "TextFormat" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
D0D328CE22F3495C00D07EE2 /* DebugAppStoreLLC */,
|
||||||
|
D0D328D122F3498E00D07EE2 /* DebugHockeyapp */,
|
||||||
|
D0D328CF22F3495C00D07EE2 /* ReleaseAppStoreLLC */,
|
||||||
|
D0D328D322F3499900D07EE2 /* ReleaseHockeyappInternal */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = ReleaseAppStoreLLC;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = D0D328BC22F3495C00D07EE2 /* Project object */;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user