commit
12bfff8b00
|
@ -52,7 +52,7 @@ final class AccountListViewModel: NSObject {
|
||||||
mastodonAuthenticationFetchedResultsController.delegate = self
|
mastodonAuthenticationFetchedResultsController.delegate = self
|
||||||
do {
|
do {
|
||||||
try mastodonAuthenticationFetchedResultsController.performFetch()
|
try mastodonAuthenticationFetchedResultsController.performFetch()
|
||||||
authentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?.compactMap { $0.asRecrod } ?? []
|
authentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?.compactMap { $0.asRecord } ?? []
|
||||||
} catch {
|
} catch {
|
||||||
assertionFailure(error.localizedDescription)
|
assertionFailure(error.localizedDescription)
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ extension AccountListViewModel: NSFetchedResultsControllerDelegate {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
authentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?.compactMap { $0.asRecrod } ?? []
|
authentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?.compactMap { $0.asRecord } ?? []
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -541,7 +541,7 @@ extension ProfileViewController {
|
||||||
let composeViewModel = ComposeViewModel(
|
let composeViewModel = ComposeViewModel(
|
||||||
context: context,
|
context: context,
|
||||||
authContext: viewModel.authContext,
|
authContext: viewModel.authContext,
|
||||||
kind: .mention(user: mastodonUser.asRecrod)
|
kind: .mention(user: mastodonUser.asRecord)
|
||||||
)
|
)
|
||||||
_ = coordinator.present(scene: .compose(viewModel: composeViewModel), from: self, transition: .modal(animated: true, completion: nil))
|
_ = coordinator.present(scene: .compose(viewModel: composeViewModel), from: self, transition: .modal(animated: true, completion: nil))
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ extension SearchResultViewModel {
|
||||||
userFetchedResultsController.$records,
|
userFetchedResultsController.$records,
|
||||||
$hashtags
|
$hashtags
|
||||||
)
|
)
|
||||||
.map { statusRecrods, userRecords, hashtags in
|
.map { statusRecords, userRecords, hashtags in
|
||||||
var items: [SearchResultItem] = []
|
var items: [SearchResultItem] = []
|
||||||
|
|
||||||
let userItems = userRecords.map { SearchResultItem.user($0) }
|
let userItems = userRecords.map { SearchResultItem.user($0) }
|
||||||
|
@ -42,7 +42,7 @@ extension SearchResultViewModel {
|
||||||
let hashtagItems = hashtags.map { SearchResultItem.hashtag(tag: $0) }
|
let hashtagItems = hashtags.map { SearchResultItem.hashtag(tag: $0) }
|
||||||
items.append(contentsOf: hashtagItems)
|
items.append(contentsOf: hashtagItems)
|
||||||
|
|
||||||
let statusItems = statusRecrods.map { SearchResultItem.status($0) }
|
let statusItems = statusRecords.map { SearchResultItem.status($0) }
|
||||||
items.append(contentsOf: statusItems)
|
items.append(contentsOf: statusItems)
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class ManagedObjectRecord<T: NSFetchRequestResult>: Hashable {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Managed where Self: NSManagedObject {
|
extension Managed where Self: NSManagedObject {
|
||||||
public var asRecrod: ManagedObjectRecord<Self> {
|
public var asRecord: ManagedObjectRecord<Self> {
|
||||||
return .init(objectID: objectID)
|
return .init(objectID: objectID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public final class AuthenticationService: NSObject {
|
||||||
try mastodonAuthenticationFetchedResultsController.performFetch()
|
try mastodonAuthenticationFetchedResultsController.performFetch()
|
||||||
mastodonAuthentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?
|
mastodonAuthentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?
|
||||||
.sorted(by: { $0.activedAt > $1.activedAt })
|
.sorted(by: { $0.activedAt > $1.activedAt })
|
||||||
.compactMap { $0.asRecrod } ?? []
|
.compactMap { $0.asRecord } ?? []
|
||||||
} catch {
|
} catch {
|
||||||
assertionFailure(error.localizedDescription)
|
assertionFailure(error.localizedDescription)
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ extension AuthenticationService: NSFetchedResultsControllerDelegate {
|
||||||
|
|
||||||
mastodonAuthentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?
|
mastodonAuthentications = mastodonAuthenticationFetchedResultsController.fetchedObjects?
|
||||||
.sorted(by: { $0.activedAt > $1.activedAt })
|
.sorted(by: { $0.activedAt > $1.activedAt })
|
||||||
.compactMap { $0.asRecrod } ?? []
|
.compactMap { $0.asRecord } ?? []
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,7 +498,7 @@ extension ComposeContentViewModel {
|
||||||
let managedObjectContext = self.context.managedObjectContext
|
let managedObjectContext = self.context.managedObjectContext
|
||||||
var _author: ManagedObjectRecord<MastodonUser>?
|
var _author: ManagedObjectRecord<MastodonUser>?
|
||||||
managedObjectContext.performAndWait {
|
managedObjectContext.performAndWait {
|
||||||
_author = authContext.mastodonAuthenticationBox.authenticationRecord.object(in: managedObjectContext)?.user.asRecrod
|
_author = authContext.mastodonAuthenticationBox.authenticationRecord.object(in: managedObjectContext)?.user.asRecord
|
||||||
}
|
}
|
||||||
guard let author = _author else {
|
guard let author = _author else {
|
||||||
throw AppError.badAuthentication
|
throw AppError.badAuthentication
|
||||||
|
|
Loading…
Reference in New Issue