Skip to content

Commit

Permalink
Enable links in descriptions on the session detail
Browse files Browse the repository at this point in the history
  • Loading branch information
woxtu committed Sep 1, 2023
1 parent 0fb3c4d commit 5a11f9f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app-ios/Modules/Sources/Session/SessionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ private let startDateFormatter: DateFormatter = {
public struct SessionView: View {
let viewModel: SessionViewModel
@State private var isDescriptionExpanded: Bool = false
@State private var canBeExpanded = false
@State private var canBeExpanded: Bool = false
@State private var presentingURL: IdentifiableURL?

public init(timetableItem: TimetableItem) {
self.viewModel = .init(timetableItem: timetableItem)
Expand Down Expand Up @@ -65,7 +66,7 @@ public struct SessionView: View {

if let session = viewModel.timetableItem as? TimetableItem.Session {
VStack(alignment: .leading, spacing: 16) {
Text(session.description_.currentLangTitle)
Text(.init(session.description_.currentLangTitle))
.textSelection(.enabled)
.lineLimit(isDescriptionExpanded ? nil : 5)
.background {
Expand Down Expand Up @@ -189,7 +190,16 @@ public struct SessionView: View {
}
}
}

.sheet(item: $presentingURL) { url in
if let url = url.id {
SafariView(url: url)
.ignoresSafeArea()
}
}
.environment(\.openURL, OpenURLAction { url in
presentingURL = IdentifiableURL(url)
return .handled
})
}
}

Expand Down

0 comments on commit 5a11f9f

Please sign in to comment.