From a7a8b539c0f4ba56d6de12976a9181cc547e3255 Mon Sep 17 00:00:00 2001 From: Francesco Date: Fri, 6 Feb 2026 19:17:02 +0100 Subject: [PATCH 1/2] fix: crash on smaller screen + scale factor for strings in stat card --- flo.xcodeproj/project.pbxproj | 4 ++++ flo/Navigation/HomeView.swift | 6 ++++-- flo/Shared/Utils/UIScreen+.swift | 10 ++++++++++ flo/StatCardView.swift | 6 ++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 flo/Shared/Utils/UIScreen+.swift diff --git a/flo.xcodeproj/project.pbxproj b/flo.xcodeproj/project.pbxproj index c22fa3c..0100494 100644 --- a/flo.xcodeproj/project.pbxproj +++ b/flo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + B02A003F2F36662C0024E8EC /* UIScreen+.swift in Sources */ = {isa = PBXBuildFile; fileRef = B02A003E2F3666240024E8EC /* UIScreen+.swift */; }; C401D09A2C5AED9F009F91C7 /* LocalFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C401D0992C5AED9F009F91C7 /* LocalFileManager.swift */; }; C4051DFF2CD25BBA0039D062 /* ArtistsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4051DFE2CD25BBA0039D062 /* ArtistsView.swift */; }; C4100A692CE78B25001BC9BE /* PlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4100A682CE78B21001BC9BE /* PlaylistView.swift */; }; @@ -78,6 +79,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + B02A003E2F3666240024E8EC /* UIScreen+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScreen+.swift"; sourceTree = ""; }; C401D0992C5AED9F009F91C7 /* LocalFileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalFileManager.swift; sourceTree = ""; }; C4051DFE2CD25BBA0039D062 /* ArtistsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArtistsView.swift; sourceTree = ""; }; C4100A682CE78B21001BC9BE /* PlaylistView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistView.swift; sourceTree = ""; }; @@ -195,6 +197,7 @@ C4289F4D2C1253EB00C3A4FD /* Utils */ = { isa = PBXGroup; children = ( + B02A003E2F3666240024E8EC /* UIScreen+.swift */, C456D8F92F2FF33B002AAB8B /* LRCParser.swift */, C4F0B0A12F3A111100ABC002 /* AirPlayRoutePicker.swift */, C415F5592C11953000E3E1D2 /* Constants.swift */, @@ -427,6 +430,7 @@ C4100A6B2CE78B62001BC9BE /* Playlist.swift in Sources */, C4A4BF332C14437700363290 /* LibraryView.swift in Sources */, C46B8DD72CF4B89000B40644 /* Stats.swift in Sources */, + B02A003F2F36662C0024E8EC /* UIScreen+.swift in Sources */, C4F0B0A22F3A111100ABC002 /* AirPlayRoutePicker.swift in Sources */, C415F5642C11AA8700E3E1D2 /* Fonts.swift in Sources */, C456D8FE2F300D3D002AAB8B /* LyricsView.swift in Sources */, diff --git a/flo/Navigation/HomeView.swift b/flo/Navigation/HomeView.swift index 5af6def..84d757b 100644 --- a/flo/Navigation/HomeView.swift +++ b/flo/Navigation/HomeView.swift @@ -105,8 +105,10 @@ struct HomeView: View { VStack(alignment: .leading, spacing: 16) { Text("Listening Activity (all time)").customFont(.title2).fontWeight(.bold) .multilineTextAlignment(.leading) - - EqualHeightHStack(alignment: .top, spacing: 16) { + + let statCardSpacing: CGFloat = UIScreen.screenWidth <= 375 ? 8 : 16 + + EqualHeightHStack(alignment: .top, spacing: statCardSpacing) { EqualHeightItem { StatCard( title: "Total Listens", diff --git a/flo/Shared/Utils/UIScreen+.swift b/flo/Shared/Utils/UIScreen+.swift new file mode 100644 index 0000000..859813e --- /dev/null +++ b/flo/Shared/Utils/UIScreen+.swift @@ -0,0 +1,10 @@ +// flo + +import SwiftUI + +extension UIScreen { + static let screenWidth = UIScreen.main.bounds.size.width + static let screenHeight = UIScreen.main.bounds.size.height + static let screenSize = UIScreen.main.bounds.size +} + diff --git a/flo/StatCardView.swift b/flo/StatCardView.swift index ce2d0f7..18be8c4 100644 --- a/flo/StatCardView.swift +++ b/flo/StatCardView.swift @@ -43,6 +43,7 @@ struct StatCard: View { Text(title) .foregroundColor(.secondary) .customFont(.body) + .minimumScaleFactor(0.7) Spacer() @@ -60,6 +61,7 @@ struct StatCard: View { .lineSpacing(2) .fontWeight(.bold) .lineLimit(2) + .minimumScaleFactor(0.7) if let subtitle = subtitle { Text(subtitle) @@ -67,6 +69,7 @@ struct StatCard: View { .customFont(.subheadline) .lineSpacing(2) .lineLimit(2) + .minimumScaleFactor(0.7) } } } @@ -81,6 +84,7 @@ struct StatCard: View { Text(title) .foregroundColor(.secondary) .customFont(.body) + .minimumScaleFactor(0.7) Spacer() @@ -98,6 +102,7 @@ struct StatCard: View { .lineSpacing(2) .fontWeight(.bold) .lineLimit(2) + .minimumScaleFactor(0.7) if let subtitle = subtitle { Text(subtitle) @@ -105,6 +110,7 @@ struct StatCard: View { .customFont(.subheadline) .lineSpacing(2) .lineLimit(2) + .minimumScaleFactor(0.7) } } } From 87f936085c9261ed8020ea12136a2736ec6d915d Mon Sep 17 00:00:00 2001 From: Francesco Date: Fri, 6 Feb 2026 20:06:50 +0100 Subject: [PATCH 2/2] fix: bottom floating view for smaller screen --- flo/ContentView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flo/ContentView.swift b/flo/ContentView.swift index 1816c10..c434947 100644 --- a/flo/ContentView.swift +++ b/flo/ContentView.swift @@ -74,6 +74,7 @@ struct ContentView: View { Spacer() if playerViewModel.hasNowPlaying() && !playerViewModel.shouldHidePlayer { + let bottomPaddingForSmallerScreens: CGFloat = UIScreen.screenWidth <= 375 ? 32 : 0 FloatingPlayerView(viewModel: playerViewModel) .padding(.bottom, 50) .opacity(playerViewModel.hasNowPlaying() ? 1 : 0) @@ -106,6 +107,7 @@ struct ContentView: View { self.isSwipping = false } ) + .padding(.bottom, bottomPaddingForSmallerScreens) } } }