File tree Expand file tree Collapse file tree
Mastodon/In Progress New Layout and Datamodel/Timeline Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -777,7 +777,13 @@ private struct HomeTimelinePostRowView: View {
777777 . onTapGesture {
778778 viewModel. openThreadView ( )
779779 }
780-
780+ . environment ( \. openURL, OpenURLAction { url in
781+ if viewModel. openURL ( url) {
782+ return . handled
783+ } else {
784+ return . systemAction( url)
785+ }
786+ } )
781787
782788 if let attachment = viewModel. fullPost? . actionablePost? . content. attachment {
783789 switch attachment {
@@ -1084,6 +1090,20 @@ struct AttributedStringDisplayInfo {
10841090 false ) ) ) ) ) , transition: . show)
10851091 }
10861092
1093+ func openURL( _ url: URL ) -> Bool {
1094+ if let mention = fullPost? . actionablePost? . content. htmlWithEntities? . mentions. first ( where: { $0. url == url. absoluteString } ) {
1095+ goToProfile ( mention)
1096+ return true
1097+ } else if let hashtag = fullPost? . actionablePost? . content. htmlWithEntities? . tags. first ( where: { $0. name. lowercased ( ) == url. lastPathComponent. lowercased ( ) && url. pathComponents. contains ( " tags " ) } ) {
1098+ guard let currentUser = AuthenticationServiceProvider . shared. currentActiveUser. value else { return false }
1099+ let hashtagTimelineViewModel = HashtagTimelineViewModel ( authenticationBox: currentUser, hashtag: hashtag. name)
1100+ actionHandler? . presentScene ( . hashtagTimeline( viewModel: hashtagTimelineViewModel) , transition: . show)
1101+ return true
1102+ } else {
1103+ return false
1104+ }
1105+ }
1106+
10871107 func didSelect( meta: Meta ? ) {
10881108 switch meta {
10891109 case . none:
You can’t perform that action at this time.
0 commit comments