From b43e203721360bf0f387e913687666e02ee288c5 Mon Sep 17 00:00:00 2001 From: Marcin Czachurski Date: Wed, 27 Sep 2023 15:43:00 +0200 Subject: [PATCH] Fix width of statuses waterfall view --- Vernissage.xcodeproj/project.pbxproj | 12 +++++------ .../ViewModifiers/NavigationMenuButtons.swift | 21 +++++++++++-------- Vernissage/Widgets/WaterfallGrid.swift | 2 +- .../ViewModifiers/DeviceRotation.swift | 4 +++- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Vernissage.xcodeproj/project.pbxproj b/Vernissage.xcodeproj/project.pbxproj index 8096964..f6c75dc 100644 --- a/Vernissage.xcodeproj/project.pbxproj +++ b/Vernissage.xcodeproj/project.pbxproj @@ -1321,7 +1321,7 @@ CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 213; + CURRENT_PROJECT_VERSION = 214; DEVELOPMENT_TEAM = B2U9FEKYP8; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = VernissageWidget/Info.plist; @@ -1352,7 +1352,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 213; + CURRENT_PROJECT_VERSION = 214; DEVELOPMENT_TEAM = B2U9FEKYP8; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = VernissageWidget/Info.plist; @@ -1382,7 +1382,7 @@ CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 213; + CURRENT_PROJECT_VERSION = 214; DEVELOPMENT_TEAM = B2U9FEKYP8; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = VernissageShare/Info.plist; @@ -1411,7 +1411,7 @@ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = NO; CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 213; + CURRENT_PROJECT_VERSION = 214; DEVELOPMENT_TEAM = B2U9FEKYP8; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = VernissageShare/Info.plist; @@ -1565,7 +1565,7 @@ CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 213; + CURRENT_PROJECT_VERSION = 214; DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\""; DEVELOPMENT_TEAM = B2U9FEKYP8; ENABLE_PREVIEWS = YES; @@ -1608,7 +1608,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 213; + CURRENT_PROJECT_VERSION = 214; DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\""; DEVELOPMENT_TEAM = B2U9FEKYP8; ENABLE_PREVIEWS = YES; diff --git a/Vernissage/ViewModifiers/NavigationMenuButtons.swift b/Vernissage/ViewModifiers/NavigationMenuButtons.swift index 1a3e29c..a363819 100644 --- a/Vernissage/ViewModifiers/NavigationMenuButtons.swift +++ b/Vernissage/ViewModifiers/NavigationMenuButtons.swift @@ -20,7 +20,7 @@ private struct NavigationMenuButtons: ViewModifier { @EnvironmentObject var routerPath: RouterPath private let onViewModeIconTap: (MainView.ViewMode) -> Void - private let imageFontSize = 20.0 + private let imageFontSize = UIDevice.isIPad ? 30.0 : 20.0 private let customMenuItems = [ NavigationMenuItemDetails(viewMode: .home), @@ -88,22 +88,22 @@ private struct NavigationMenuButtons: ViewModifier { self.contextMenuView() self.customMenuItemsView() } - .frame(height: 50) - .padding(.horizontal, 8) + .frame(height: UIDevice.isIPad ? 64 : 50) + .padding(.horizontal, UIDevice.isIPad ? 16 : 8) .background(.ultraThinMaterial) .clipShape(Capsule()) self.composeImageView() - .frame(height: 50) - .padding(.horizontal, 8) + .frame(height: UIDevice.isIPad ? 64 : 50) + .padding(.horizontal, UIDevice.isIPad ? 16 : 8) .background(.ultraThinMaterial) .clipShape(Circle()) } } else { HStack(alignment: .center) { self.composeImageView() - .frame(height: 50) - .padding(.horizontal, 8) + .frame(height: UIDevice.isIPad ? 64 : 50) + .padding(.horizontal, UIDevice.isIPad ? 16 : 8) .background(.ultraThinMaterial) .clipShape(Circle()) @@ -111,8 +111,8 @@ private struct NavigationMenuButtons: ViewModifier { self.customMenuItemsView() self.contextMenuView() } - .frame(height: 50) - .padding(.horizontal, 8) + .frame(height: UIDevice.isIPad ? 64 : 50) + .padding(.horizontal, UIDevice.isIPad ? 16 : 8) .background(.ultraThinMaterial) .clipShape(Capsule()) } @@ -128,6 +128,7 @@ private struct NavigationMenuButtons: ViewModifier { } label: { Image(systemName: "ellipsis") .font(.system(size: self.imageFontSize)) + .fontWeight(UIDevice.isIPad ? .light : .regular) .foregroundColor(.mainTextColor.opacity(0.75)) .padding(.vertical, 10) .padding(.horizontal, 8) @@ -149,6 +150,7 @@ private struct NavigationMenuButtons: ViewModifier { } label: { Image(systemName: "plus") .font(.system(size: self.imageFontSize)) + .fontWeight(UIDevice.isIPad ? .light : .regular) .foregroundColor(.mainTextColor.opacity(0.75)) .padding(.vertical, 10) .padding(.horizontal, 8) @@ -162,6 +164,7 @@ private struct NavigationMenuButtons: ViewModifier { } label: { Image(systemName: displayedCustomMenuItem.image) .font(.system(size: self.imageFontSize)) + .fontWeight(UIDevice.isIPad ? .light : .regular) .foregroundColor(.mainTextColor.opacity(0.75)) .padding(.vertical, 10) .padding(.horizontal, 8) diff --git a/Vernissage/Widgets/WaterfallGrid.swift b/Vernissage/Widgets/WaterfallGrid.swift index 2f7e000..4206270 100644 --- a/Vernissage/Widgets/WaterfallGrid.swift +++ b/Vernissage/Widgets/WaterfallGrid.swift @@ -23,7 +23,7 @@ struct WaterfallGrid: View where Data: RandomAccessCollection private let semaphore = AsyncSemaphore(value: 1) var body: some View { - HStack(alignment: .top, spacing: 20) { + HStack(alignment: .top, spacing: 8) { ForEach(self.columnsData, id: \.id) { columnData in LazyVStack(spacing: 8) { ForEach(columnData.data, id: \.id) { item in diff --git a/WidgetsKit/Sources/WidgetsKit/ViewModifiers/DeviceRotation.swift b/WidgetsKit/Sources/WidgetsKit/ViewModifiers/DeviceRotation.swift index 058bc51..29a4c18 100644 --- a/WidgetsKit/Sources/WidgetsKit/ViewModifiers/DeviceRotation.swift +++ b/WidgetsKit/Sources/WidgetsKit/ViewModifiers/DeviceRotation.swift @@ -35,6 +35,7 @@ struct DeviceImageGallery: ViewModifier { @Environment(\.horizontalSizeClass) var horizontalSizeClass: UserInterfaceSizeClass? let action: (GalleryProperties) -> Void + let imageSpacing = 8 func body(content: Content) -> some View { GeometryReader { geometry in @@ -69,9 +70,10 @@ struct DeviceImageGallery: ViewModifier { } else { // View like on iPad. let imageColumns = geometry.size.width > geometry.size.height ? 3 : 2 + let marginSpacing = self.imageSpacing * (imageColumns - 1) return GalleryProperties(imageColumns: imageColumns, - containerWidth: geometry.size.width / Double(imageColumns), + containerWidth: (geometry.size.width - Double(marginSpacing)) / Double(imageColumns), containerHeight: geometry.size.height / Double(imageColumns)) } }