diff --git a/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift b/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift index 8498c6866..ff1e261a2 100644 --- a/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift +++ b/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift @@ -63,14 +63,9 @@ final class ProfileAboutViewModel { .sink { [weak self] account, emojiMeta in guard let self = self else { return } guard let account = account else { return } - - self.profileInfo.fields = account.source?.fields?.compactMap { field in - ProfileFieldItem.FieldValue( - name: field.name, - value: field.value, - emojiMeta: emojiMeta - ) - } ?? [] + + // update profileInfo will occurs race condition issue + // bind user.fields to profileInfo to avoid it self.profileInfoEditing.fields = account.source?.fields?.compactMap { field in ProfileFieldItem.FieldValue( diff --git a/Mastodon/Scene/Profile/ProfileViewController.swift b/Mastodon/Scene/Profile/ProfileViewController.swift index 4c77a4458..96af86026 100644 --- a/Mastodon/Scene/Profile/ProfileViewController.swift +++ b/Mastodon/Scene/Profile/ProfileViewController.swift @@ -305,7 +305,10 @@ extension ProfileViewController { } // about - let aboutViewModel = profilePagingViewController.viewModel.profileAboutViewController.viewModel! + let aboutViewModel = viewModel.profileAboutViewModel + viewModel.$user + .assign(to: \.user, on: aboutViewModel) + .store(in: &disposeBag) viewModel.$isEditing .assign(to: \.isEditing, on: aboutViewModel) .store(in: &disposeBag) diff --git a/Mastodon/Scene/Profile/ProfileViewModel.swift b/Mastodon/Scene/Profile/ProfileViewModel.swift index 91866b851..79bfe8986 100644 --- a/Mastodon/Scene/Profile/ProfileViewModel.swift +++ b/Mastodon/Scene/Profile/ProfileViewModel.swift @@ -163,7 +163,7 @@ class ProfileViewModel: NSObject { } // end Task } .store(in: &disposeBag) -// + let isBlockingOrBlocked = Publishers.CombineLatest( relationshipViewModel.$isBlocking, relationshipViewModel.$isBlockingBy diff --git a/MastodonSDK/Sources/CoreDataStack/Entity/Mastodon/MastodonUser.swift b/MastodonSDK/Sources/CoreDataStack/Entity/Mastodon/MastodonUser.swift index 4b16b7c7b..85e844b09 100644 --- a/MastodonSDK/Sources/CoreDataStack/Entity/Mastodon/MastodonUser.swift +++ b/MastodonSDK/Sources/CoreDataStack/Entity/Mastodon/MastodonUser.swift @@ -362,82 +362,6 @@ extension MastodonUser: AutoGenerateProperty { } // 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 extension MastodonUser: AutoUpdatableObject {