Browse Source

coding

Signed-off-by: marinofaggiana <marino.faggiana@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
fca310a2fa
2 changed files with 20 additions and 2 deletions
  1. 3 2
      Widget/Nextcloud/NextcloudData.swift
  2. 17 0
      Widget/Nextcloud/NextcloudWidgetView.swift

+ 3 - 2
Widget/Nextcloud/NextcloudData.swift

@@ -74,11 +74,11 @@ let recentDatasTest: [RecentData] = [
 ]
 
 let uploadDatasTest: [UploadData] = [
+    .init(id: "0", imagePath: "file"),
     .init(id: "1", imagePath: "file"),
     .init(id: "2", imagePath: "file"),
     .init(id: "3", imagePath: "file"),
-    .init(id: "4", imagePath: "file"),
-    .init(id: "5", imagePath: "file")
+    .init(id: "4", imagePath: "file")
 ]
 
 func getDataEntry(completion: @escaping (_ entry: NextcloudDataEntry) -> Void) {
@@ -232,6 +232,7 @@ func getDataEntry(completion: @escaping (_ entry: NextcloudDataEntry) -> Void) {
                     continue
                 }
                 uploadDatas.append(UploadData(id: metadata.ocId, imagePath: imagePath))
+                if uploadDatas.count == 5 { break}
             }
 
             // Completion

+ 17 - 0
Widget/Nextcloud/NextcloudWidgetView.swift

@@ -65,9 +65,26 @@ struct NextcloudWidgetView: View {
                         }
                     }
                 }
+                Spacer()
+                    .frame(width: .infinity, height: 15.0)
+                Text("File in upload ...")
+                    .font(.system(size: 12))
+                    .frame(maxWidth: .infinity, alignment: .center)
+                HStack(spacing: 10) {
+                    ForEach(entry.uploadDatas, id: \.id) { element in
+                        Image(uiImage: (UIImage(contentsOfFile: element.imagePath) ?? UIImage(named: "file"))!)
+                            .resizable()
+                            .scaledToFill()
+                            .frame(width: 30, height: 30)
+                            .clipped()
+                            .cornerRadius(4)
+                    }
+                }.frame(maxWidth: .infinity, alignment: .trailing)
+
             }
             .padding(.top, 45)
             .redacted(reason: entry.isPlaceholder ? .placeholder : [])
+
             Text(entry.footerText)
                 .font(.caption2)
                 .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)