Don't reload relationship every time profile page switched
This commit is contained in:
parent
cdc64f1b2c
commit
50b84350d9
|
@ -9,12 +9,6 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import Combine
|
import Combine
|
||||||
import OSLog
|
|
||||||
#if canImport(Sentry)
|
|
||||||
import Sentry
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "ProfileStatusesViewController")
|
|
||||||
|
|
||||||
class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionViewController, CollectionViewController {
|
class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionViewController, CollectionViewController {
|
||||||
|
|
||||||
|
@ -255,20 +249,6 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
|
||||||
|
|
||||||
state = .setupInitialSnapshot
|
state = .setupInitialSnapshot
|
||||||
|
|
||||||
Task {
|
|
||||||
do {
|
|
||||||
let (all, _) = try await mastodonController.run(Client.getRelationships(accounts: [accountID]))
|
|
||||||
if let relationship = all.first {
|
|
||||||
self.mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
logger.error("Error fetching relationship: \(String(describing: error))")
|
|
||||||
#if canImport(Sentry)
|
|
||||||
SentrySDK.capture(error: error)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await controller.loadInitial()
|
await controller.loadInitial()
|
||||||
await tryLoadPinned()
|
await tryLoadPinned()
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import Combine
|
import Combine
|
||||||
|
import OSLog
|
||||||
|
#if canImport(Sentry)
|
||||||
|
import Sentry
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "ProfileViewController")
|
||||||
|
|
||||||
class ProfileViewController: UIViewController, StateRestorableViewController {
|
class ProfileViewController: UIViewController, StateRestorableViewController {
|
||||||
|
|
||||||
|
@ -120,6 +126,19 @@ class ProfileViewController: UIViewController, StateRestorableViewController {
|
||||||
guard let accountID else {
|
guard let accountID else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Task {
|
||||||
|
do {
|
||||||
|
let (all, _) = try await mastodonController.run(Client.getRelationships(accounts: [accountID]))
|
||||||
|
if let relationship = all.first {
|
||||||
|
self.mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
logger.error("Error fetching relationship: \(String(describing: error))")
|
||||||
|
#if canImport(Sentry)
|
||||||
|
SentrySDK.capture(error: error)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
if let account = mastodonController.persistentContainer.account(for: accountID) {
|
if let account = mastodonController.persistentContainer.account(for: accountID) {
|
||||||
updateAccountUI(account: account)
|
updateAccountUI(account: account)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue