瀏覽代碼

fix initialization of dcContext in share extension

cyberta 5 年之前
父節點
當前提交
b9942f0ffd
共有 1 個文件被更改,包括 3 次插入3 次删除
  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()