Use placeholder for me (IOS-192)
This commit is contained in:
parent
2be8d5b8df
commit
8918d237ca
|
@ -99,10 +99,10 @@ public struct MastodonAuthentication: Codable, Hashable {
|
||||||
return MastodonUser.findOrFetch(in: context, matching: userPredicate)
|
return MastodonUser.findOrFetch(in: context, matching: userPredicate)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func account() -> Mastodon.Entity.Account? {
|
public func account() -> Mastodon.Entity.Account {
|
||||||
// store accounts
|
// store accounts
|
||||||
#warning("TODO: Implement")
|
#warning("TODO: Implement")
|
||||||
return nil
|
return Mastodon.Entity.Account.placeholder()
|
||||||
}
|
}
|
||||||
|
|
||||||
func updating(instance: Instance) -> Self {
|
func updating(instance: Instance) -> Self {
|
||||||
|
|
|
@ -18,8 +18,7 @@ extension Mastodon.Entity {
|
||||||
/// 2021/1/28
|
/// 2021/1/28
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// [Document](https://docs.joinmastodon.org/entities/account/)
|
/// [Document](https://docs.joinmastodon.org/entities/account/)
|
||||||
public final class Account: Codable, Sendable {
|
public final class Account: Sendable {
|
||||||
|
|
||||||
public typealias ID = String
|
public typealias ID = String
|
||||||
|
|
||||||
// Base
|
// Base
|
||||||
|
@ -53,6 +52,93 @@ extension Mastodon.Entity {
|
||||||
public let suspended: Bool?
|
public let suspended: Bool?
|
||||||
public let muteExpiresAt: Date?
|
public let muteExpiresAt: Date?
|
||||||
|
|
||||||
|
internal init(id: Mastodon.Entity.Account.ID, username: String, acct: String, url: String, displayName: String, note: String, avatar: String, avatarStatic: String? = nil, header: String, headerStatic: String? = nil, locked: Bool, emojis: [Mastodon.Entity.Emoji]? = nil, discoverable: Bool? = nil, createdAt: Date, lastStatusAt: Date? = nil, statusesCount: Int, followersCount: Int, followingCount: Int, moved: Mastodon.Entity.Account? = nil, fields: [Mastodon.Entity.Field]? = nil, bot: Bool? = nil, source: Mastodon.Entity.Source? = nil, suspended: Bool? = nil, muteExpiresAt: Date? = nil) {
|
||||||
|
self.id = id
|
||||||
|
self.username = username
|
||||||
|
self.acct = acct
|
||||||
|
self.url = url
|
||||||
|
self.displayName = displayName
|
||||||
|
self.note = note
|
||||||
|
self.avatar = avatar
|
||||||
|
self.avatarStatic = avatarStatic
|
||||||
|
self.header = header
|
||||||
|
self.headerStatic = headerStatic
|
||||||
|
self.locked = locked
|
||||||
|
self.emojis = emojis
|
||||||
|
self.discoverable = discoverable
|
||||||
|
self.createdAt = createdAt
|
||||||
|
self.lastStatusAt = lastStatusAt
|
||||||
|
self.statusesCount = statusesCount
|
||||||
|
self.followersCount = followersCount
|
||||||
|
self.followingCount = followingCount
|
||||||
|
self.moved = moved
|
||||||
|
self.fields = fields
|
||||||
|
self.bot = bot
|
||||||
|
self.source = source
|
||||||
|
self.suspended = suspended
|
||||||
|
self.muteExpiresAt = muteExpiresAt
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, message: "Remove!")
|
||||||
|
public static func placeholder() -> Mastodon.Entity.Account {
|
||||||
|
let data = """
|
||||||
|
{
|
||||||
|
"id": "3006",
|
||||||
|
"username": "zeitschlag",
|
||||||
|
"acct": "zeitschlag",
|
||||||
|
"display_name": "nathan",
|
||||||
|
"locked": false,
|
||||||
|
"bot": false,
|
||||||
|
"discoverable": true,
|
||||||
|
"group": false,
|
||||||
|
"created_at": "2017-04-18T00:00:00.000Z",
|
||||||
|
"note": "<p>release-notes-autor.<br />
wer nervt, wird geblockt.</p>",
|
||||||
|
"url": "https://chaos.social/@zeitschlag",
|
||||||
|
"uri": "https://chaos.social/users/zeitschlag",
|
||||||
|
"avatar": "https://assets.chaos.social/accounts/avatars/000/003/006/original/cf15bb24f41bf74e.jpeg",
|
||||||
|
"avatar_static": "https://assets.chaos.social/accounts/avatars/000/003/006/original/cf15bb24f41bf74e.jpeg",
|
||||||
|
"header": "https://assets.chaos.social/accounts/headers/000/003/006/original/5936fa5b2ef78ced.png",
|
||||||
|
"header_static": "https://assets.chaos.social/accounts/headers/000/003/006/original/5936fa5b2ef78ced.png",
|
||||||
|
"followers_count": 1347,
|
||||||
|
"following_count": 235,
|
||||||
|
"statuses_count": 7484,
|
||||||
|
"last_status_at": "2023-12-08",
|
||||||
|
"noindex": false,
|
||||||
|
"emojis": [],
|
||||||
|
"roles": [],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "blog",
|
||||||
|
"value": "<a href=\\\"https://bullenscheisse.de\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer me\\\" translate=\\\"no\\\"><span class=\\\"invisible\\\">https://</span><span class=\\\"\\\">bullenscheisse.de</span><span class=\\\"invisible\\\"></span></a>",
|
||||||
|
"verified_at": "2023-04-20T13:18:18.930+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mastodon",
|
||||||
|
"value": "<a href=\\\"https://joinmastodon.org/about\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer me\\\" translate=\\\"no\\\"><span class=\\\"invisible\\\">https://</span><span class=\\\"\\\">joinmastodon.org/about</span><span class=\\\"invisible\\\"></span></a>",
|
||||||
|
"verified_at": "2023-11-10T17:06:50.631+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "github",
|
||||||
|
"value": "<a href=\\\"https://github.com/zeitschlag/\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer me\\\" translate=\\\"no\\\"><span class=\\\"invisible\\\">https://</span><span class=\\\"\\\">github.com/zeitschlag/</span><span class=\\\"invisible\\\"></span></a>",
|
||||||
|
"verified_at": "2023-11-10T17:25:59.868+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "German CV",
|
||||||
|
"value": "<a href=\\\"https://zeitschlag.net/lebenslauf/\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer me\\\" translate=\\\"no\\\"><span class=\\\"invisible\\\">https://</span><span class=\\\"\\\">zeitschlag.net/lebenslauf/</span><span class=\\\"invisible\\\"></span></a>",
|
||||||
|
"verified_at": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
""".data(using: .utf8)!
|
||||||
|
|
||||||
|
let account = try! Mastodon.API.decoder.decode(Self.self, from: data)
|
||||||
|
return account
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//MARK: - Codable
|
||||||
|
extension Mastodon.Entity.Account: Codable {
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case username
|
case username
|
||||||
|
@ -83,7 +169,6 @@ extension Mastodon.Entity {
|
||||||
case muteExpiresAt = "mute_expires_at"
|
case muteExpiresAt = "mute_expires_at"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//MARK: - Hashable
|
//MARK: - Hashable
|
||||||
extension Mastodon.Entity.Account: Hashable {
|
extension Mastodon.Entity.Account: Hashable {
|
||||||
|
|
Loading…
Reference in New Issue