Bläddra i källkod

use lazy initialized dcContext instead dcAccoounts.selected in ShareViewController

cyberta 4 år sedan
förälder
incheckning
f842b2ec81
1 ändrade filer med 4 tillägg och 4 borttagningar
  1. 4 4
      DcShare/Controller/ShareViewController.swift

+ 4 - 4
DcShare/Controller/ShareViewController.swift

@@ -95,7 +95,7 @@ class ShareViewController: SLComposeServiceViewController {
             }
             }
             DispatchQueue.global(qos: .userInitiated).async { [weak self] in
             DispatchQueue.global(qos: .userInitiated).async { [weak self] in
                 guard let self = self else { return }
                 guard let self = self else { return }
-                self.shareAttachment = ShareAttachment(dcContext: self.dcAccounts.getSelected(), inputItems: self.extensionContext?.inputItems, delegate: self)
+                self.shareAttachment = ShareAttachment(dcContext: self.dcContext, inputItems: self.extensionContext?.inputItems, delegate: self)
             }
             }
             reloadConfigurationItems()
             reloadConfigurationItems()
             validateContent()
             validateContent()
@@ -132,12 +132,12 @@ class ShareViewController: SLComposeServiceViewController {
                 if messages.count == 1 {
                 if messages.count == 1 {
                     messages[0].text?.append(self.contentText)
                     messages[0].text?.append(self.contentText)
                 } else {
                 } else {
-                    let message = dcAccounts.getSelected().newMessage(viewType: DC_MSG_TEXT)
+                    let message = dcContext.newMessage(viewType: DC_MSG_TEXT)
                     message.text = self.contentText
                     message.text = self.contentText
                     messages.insert(message, at: 0)
                     messages.insert(message, at: 0)
                 }
                 }
             }
             }
-            let chatListController = SendingController(chatId: chatId, dcMsgs: messages, dcContext: dcAccounts.getSelected())
+            let chatListController = SendingController(chatId: chatId, dcMsgs: messages, dcContext: dcContext)
             chatListController.delegate = self
             chatListController.delegate = self
             self.pushConfigurationViewController(chatListController)
             self.pushConfigurationViewController(chatListController)
         }
         }
@@ -161,7 +161,7 @@ class ShareViewController: SLComposeServiceViewController {
             item?.value = selectedChat?.name
             item?.value = selectedChat?.name
             logger.debug("configurationItems chat name: \(String(describing: selectedChat?.name))")
             logger.debug("configurationItems chat name: \(String(describing: selectedChat?.name))")
             item?.tapHandler = {
             item?.tapHandler = {
-                let chatListController = ChatListController(dcContext: self.dcAccounts.getSelected(), chatListDelegate: self)
+                let chatListController = ChatListController(dcContext: self.dcContext, chatListDelegate: self)
                 self.pushConfigurationViewController(chatListController)
                 self.pushConfigurationViewController(chatListController)
             }
             }
         } else {
         } else {