Browse Source

test

Signed-off-by: marinofaggiana <marino.faggiana@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
4f147a3e04
2 changed files with 27 additions and 19 deletions
  1. 23 15
      DashboardWidget/DashBoardList.swift
  2. 4 4
      Nextcloud.xcodeproj/project.pbxproj

+ 23 - 15
DashboardWidget/NCElementDashboard.swift → DashboardWidget/DashBoardList.swift

@@ -1,5 +1,5 @@
 //
-//  NCElementDashboard.swift
+//  DashBoardList.swift
 //  DashboardWidgetExtension
 //
 //  Created by Marino Faggiana on 20/08/22.
@@ -9,19 +9,34 @@
 import SwiftUI
 import WidgetKit
 
-struct NCElementDashboard: View {
-    var dataElement: NCDataDashboard
+struct DashBoardList: View {
+    var body: some View {
+        VStack(alignment: .center) {
+            Text("Dashboard")
+                .font(.largeTitle)
+                .bold()
+            VStack {
+                ForEach(NCDataDashboardList, id: \.id) { dataElement in
+                    DashboardElement(element: dataElement)
+                }
+            }
+        }.padding()
+    }
+}
+
+struct DashboardElement: View {
+    var element: NCDataDashboard
     var body: some View {
         HStack {
-            Image(dataElement.image)
+            Image(element.image)
                 .resizable()
                 .aspectRatio(contentMode: .fit)
                 .frame(width: 40, height: 40)
                 .clipShape(Circle())
             VStack(alignment: .leading) {
-                Text(dataElement.title)
+                Text(element.title)
                     .font(.headline)
-                Text(dataElement.subTitle)
+                Text(element.subTitle)
                     .font(.subheadline)
                     .foregroundColor(.accentColor)
             }
@@ -30,7 +45,7 @@ struct NCElementDashboard: View {
         .cornerRadius(8)
         .overlay(
             RoundedRectangle(cornerRadius: 8)
-                .stroke(Color(.sRGB, red: 150 / 255, green: 150/255, blue: 150/255, opacity: 0.4), lineWidth: 1)
+                .stroke(Color(.sRGB, red: 150 / 255, green: 150 / 255, blue: 150 / 255, opacity: 0.4), lineWidth: 1)
         )
         .shadow(radius: 1)
     }
@@ -38,14 +53,7 @@ struct NCElementDashboard: View {
 
 struct NCElementDashboard_Previews: PreviewProvider {
     static var previews: some View {
-
-//        ForEach(NCDataDashboardList, id: \.id) { dataDashboard in
-//            NCElementDashboard(dataElement: NCDataDashboardList[0])
-//                .previewContext(WidgetPreviewContext(family: .systemLarge))
-//        }
-
-
-        NCElementDashboard(dataElement: NCDataDashboardList[0])
+        DashBoardList()
             .previewContext(WidgetPreviewContext(family: .systemLarge))
     }
 }

+ 4 - 4
Nextcloud.xcodeproj/project.pbxproj

@@ -156,6 +156,7 @@
 		F72685E727C78E490019EF5E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F72685E927C78E490019EF5E /* InfoPlist.strings */; };
 		F726EEEC1FED1C820030B9C8 /* NCEndToEndInitialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = F726EEEB1FED1C820030B9C8 /* NCEndToEndInitialize.swift */; };
 		F72928A0253B0937009CA4FD /* NCMainNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F729289F253B0937009CA4FD /* NCMainNavigationController.swift */; };
+		F72A17D828B221E300F3F159 /* DashBoardList.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72A17D728B221E300F3F159 /* DashBoardList.swift */; };
 		F72A47EC2487B06B005AD489 /* NCOperationQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72A47EB2487B06B005AD489 /* NCOperationQueue.swift */; };
 		F72CD01227A7E92400E59476 /* JGProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = F72CD01127A7E92400E59476 /* JGProgressHUD */; };
 		F72CD63A25C19EBF00F46F9A /* NCAutoUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72CD63925C19EBF00F46F9A /* NCAutoUpload.swift */; };
