Browse Source

improve syntax

Co-authored-by: bjoern <r10s@b44t.com>
cyBerta 2 năm trước cách đây
mục cha
commit
2250626226

+ 1 - 4
deltachat-ios/Controller/WebViewViewController.swift

@@ -215,10 +215,7 @@ class WebViewViewController: UIViewController, WKNavigationDelegate {
         // workaround:
         // workaround:
         let contacts: [Int] = dcContext.getContacts(flags: DC_GCL_ADD_SELF, queryString: emailAddress)
         let contacts: [Int] = dcContext.getContacts(flags: DC_GCL_ADD_SELF, queryString: emailAddress)
         let index = contacts.firstIndex(where: { dcContext.getContact(id: $0).email == emailAddress }) ?? -1
         let index = contacts.firstIndex(where: { dcContext.getContact(id: $0).email == emailAddress }) ?? -1
-        var contactId = 0
-        if index >= 0 {
-            contactId = contacts[index]
-        }
+        let contactId = index >= 0 ? contacts[index] : 0
 
 
         if contactId == 0 {
         if contactId == 0 {
             let alert = UIAlertController(title: String.localizedStringWithFormat(String.localized("ask_start_chat_with"), emailAddress),
             let alert = UIAlertController(title: String.localizedStringWithFormat(String.localized("ask_start_chat_with"), emailAddress),