Răsfoiți Sursa

move state-to-string to chat-view, remove unneeded strings

B. Petersen 5 ani în urmă
părinte
comite
d50e8c0e5d

+ 17 - 1
deltachat-ios/Controller/ChatViewController.swift

@@ -618,8 +618,24 @@ extension ChatViewController: MessagesDataSource {
             let text = NSMutableAttributedString()
             text.append(NSAttributedString(string: m.formattedSentDate(), attributes: timestampAttributes))
 
+            // TODO: this should be replaced by the respective icons,
+            // for accessibility, the a11y strings should be added
+            var stateDescription: String
+            switch Int32(m.state) {
+            case DC_STATE_OUT_PENDING:
+                stateDescription = "Pending"
+            case DC_STATE_OUT_DELIVERED:
+                stateDescription = "Sent"
+            case DC_STATE_OUT_MDN_RCVD:
+                stateDescription = "Read"
+            case DC_STATE_OUT_FAILED:
+                stateDescription = "Failed"
+            default:
+                stateDescription = "Unknown"
+            }
+
             text.append(NSAttributedString(
-                string: " - " + m.stateDescription(),
+                string: " - " + stateDescription,
                 attributes: [
                     .font: UIFont.systemFont(ofSize: 12),
                     .foregroundColor: UIColor.darkText,

+ 0 - 23
deltachat-ios/DC/Wrapper.swift

@@ -690,29 +690,6 @@ class DcMsg: MessageType {
         return Int(dc_msg_get_state(messagePointer))
     }
 
-    func stateDescription() -> String {
-        switch Int32(state) {
-        case DC_STATE_IN_FRESH:
-            return "Fresh"
-        case DC_STATE_IN_NOTICED:
-            return "Noticed"
-        case DC_STATE_IN_SEEN:
-            return "Seen"
-        case DC_STATE_OUT_DRAFT:
-            return "Draft"
-        case DC_STATE_OUT_PENDING:
-            return "Pending"
-        case DC_STATE_OUT_DELIVERED:
-            return "Sent"
-        case DC_STATE_OUT_MDN_RCVD:
-            return "Read"
-        case DC_STATE_OUT_FAILED:
-            return "Failed"
-        default:
-            return "Unknown"
-        }
-    }
-
     var timestamp: Int64 {
         return Int64(dc_msg_get_timestamp(messagePointer))
     }