Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Enable links in descriptions on the session detail #1046

Merged
merged 1 commit into from
Sep 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading