Use ExpandableText

This commit is contained in:
Shav Kinderlehrer 2024-01-30 17:10:18 -05:00
parent 092084cb56
commit 816cec03c0
4 changed files with 26 additions and 25 deletions

View File

@ -17,8 +17,8 @@
3D13F9692B389FA300E91913 /* ViewOffsetKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D13F9682B389FA300E91913 /* ViewOffsetKey.swift */; }; 3D13F9692B389FA300E91913 /* ViewOffsetKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D13F9682B389FA300E91913 /* ViewOffsetKey.swift */; };
3D13F96F2B38A32500E91913 /* StickyHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D13F96E2B38A32500E91913 /* StickyHeaderView.swift */; }; 3D13F96F2B38A32500E91913 /* StickyHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D13F96E2B38A32500E91913 /* StickyHeaderView.swift */; };
3D16FC3C2B2CDFB500E6D8B3 /* DashboardLibraryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D16FC3B2B2CDFB500E6D8B3 /* DashboardLibraryView.swift */; }; 3D16FC3C2B2CDFB500E6D8B3 /* DashboardLibraryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D16FC3B2B2CDFB500E6D8B3 /* DashboardLibraryView.swift */; };
3D21F4292B69A8B0007207D2 /* ExpandableText in Frameworks */ = {isa = PBXBuildFile; productRef = 3D21F4282B69A8B0007207D2 /* ExpandableText */; };
3D3816C92B4B5648006414D7 /* ItemGenresView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D3816C82B4B5648006414D7 /* ItemGenresView.swift */; }; 3D3816C92B4B5648006414D7 /* ItemGenresView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D3816C82B4B5648006414D7 /* ItemGenresView.swift */; };
3D3816CE2B4B78BB006414D7 /* VisibilityTrackingScrollView in Frameworks */ = {isa = PBXBuildFile; productRef = 3D3816CD2B4B78BB006414D7 /* VisibilityTrackingScrollView */; };
3D41D1FA2B2CAE0000E58234 /* ItemIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D41D1F92B2CAE0000E58234 /* ItemIconView.swift */; }; 3D41D1FA2B2CAE0000E58234 /* ItemIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D41D1F92B2CAE0000E58234 /* ItemIconView.swift */; };
3D4C15722B3CAA670035373E /* DashboardSectionTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D4C15712B3CAA670035373E /* DashboardSectionTitleView.swift */; }; 3D4C15722B3CAA670035373E /* DashboardSectionTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D4C15712B3CAA670035373E /* DashboardSectionTitleView.swift */; };
3D58F07E2B4DB19300DB2936 /* TextRatingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D58F07D2B4DB19300DB2936 /* TextRatingView.swift */; }; 3D58F07E2B4DB19300DB2936 /* TextRatingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D58F07D2B4DB19300DB2936 /* TextRatingView.swift */; };
@ -133,8 +133,8 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
3D21F4292B69A8B0007207D2 /* ExpandableText in Frameworks */,
3D13F95C2B375A9E00E91913 /* NukeUI in Frameworks */, 3D13F95C2B375A9E00E91913 /* NukeUI in Frameworks */,
3D3816CE2B4B78BB006414D7 /* VisibilityTrackingScrollView in Frameworks */,
3D77093B2B29139700199889 /* PulseUI in Frameworks */, 3D77093B2B29139700199889 /* PulseUI in Frameworks */,
3D7709392B29139700199889 /* Pulse in Frameworks */, 3D7709392B29139700199889 /* Pulse in Frameworks */,
3D9064592B27E4C70063DD2A /* JellyfinKit in Frameworks */, 3D9064592B27E4C70063DD2A /* JellyfinKit in Frameworks */,
@ -359,7 +359,7 @@
3D77093A2B29139700199889 /* PulseUI */, 3D77093A2B29139700199889 /* PulseUI */,
3D13F9592B375A9E00E91913 /* Nuke */, 3D13F9592B375A9E00E91913 /* Nuke */,
3D13F95B2B375A9E00E91913 /* NukeUI */, 3D13F95B2B375A9E00E91913 /* NukeUI */,
3D3816CD2B4B78BB006414D7 /* VisibilityTrackingScrollView */, 3D21F4282B69A8B0007207D2 /* ExpandableText */,
); );
productName = Jel; productName = Jel;
productReference = 3D9063C72B279A310063DD2A /* Jel.app */; productReference = 3D9063C72B279A310063DD2A /* Jel.app */;
@ -436,7 +436,7 @@
packageReferences = ( packageReferences = (
3D7709372B29139700199889 /* XCRemoteSwiftPackageReference "Pulse" */, 3D7709372B29139700199889 /* XCRemoteSwiftPackageReference "Pulse" */,
3D13F9582B375A9E00E91913 /* XCRemoteSwiftPackageReference "Nuke" */, 3D13F9582B375A9E00E91913 /* XCRemoteSwiftPackageReference "Nuke" */,
3D3816CC2B4B78BA006414D7 /* XCRemoteSwiftPackageReference "VisibilityTrackingScrollView" */, 3D21F4272B69A8B0007207D2 /* XCRemoteSwiftPackageReference "ExpandableText" */,
); );
productRefGroup = 3D9063C82B279A310063DD2A /* Products */; productRefGroup = 3D9063C82B279A310063DD2A /* Products */;
projectDirPath = ""; projectDirPath = "";
@ -890,12 +890,12 @@
minimumVersion = 12.2.0; minimumVersion = 12.2.0;
}; };
}; };
3D3816CC2B4B78BA006414D7 /* XCRemoteSwiftPackageReference "VisibilityTrackingScrollView" */ = { 3D21F4272B69A8B0007207D2 /* XCRemoteSwiftPackageReference "ExpandableText" */ = {
isa = XCRemoteSwiftPackageReference; isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/elegantchaos/VisibilityTrackingScrollView"; repositoryURL = "https://github.com/n3d1117/ExpandableText?tab=readme-ov-file";
requirement = { requirement = {
kind = upToNextMinorVersion; branch = main;
minimumVersion = 1.0.0; kind = branch;
}; };
}; };
3D7709372B29139700199889 /* XCRemoteSwiftPackageReference "Pulse" */ = { 3D7709372B29139700199889 /* XCRemoteSwiftPackageReference "Pulse" */ = {
@ -919,10 +919,10 @@
package = 3D13F9582B375A9E00E91913 /* XCRemoteSwiftPackageReference "Nuke" */; package = 3D13F9582B375A9E00E91913 /* XCRemoteSwiftPackageReference "Nuke" */;
productName = NukeUI; productName = NukeUI;
}; };
3D3816CD2B4B78BB006414D7 /* VisibilityTrackingScrollView */ = { 3D21F4282B69A8B0007207D2 /* ExpandableText */ = {
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;
package = 3D3816CC2B4B78BA006414D7 /* XCRemoteSwiftPackageReference "VisibilityTrackingScrollView" */; package = 3D21F4272B69A8B0007207D2 /* XCRemoteSwiftPackageReference "ExpandableText" */;
productName = VisibilityTrackingScrollView; productName = ExpandableText;
}; };
3D7709382B29139700199889 /* Pulse */ = { 3D7709382B29139700199889 /* Pulse */ = {
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;

View File

@ -1,6 +1,15 @@
{ {
"object": { "object": {
"pins": [ "pins": [
{
"package": "ExpandableText",
"repositoryURL": "https://github.com/n3d1117/ExpandableText?tab=readme-ov-file",
"state": {
"branch": "main",
"revision": "2b0dd2f3d2870fe933ffe5c2ee057d2e9fa647e2",
"version": null
}
},
{ {
"package": "Get", "package": "Get",
"repositoryURL": "https://github.com/kean/Get", "repositoryURL": "https://github.com/kean/Get",
@ -36,15 +45,6 @@
"revision": "4ce950479707ea109f229d7230ec074a133b15d7", "revision": "4ce950479707ea109f229d7230ec074a133b15d7",
"version": "0.2.1" "version": "0.2.1"
} }
},
{
"package": "VisibilityTrackingScrollView",
"repositoryURL": "https://github.com/elegantchaos/VisibilityTrackingScrollView",
"state": {
"branch": null,
"revision": "9a5788298a1e238ed1e1f51b195a1296125a5a8c",
"version": "1.0.3"
}
} }
] ]
}, },

View File

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
import JellyfinKit import JellyfinKit
import VisibilityTrackingScrollView import ExpandableText
struct ItemMediaView: View { struct ItemMediaView: View {
@EnvironmentObject var jellyfinClient: JellyfinClientController @EnvironmentObject var jellyfinClient: JellyfinClientController
@ -22,9 +22,8 @@ struct ItemMediaView: View {
.font(.headline) .font(.headline)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
ForEach(item.overview?.components(separatedBy: "<br>") ?? [], id: \.self) {overview in ExpandableText((item.overview ?? "").replacingOccurrences(of: "<br>", with: ""))
Text(overview) .lineLimit(8)
}
} }
} }
} }

View File

@ -7,6 +7,7 @@
import SwiftUI import SwiftUI
import JellyfinKit import JellyfinKit
import ExpandableText
struct ItemPersonViewItemsRow: View { struct ItemPersonViewItemsRow: View {
var items: [BaseItemDto] var items: [BaseItemDto]
@ -45,7 +46,8 @@ struct ItemPersonView: View {
.padding() .padding()
if let overview = item.overview { if let overview = item.overview {
Text(overview) ExpandableText(overview)
.lineLimit(8)
.padding([.horizontal, .bottom]) .padding([.horizontal, .bottom])
} }