marinofaggiana 3 ani în urmă
părinte
comite
28d2b0446a
1 a modificat fișierele cu 5 adăugiri și 106 ștergeri
  1. 5 106
      iOSClient/Main/NCFunctionCenter.swift

+ 5 - 106
iOSClient/Main/NCFunctionCenter.swift

@@ -481,112 +481,11 @@ import Queuer
 
             for item in items { pasteboardTypes.append(item.key) }
             
-            // image
-            var filter = pasteboardTypes.filter({ UTTypeConformsTo($0 as CFString, kUTTypeImage) })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first) { continue }
-            }
-
-            // movie
-            filter = pasteboardTypes.filter({ UTTypeConformsTo($0 as CFString, kUTTypeMovie) })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // audio
-            filter = pasteboardTypes.filter({ UTTypeConformsTo($0 as CFString, kUTTypeAudio) })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // PDF
-            filter = pasteboardTypes.filter({ UTTypeConformsTo($0 as CFString, kUTTypePDF) })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // ARCHIVE
-            filter = pasteboardTypes.filter({ UTTypeConformsTo($0 as CFString, kUTTypeZipArchive) })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // DOCX
-            filter = pasteboardTypes.filter({ $0 == "org.openxmlformats.wordprocessingml.document" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // DOC
-            filter = pasteboardTypes.filter({ $0 == "com.microsoft.word.doc" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // PAGES
-            filter = pasteboardTypes.filter({ $0 == "com.apple.iwork.pages.pages" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // XLSX
-            filter = pasteboardTypes.filter({ $0 == "org.openxmlformats.spreadsheetml.sheet" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // XLS
-            filter = pasteboardTypes.filter({ $0 == "com.microsoft.excel.xls" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // NUMBERS
-            filter = pasteboardTypes.filter({ $0 == "com.apple.iwork.numbers.numbers" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // PPTX
-            filter = pasteboardTypes.filter({ $0 == "org.openxmlformats.presentationml.presentation" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // PPT
-            filter = pasteboardTypes.filter({ $0 == "com.microsoft.powerpoint.ppt" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // KEYNOTE
-            filter = pasteboardTypes.filter({ $0 == "com.apple.iwork.keynote.key" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // MARKDOWN
-            filter = pasteboardTypes.filter({ $0 == "net.daringfireball.markdown" })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // RTF
-            filter = pasteboardTypes.filter({ UTTypeConformsTo($0 as CFString, kUTTypeRTF) })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            // TEXT
-            filter = pasteboardTypes.filter({ UTTypeConformsTo($0 as CFString, kUTTypeText) })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
-            }
-            
-            //HTML
-            filter = pasteboardTypes.filter({ UTTypeConformsTo($0 as CFString, kUTTypeHTML) })
-            if filter.count > 0 {
-                if upload(pasteboardType: filter.first, data: UIPasteboard.general.data(forPasteboardType: filter.first!, inItemSet: IndexSet([index]))?.first)  { continue }
+            for typeIdentifier in pasteboardTypes {
+                let data = UIPasteboard.general.data(forPasteboardType: typeIdentifier, inItemSet: IndexSet([index]))?.first
+                if upload(pasteboardType: typeIdentifier, data: data) {
+                    continue
+                }
             }
         }
     }