Load profile
This commit is contained in:
parent
5513174696
commit
8df4729cdd
|
@ -32,5 +32,27 @@ final class MeProfileViewModel: ProfileViewModel {
|
|||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
||||
super.viewDidLoad()
|
||||
|
||||
Task {
|
||||
do {
|
||||
|
||||
_ = try await context.apiService.authenticatedUserInfo(authenticationBox: authContext.mastodonAuthenticationBox).value
|
||||
|
||||
try await context.managedObjectContext.performChanges {
|
||||
guard let me = self.authContext.mastodonAuthenticationBox.authentication.user(in: self.context.managedObjectContext) else {
|
||||
assertionFailure()
|
||||
return
|
||||
}
|
||||
|
||||
self.me = me
|
||||
}
|
||||
} catch {
|
||||
// do nothing?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,6 +287,8 @@ extension ProfileViewController {
|
|||
bindTitleView()
|
||||
bindMoreBarButtonItem()
|
||||
bindPager()
|
||||
|
||||
viewModel.viewDidLoad()
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
|
|
@ -176,9 +176,10 @@ class ProfileViewModel: NSObject {
|
|||
.assign(to: &$isPagingEnabled)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ProfileViewModel {
|
||||
func viewDidLoad() {
|
||||
|
||||
}
|
||||
|
||||
// fetch profile info before edit
|
||||
func fetchEditProfileInfo() -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Account>, Error> {
|
||||
|
|
Loading…
Reference in New Issue