@@ -387,7 +388,6 @@
 		F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7EF219C5B8000680748 /* NCCreateFormUploadAssets.swift */; };
 		F7DFB7F4219C5CA800680748 /* NCCreateFormUploadScanDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */; };
 		F7E0710128B13BB00001B882 /* NCDataDashboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E0710028B13BB00001B882 /* NCDataDashboard.swift */; };
-		F7E0710328B1453C0001B882 /* NCElementDashboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E0710228B1453C0001B882 /* NCElementDashboard.swift */; };
 		F7E0CDCF265CE8610044854E /* NCUserStatus.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */; };
 		F7E4D9C422ED929B003675FD /* NCShareCommentsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E4D9C322ED929B003675FD /* NCShareCommentsCell.swift */; };
 		F7E572FD278F146C00F8C99E /* OpenSSL.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F70B86802642CF5400ED5349 /* OpenSSL.xcframework */; };
@@ -676,6 +676,7 @@
 		F728B2BB23E83AD200E12DA0 /* Notification_Service_Extension.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Notification_Service_Extension.plist; sourceTree = "<group>"; };
 		F728B2BC23E83AD200E12DA0 /* Notification_Service_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Notification_Service_Extension.entitlements; sourceTree = "<group>"; };
 		F729289F253B0937009CA4FD /* NCMainNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMainNavigationController.swift; sourceTree = "<group>"; };
+		F72A17D728B221E300F3F159 /* DashBoardList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DashBoardList.swift; sourceTree = "<group>"; };
 		F72A47EB2487B06B005AD489 /* NCOperationQueue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCOperationQueue.swift; sourceTree = "<group>"; };
 		F72CD63925C19EBF00F46F9A /* NCAutoUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAutoUpload.swift; sourceTree = "<group>"; };
 		F72D1005210B6882009C96B7 /* NCPushNotificationEncryption.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCPushNotificationEncryption.m; sourceTree = "<group>"; };
@@ -954,7 +955,6 @@
 		F7DFB7EF219C5B8000680748 /* NCCreateFormUploadAssets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadAssets.swift; sourceTree = "<group>"; };
 		F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadScanDocument.swift; sourceTree = "<group>"; };
 		F7E0710028B13BB00001B882 /* NCDataDashboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCDataDashboard.swift; sourceTree = "<group>"; };
-		F7E0710228B1453C0001B882 /* NCElementDashboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCElementDashboard.swift; sourceTree = "<group>"; };
 		F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCUserStatus.storyboard; sourceTree = "<group>"; };
 		F7E45E6D21E75BF200579249 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F7E4D9C322ED929B003675FD /* NCShareCommentsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCommentsCell.swift; sourceTree = "<group>"; };
@@ -1302,8 +1302,8 @@
 			isa = PBXGroup;
 			children = (
 				F7346E2228B0FEBA006CE2D2 /* Assets.xcassets */,
+				F72A17D728B221E300F3F159 /* DashBoardList.swift */,
 				F7346E1528B0EF5C006CE2D2 /* DashboardWidget.swift */,
-				F7E0710228B1453C0001B882 /* NCElementDashboard.swift */,
 				F7E0710028B13BB00001B882 /* NCDataDashboard.swift */,
 				F7346E2028B0FA3A006CE2D2 /* DashboardWidget-Brinding-header.h */,
 			);
@@ -2581,9 +2581,9 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				F7E0710328B1453C0001B882 /* NCElementDashboard.swift in Sources */,
 				F7E0710128B13BB00001B882 /* NCDataDashboard.swift in Sources */,
 				F7346E1628B0EF5C006CE2D2 /* DashboardWidget.swift in Sources */,
+				F72A17D828B221E300F3F159 /* DashBoardList.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};