Преглед изворни кода

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()