Merge pull request #454 from mastodon/fix-profile-fields

Fix profile fields cannot display issue
This commit is contained in:
CMK 2022-06-14 14:04:23 +08:00 committed by GitHub
commit 44b06f3a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 86 deletions

View File

@ -64,13 +64,8 @@ final class ProfileAboutViewModel {
guard let self = self else { return } guard let self = self else { return }
guard let account = account else { return } guard let account = account else { return }
self.profileInfo.fields = account.source?.fields?.compactMap { field in // update profileInfo will occurs race condition issue
ProfileFieldItem.FieldValue( // bind user.fields to profileInfo to avoid it
name: field.name,
value: field.value,
emojiMeta: emojiMeta
)
} ?? []
self.profileInfoEditing.fields = account.source?.fields?.compactMap { field in self.profileInfoEditing.fields = account.source?.fields?.compactMap { field in
ProfileFieldItem.FieldValue( ProfileFieldItem.FieldValue(

View File

@ -305,7 +305,10 @@ extension ProfileViewController {
} }
// about // about
let aboutViewModel = profilePagingViewController.viewModel.profileAboutViewController.viewModel! let aboutViewModel = viewModel.profileAboutViewModel
viewModel.$user
.assign(to: \.user, on: aboutViewModel)
.store(in: &disposeBag)
viewModel.$isEditing viewModel.$isEditing
.assign(to: \.isEditing, on: aboutViewModel) .assign(to: \.isEditing, on: aboutViewModel)
.store(in: &disposeBag) .store(in: &disposeBag)

View File

@ -163,7 +163,7 @@ class ProfileViewModel: NSObject {
} // end Task } // end Task
} }
.store(in: &disposeBag) .store(in: &disposeBag)
//
let isBlockingOrBlocked = Publishers.CombineLatest( let isBlockingOrBlocked = Publishers.CombineLatest(
relationshipViewModel.$isBlocking, relationshipViewModel.$isBlocking,
relationshipViewModel.$isBlockingBy relationshipViewModel.$isBlockingBy

View File

@ -363,82 +363,6 @@ extension MastodonUser: AutoGenerateProperty {
// sourcery:end // sourcery:end
} }
//extension MastodonUser {
// public struct Property {
// public let identifier: String
// public let domain: String
//
// public let id: String
// public let acct: String
// public let username: String
// public let displayName: String
// public let avatar: String
// public let avatarStatic: String?
// public let header: String
// public let headerStatic: String?
// public let note: String?
// public let url: String?
// public let emojisData: Data?
// public let fieldsData: Data?
// public let statusesCount: Int
// public let followingCount: Int
// public let followersCount: Int
// public let locked: Bool
// public let bot: Bool?
// public let suspended: Bool?
//
// public let createdAt: Date
// public let networkDate: Date
//
// public init(
// id: String,
// domain: String,
// acct: String,
// username: String,
// displayName: String,
// avatar: String,
// avatarStatic: String?,
// header: String,
// headerStatic: String?,
// note: String?,
// url: String?,
// emojisData: Data?,
// fieldsData: Data?,
// statusesCount: Int,
// followingCount: Int,
// followersCount: Int,
// locked: Bool,
// bot: Bool?,
// suspended: Bool?,
// createdAt: Date,
// networkDate: Date
// ) {
// self.identifier = id + "@" + domain
// self.domain = domain
// self.id = id
// self.acct = acct
// self.username = username
// self.displayName = displayName
// self.avatar = avatar
// self.avatarStatic = avatarStatic
// self.header = header
// self.headerStatic = headerStatic
// self.note = note
// self.url = url
// self.emojisData = emojisData
// self.fieldsData = fieldsData
// self.statusesCount = statusesCount
// self.followingCount = followingCount
// self.followersCount = followersCount
// self.locked = locked
// self.bot = bot
// self.suspended = suspended
// self.createdAt = createdAt
// self.networkDate = networkDate
// }
// }
//}
// MARK: - AutoUpdatableObject // MARK: - AutoUpdatableObject
extension MastodonUser: AutoUpdatableObject { extension MastodonUser: AutoUpdatableObject {
// sourcery:inline:MastodonUser.AutoUpdatableObject // sourcery:inline:MastodonUser.AutoUpdatableObject