forked from zelo72/mastodon-ios
chore: renaming interface
This commit is contained in:
parent
faeb8d99ef
commit
26187d98b7
|
@ -65,7 +65,7 @@ enum MastodonStatusContent {
|
||||||
|
|
||||||
var trimmed = text
|
var trimmed = text
|
||||||
for activeEntity in activeEntities {
|
for activeEntity in activeEntities {
|
||||||
MastodonStatusContent.trimEntity(toot: &trimmed, activeEntity: activeEntity, activeEntities: activeEntities)
|
MastodonStatusContent.trimEntity(status: &trimmed, activeEntity: activeEntity, activeEntities: activeEntities)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ParseResult(
|
return ParseResult(
|
||||||
|
@ -76,7 +76,7 @@ enum MastodonStatusContent {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func trimEntity(toot: inout String, activeEntity: ActiveEntity, activeEntities: [ActiveEntity]) {
|
static func trimEntity(status: inout String, activeEntity: ActiveEntity, activeEntities: [ActiveEntity]) {
|
||||||
let text: String
|
let text: String
|
||||||
let trimmed: String
|
let trimmed: String
|
||||||
switch activeEntity.type {
|
switch activeEntity.type {
|
||||||
|
@ -91,8 +91,8 @@ enum MastodonStatusContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let index = activeEntities.firstIndex(where: { $0.range == activeEntity.range }) else { return }
|
guard let index = activeEntities.firstIndex(where: { $0.range == activeEntity.range }) else { return }
|
||||||
guard let range = Range(activeEntity.range, in: toot) else { return }
|
guard let range = Range(activeEntity.range, in: status) else { return }
|
||||||
toot.replaceSubrange(range, with: trimmed)
|
status.replaceSubrange(range, with: trimmed)
|
||||||
|
|
||||||
let offset = trimmed.count - text.count
|
let offset = trimmed.count - text.count
|
||||||
activeEntity.range.length += offset
|
activeEntity.range.length += offset
|
||||||
|
|
Loading…
Reference in New Issue