Browse Source

clear code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 1 year ago
parent
commit
3bc388fb78

+ 45 - 16
iOSClient/Diagnostics/NCCapabilitiesView.swift

@@ -36,7 +36,7 @@ class NCCapabilitiesViewOO: ObservableObject {
     init() {
 
         if ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" {
-            capabililies = [Capability(text: "File sharing", image: UIImage(named: "share")!.resizeImage(size: CGSize(width: 25, height: 25))!, available: true),
+            capabililies = [Capability(text: "Collabora", image: UIImage(named: "collabora")!, available: true),
                             Capability(text: "Externa site", image: UIImage(systemName: "network")!, available: false)
             ]
             homeServer = "https://cloud.nextcloud.com/remote.php.dav/files/marino/"
@@ -45,12 +45,24 @@ class NCCapabilitiesViewOO: ObservableObject {
             var textEditor = false
             var onlyofficeEditors = false
 
-            capabililies.append(Capability(text: "File sharing", image: UIImage(named: "share")!.resizeImage(size: CGSize(width: 25, height: 25))!, available: NCGlobal.shared.capabilityFileSharingApiEnabled))
-            capabililies.append(Capability(text: "External site", image: UIImage(systemName: "network")!, available: NCGlobal.shared.capabilityExternalSites))
-            capabililies.append(Capability(text: "End-to-End Encryption", image: UIImage(systemName: "lock")!, available: NCGlobal.shared.capabilityE2EEEnabled))
-            capabililies.append(Capability(text: "Activity", image: UIImage(systemName: "bolt")!, available: !NCGlobal.shared.capabilityActivity.isEmpty))
-            capabililies.append(Capability(text: "Notification", image: UIImage(systemName: "bell")!, available: !NCGlobal.shared.capabilityNotification.isEmpty))
-            capabililies.append(Capability(text: "Deleted files", image: UIImage(systemName: "trash")!, available: NCGlobal.shared.capabilityFilesUndelete))
+            if let image = UIImage(named: "share") {
+                capabililies.append(Capability(text: "File sharing", image: image, available: NCGlobal.shared.capabilityFileSharingApiEnabled))
+            }
+            if let image = UIImage(systemName: "network") {
+                capabililies.append(Capability(text: "External site", image: image, available: NCGlobal.shared.capabilityExternalSites))
+            }
+            if let image = UIImage(systemName: "lock") {
+                capabililies.append(Capability(text: "End-to-End Encryption", image: image, available: NCGlobal.shared.capabilityE2EEEnabled))
+            }
+            if let image = UIImage(systemName: "bolt") {
+                capabililies.append(Capability(text: "Activity", image: image, available: !NCGlobal.shared.capabilityActivity.isEmpty))
+            }
+            if let image = UIImage(systemName: "bell") {
+                capabililies.append(Capability(text: "Notification", image: image, available: !NCGlobal.shared.capabilityNotification.isEmpty))
+            }
+            if let image = UIImage(systemName: "trash") {
+                capabililies.append(Capability(text: "Deleted files", image: image, available: NCGlobal.shared.capabilityFilesUndelete))
+            }
 
             if let editors = NCManageDatabase.shared.getDirectEditingEditors(account: activeAccount.account) {
                 for editor in editors {
@@ -61,13 +73,28 @@ class NCCapabilitiesViewOO: ObservableObject {
                     }
                 }
             }
-            capabililies.append(Capability(text: "Text", image: UIImage(systemName: "doc.text")!, available: textEditor))
-            capabililies.append(Capability(text: "ONLYOFFICE", image: UIImage(named: "onlyoffice")!.resizeImage(size: CGSize(width: 25, height: 25))!, available: onlyofficeEditors))
-            capabililies.append(Capability(text: "Collabora", image: UIImage(named: "collabora")!.resizeImage(size: CGSize(width: 25, height: 25))!, available: !NCGlobal.shared.capabilityRichdocumentsMimetypes.isEmpty))
-            capabililies.append(Capability(text: "User Status", image: UIImage(systemName: "moon")!, available: NCGlobal.shared.capabilityUserStatusEnabled))
-            capabililies.append(Capability(text: "Comments", image: UIImage(systemName: "ellipsis.bubble")!, available: NCGlobal.shared.capabilityFilesComments))
-            capabililies.append(Capability(text: "Lock file", image: UIImage(systemName: "lock")!, available: !NCGlobal.shared.capabilityFilesLockVersion.isEmpty))
-            capabililies.append(Capability(text: "Group folders", image: UIImage(systemName: "person.2")!, available: NCGlobal.shared.capabilityGroupfoldersEnabled))
+
+            if let image = UIImage(systemName: "doc.text") {
+                capabililies.append(Capability(text: "Text", image: image, available: textEditor))
+            }
+            if let image = UIImage(named: "onlyoffice") {
+                capabililies.append(Capability(text: "ONLYOFFICE", image: image, available: onlyofficeEditors))
+            }
+            if let image = UIImage(named: "collabora") {
+                capabililies.append(Capability(text: "Collabora", image: image, available: !NCGlobal.shared.capabilityRichdocumentsMimetypes.isEmpty))
+            }
+            if let image = UIImage(systemName: "moon") {
+                capabililies.append(Capability(text: "User Status", image: image, available: NCGlobal.shared.capabilityUserStatusEnabled))
+            }
+            if let image = UIImage(systemName: "ellipsis.bubble") {
+                capabililies.append(Capability(text: "Comments", image: image, available: NCGlobal.shared.capabilityFilesComments))
+            }
+            if let image = UIImage(systemName: "lock") {
+                capabililies.append(Capability(text: "Lock file", image: image, available: !NCGlobal.shared.capabilityFilesLockVersion.isEmpty))
+            }
+            if let image = UIImage(systemName: "person.2") {
+                capabililies.append(Capability(text: "Group folders", image: image, available: NCGlobal.shared.capabilityGroupfoldersEnabled))
+            }
 
             homeServer = NCUtilityFileSystem.shared.getHomeServer(urlBase: activeAccount.urlBase, userId: activeAccount.userId) + "/"
         }
@@ -110,11 +137,13 @@ struct NCCapabilitiesView: View {
             Label {
                 Text(text)
                     .font(.system(size: 15))
-                    .foregroundColor(Color(UIColor.systemGray))
             } icon: {
                 image
                     .renderingMode(.template)
-                    .foregroundColor(Color(UIColor.systemGray))
+                    .resizable()
+                    .scaledToFill()
+                    .frame(width: 20.0, height: 20.0, alignment: .center)
+                    .foregroundColor(.primary)
             }
             .frame(maxWidth: .infinity, alignment: .leading)
         }

+ 1 - 1
iOSClient/Images.xcassets/collabora.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "collabora.pdf",
+      "filename" : "collabora.svg",
       "idiom" : "universal"
     }
   ],

BIN
iOSClient/Images.xcassets/collabora.imageset/collabora.pdf


+ 8 - 0
iOSClient/Images.xcassets/collabora.imageset/collabora.svg

@@ -0,0 +1,8 @@
+<svg width="32" height="32" version="1.0" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
+ <style id="stylish-12" class="stylish" type="text/css">.lo-menu &gt; li &gt; a:hover, .lo-menu &gt; li &gt; a:focus, .lo-menu &gt; li &gt; a:active, .lo-menu &gt; li &gt; a.highlighted {
+    background-color: #f5f4f9;
+    border-bottom-color: var(--color-primary-element);
+    color: var(--color-primary-element);
+}</style>
+ <path style="color:#000000;block-progression:tb;text-transform:none;text-indent:0" fill="#000" d="m14.357 1-7.0001 7.002 0.00549 0.00732 8.1738 7.7014 0.37537 0.35339-0.37537 0.35522-8.0804 7.6154 6.9617 6.9653 14.967-14.967zm-7.3572 8.2452v13.585l7.2363-6.7657z"/>
+</svg>

+ 1 - 1
iOSClient/Images.xcassets/onlyoffice.imageset/Contents.json

@@ -1,7 +1,7 @@
 {
   "images" : [
     {
-      "filename" : "onlyoffice.pdf",
+      "filename" : "onlyoffice.svg",
       "idiom" : "universal"
     }
   ],

+ 0 - 101
iOSClient/Images.xcassets/onlyoffice.imageset/onlyoffice.pdf

@@ -1,101 +0,0 @@
-%PDF-1.4
-%Óëéá
-1 0 obj
-<</Creator (Mozilla/5.0 \(Macintosh; Intel Mac OS X 10_15_5\) AppleWebKit/537.36 \(KHTML, like Gecko\) BoxySVG/3.41.0 Chrome/83.0.4103.122 Electron/9.1.0 Safari/537.36)
-/Producer (Skia/PDF m83)
-/CreationDate (D:20200729103828+00'00')
-/ModDate (D:20200729103828+00'00')>>
-endobj
-3 0 obj
-<</ca 1
-/BM /Normal>>
-endobj
-4 0 obj
-<</ca .4196
-/BM /Normal>>
-endobj
-5 0 obj
-<</Type /XObject
-/Subtype /Form
-/Resources <</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
-/ExtGState <</G3 3 0 R>>>>
-/BBox [0 0 1771 610]
-/Group <</Type /Group
-/S /Transparency
-/I true>>
-/Filter /FlateDecode
-/Length 170>> stream
-xœmP9Â0ìõ
-} B‡í8/ æ
ž
-R0ü+&‰
-äfµ^¯V~CÎdV³-ÈýÄná‚m…ËÕðñ1ªì¥hLºxá
-‚šH�|Á4 sF5šI¥exˆã4pƒ>÷ç­|º…‘qˆdoæR¨lšÉ™æð|×@Ë;éËìÚ#Pg5dõæØ&胷T¿°#br®A/‰ê†J$ÿ}kƒ'Üá_"ÚP
-endstream
-endobj
-6 0 obj
-<</ca .7176
-/BM /Normal>>
-endobj
-7 0 obj
-<</Type /XObject
-/Subtype /Form
-/Resources <</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
-/ExtGState <</G3 3 0 R>>>>
-/BBox [0 0 1771 665]
-/Group <</Type /Group
-/S /Transparency
-/I true>>
-/Filter /FlateDecode
-/Length 174>> stream
-xœU�KÂ0†÷œ‚$‘žÀµgÈŒºhŽ÷Ÿ‘<ª)Yý_xüð†”HÕ’®üÍjÉ9bÙárS|~€•,ÔÅ9ÓŠ,$�‡T‰®52Î4Qj4"W†(àÈB6j6àxtõ<nØ�¯Ôðµé!­'�LùÜD™|Nœ‰�Œâôs8ÁÜgÙŠ½Ö[]€­oÂ(rXp{n§­g~�ºÅ\קkxÁîðyH6
-endstream
-endobj
-8 0 obj
-<</Filter /FlateDecode
-/Length 225>> stream
-xœmQAn!¼û>GŠƒ1ö^©çœ’ûªMI«¤ÿ—j »°RX	Í3¶aÉËT:ûö4Ðà•œÑŒóPÎ9%GYDôü‚ÓÌÁµFÙ™],©ÃgÀËΊ¿pÜxbÍ›%-UÉ*m¤-«)Ê®,�¬+¼[ƒ‰beo`ªØ©Éü’1“,E0­UæMuJ‰•c5ÚÂ~BŽk§QM”ÚöäâH‹˜‡67^¼}�®õ‰{º_Άì�ôÕ*—!ãJúÊÕ7êÛWœá
-ßö/Žð?¾jT
-endstream
-endobj
-2 0 obj
-<</Type /Page
-/Resources <</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
-/ExtGState <</G3 3 0 R
-/G4 4 0 R
-/G6 6 0 R>>
-/XObject <</X5 5 0 R
-/X7 7 0 R>>>>
-/MediaBox [0 0 425.03998 425.03998]
-/Contents 8 0 R
-/StructParents 0
-/Parent 9 0 R>>
-endobj
-9 0 obj
-<</Type /Pages
-/Count 1
-/Kids [2 0 R]>>
-endobj
-10 0 obj
-<</Type /Catalog
-/Pages 9 0 R>>
-endobj
-xref
-0 11
-0000000000 65535 f 
-0000000015 00000 n 
-0000001571 00000 n 
-0000000301 00000 n 
-0000000338 00000 n 
-0000000379 00000 n 
-0000000805 00000 n 
-0000000846 00000 n 
-0000001276 00000 n 
-0000001824 00000 n 
-0000001879 00000 n 
-trailer
-<</Size 11
-/Root 10 0 R
-/Info 1 0 R>>
-startxref
-1927
-%%EOF

+ 3 - 0
iOSClient/Images.xcassets/onlyoffice.imageset/onlyoffice.svg

@@ -0,0 +1,3 @@
+<?xml version="1.0" standalone="no"?>
+        <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
+        "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">  <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>ONLYOFFICE</title><path d="M10.501 11.724.631 7.16c-.841-.399-.841-1.014 0-1.376l9.87-4.563c.841-.399 2.194-.399 2.998 0l9.87 4.563c.841.398.841 1.014 0 1.376l-9.87 4.563c-.841.362-2.194.362-2.998 0zm0 5.468-9.87-4.563c-.841-.399-.841-1.014 0-1.376l3.363-1.558 6.507 3.006c.841.398 2.194.398 2.998 0l6.507-3.006 3.363 1.558c.841.398.841 1.014 0 1.376l-9.87 4.563c-.841.398-2.194.398-2.998 0zm0 0.0001-9.87-4.563c-.841-.399-.841-1.014 0-1.376l3.363-1.558 6.507 3.006c.841.398 2.194.398 2.998 0l6.507-3.006 3.363 1.558c.841.398.841 1.014 0 1.376l-9.87 4.563c-.841.398-2.194.398-2.998 0zm0 5.613-9.87-4.563c-.841-.398-.841-1.014 0-1.376l3.436-1.593 6.398 2.97c.84.398 2.193.398 2.997 0l6.398-2.97 3.436 1.593c.841.399.841 1.014 0 1.376l-9.87 4.563c-.768.362-2.12.362-2.925 0z"/></svg>