mastodon-app-ufficiale-ipho.../Mastodon/Extension/CoreDataStack/Status.swift

35 lines
1.0 KiB
Swift
Raw Normal View History

//
2021-04-01 08:39:15 +02:00
// Status.swift
// Mastodon
//
// Created by MainasuK Cirno on 2021/2/4.
//
import Foundation
import CoreDataStack
import MastodonSDK
2021-04-01 08:39:15 +02:00
extension Status.Property {
init(entity: Mastodon.Entity.Status, domain: String, networkDate: Date) {
self.init(
domain: domain,
id: entity.id,
uri: entity.uri,
createdAt: entity.createdAt,
content: entity.content,
visibility: entity.visibility?.rawValue,
sensitive: entity.sensitive ?? false,
spoilerText: entity.spoilerText,
reblogsCount: NSNumber(value: entity.reblogsCount),
favouritesCount: NSNumber(value: entity.favouritesCount),
2021-02-04 07:57:16 +01:00
repliesCount: entity.repliesCount.flatMap { NSNumber(value: $0) },
url: entity.uri,
inReplyToID: entity.inReplyToID,
inReplyToAccountID: entity.inReplyToAccountID,
language: entity.language,
text: entity.text,
networkDate: networkDate
)
}
}