Compose: assign account synchronously if possible
This commit is contained in:
parent
727f28e39f
commit
66626c8f62
|
@ -50,6 +50,10 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
|
||||||
emojiImageView: { AnyView(CustomEmojiImageView(emoji: $0)) }
|
emojiImageView: { AnyView(CustomEmojiImageView(emoji: $0)) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if let account = mastodonController.account {
|
||||||
|
controller.currentAccount = account
|
||||||
|
}
|
||||||
|
|
||||||
self.mastodonController = mastodonController
|
self.mastodonController = mastodonController
|
||||||
|
|
||||||
super.init(rootView: View(mastodonController: mastodonController, controller: controller))
|
super.init(rootView: View(mastodonController: mastodonController, controller: controller))
|
||||||
|
@ -151,7 +155,8 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
|
||||||
var body: some SwiftUI.View {
|
var body: some SwiftUI.View {
|
||||||
ControllerView(controller: { controller })
|
ControllerView(controller: { controller })
|
||||||
.task {
|
.task {
|
||||||
if let account = try? await mastodonController.getOwnAccount() {
|
if controller.currentAccount == nil,
|
||||||
|
let account = try? await mastodonController.getOwnAccount() {
|
||||||
controller.currentAccount = account
|
controller.currentAccount = account
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue