Browse Source

fix initialization of dcContext in share extension

cyberta 5 năm trước cách đây
mục cha
commit
b9942f0ffd
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      DcShare/Controller/ShareViewController.swift

+ 3 - 3
DcShare/Controller/ShareViewController.swift

@@ -57,9 +57,6 @@ class ShareViewController: SLComposeServiceViewController {
         }
         placeholder = String.localized("chat_input_placeholder")
 
-        DispatchQueue.global(qos: .background).async {
-            self.shareAttachment = ShareAttachment(dcContext: self.dcContext, inputItems: self.extensionContext?.inputItems, delegate: self)
-        }
     }
 
     override func presentationAnimationDidFinish() {
@@ -72,6 +69,9 @@ class ShareViewController: SLComposeServiceViewController {
                 if let chatId = selectedChatId {
                     selectedChat = dcContext.getChat(chatId: chatId)
                 }
+                DispatchQueue.global(qos: .background).async {
+                    self.shareAttachment = ShareAttachment(dcContext: self.dcContext, inputItems: self.extensionContext?.inputItems, delegate: self)
+                }
             }
             reloadConfigurationItems()
             validateContent()