Browse Source

coding

Signed-off-by: marinofaggiana <marino.faggiana@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
dd526cf2bc

+ 4 - 2
Widget/Nextcloud/NextcloudData.swift

@@ -62,10 +62,12 @@ let uploadDatasTest: [UploadData] = [
     .init(id: "5", image: UIImage(named: "nextcloud")!, task: 0),
     .init(id: "6", image: UIImage(named: "nextcloud")!, task: 0),
     .init(id: "7", image: UIImage(named: "nextcloud")!, task: 0),
-    .init(id: "8", image: UIImage(named: "nextcloud")!, task: 0)
+    .init(id: "8", image: UIImage(named: "nextcloud")!, task: 0),
+    .init(id: "9", image: UIImage(named: "nextcloud")!, task: 0),
+    .init(id: "0", image: UIImage(named: "nextcloud")!, task: 0)
 ]
 
-func getDataEntry(isPreview: Bool, completion: @escaping (_ entry: NextcloudDataEntry) -> Void) {
+func getDataEntry(isPreview: Bool, size: CGSize, completion: @escaping (_ entry: NextcloudDataEntry) -> Void) {
 
     if isPreview {
         return completion(NextcloudDataEntry(date: Date(), recentDatas: recentDatasTest, uploadDatas: uploadDatasTest, isPlaceholder: true, footerText: ""))

+ 2 - 2
Widget/Nextcloud/NextcloudWidgetProvider.swift

@@ -33,13 +33,13 @@ struct NextcloudWidgetProvider: TimelineProvider {
     }
 
     func getSnapshot(in context: Context, completion: @escaping (Entry) -> Void) {
-        getDataEntry(isPreview: context.isPreview) { entry in
+        getDataEntry(isPreview: context.isPreview, size: context.displaySize) { entry in
             completion(entry)
         }
     }
 
     func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> Void) {
-        getDataEntry(isPreview: context.isPreview) { entry in
+        getDataEntry(isPreview: context.isPreview, size: context.displaySize) { entry in
             let timeLine = Timeline(entries: [entry], policy: .atEnd)
             completion(timeLine)
         }