diff --git a/app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt b/app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt index ba2b02281..d435e78ec 100644 --- a/app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt @@ -32,7 +32,6 @@ import com.jerboa.VoteType import com.jerboa.db.AccountViewModel import com.jerboa.db.AppSettingsViewModel import com.jerboa.loginFirstToast -import com.jerboa.openLink import com.jerboa.scrollToTop import com.jerboa.ui.components.common.BottomAppBarAll import com.jerboa.ui.components.common.getCurrentAccount @@ -146,9 +145,6 @@ fun CommunityActivity( onPostClick = { postView -> navController.navigate(route = "post/${postView.post.id}") }, - onPostLinkClick = { url -> - openLink(url, ctx, appSettingsViewModel.appSettings.value?.useCustomTabs ?: true, appSettingsViewModel.appSettings.value?.usePrivateTabs ?: false) - }, onSaveClick = { postView -> account?.also { acct -> communityViewModel.savePost( diff --git a/app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt b/app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt index 01ee78694..c59faf328 100644 --- a/app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt @@ -41,7 +41,6 @@ import com.jerboa.db.AccountViewModel import com.jerboa.db.AppSettingsViewModel import com.jerboa.fetchInitialData import com.jerboa.loginFirstToast -import com.jerboa.openLink import com.jerboa.scrollToTop import com.jerboa.ui.components.common.BottomAppBarAll import com.jerboa.ui.components.common.getCurrentAccount @@ -208,9 +207,6 @@ fun MainPostListingsContent( onPostClick = { postView -> navController.navigate(route = "post/${postView.post.id}") }, - onPostLinkClick = { url -> - openLink(url, ctx, appSettingsViewModel.appSettings.value?.useCustomTabs ?: true, appSettingsViewModel.appSettings.value?.usePrivateTabs ?: false) - }, onSaveClick = { postView -> account?.also { acct -> homeViewModel.savePost( diff --git a/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt b/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt index 2d3591662..06abb0a27 100644 --- a/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt @@ -34,7 +34,6 @@ import com.jerboa.db.AppSettingsViewModel import com.jerboa.getLocalizedStringForUserTab import com.jerboa.isScrolledToEnd import com.jerboa.loginFirstToast -import com.jerboa.openLink import com.jerboa.pagerTabIndicatorOffset2 import com.jerboa.scrollToTop import com.jerboa.ui.components.comment.CommentNodes @@ -325,9 +324,6 @@ fun UserTabs( onPostClick = { postView -> navController.navigate(route = "post/${postView.post.id}") }, - onPostLinkClick = { url -> - openLink(url, ctx, appSettingsViewModel.appSettings.value?.useCustomTabs ?: true, appSettingsViewModel.appSettings.value?.usePrivateTabs ?: false) - }, onSaveClick = { postView -> account?.also { acct -> personProfileViewModel.savePost( diff --git a/app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt b/app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt index 43a747a21..3cf6aaa58 100644 --- a/app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt @@ -36,7 +36,6 @@ import com.jerboa.db.AppSettingsViewModel import com.jerboa.getCommentParentId import com.jerboa.getDepthFromComment import com.jerboa.isModerator -import com.jerboa.openLink import com.jerboa.ui.components.comment.ShowCommentContextButtons import com.jerboa.ui.components.comment.commentNodeItems import com.jerboa.ui.components.comment.edit.CommentEditViewModel @@ -152,9 +151,6 @@ fun PostActivity( navController.navigate("commentReply") }, onPostClick = {}, - onPostLinkClick = { url -> - openLink(url, ctx, appSettingsViewModel.appSettings.value?.useCustomTabs ?: true, appSettingsViewModel.appSettings.value?.usePrivateTabs ?: false) - }, onSaveClick = { account?.also { acct -> postViewModel.savePost( diff --git a/app/src/main/java/com/jerboa/ui/components/post/PostListing.kt b/app/src/main/java/com/jerboa/ui/components/post/PostListing.kt index 8e1378b4e..3acd83488 100644 --- a/app/src/main/java/com/jerboa/ui/components/post/PostListing.kt +++ b/app/src/main/java/com/jerboa/ui/components/post/PostListing.kt @@ -254,7 +254,6 @@ fun PostNodeHeader( fun PostTitleBlock( postView: PostView, expandedImage: Boolean, - onPostLinkClick: (url: String) -> Unit, account: Account?, ) { val imagePost = postView.post.url?.let { isImage(it) } ?: run { false } @@ -266,7 +265,6 @@ fun PostTitleBlock( } else { PostTitleAndThumbnail( postView = postView, - onPostLinkClick = onPostLinkClick, account = account, ) } @@ -333,7 +331,6 @@ fun PostTitleAndImageLink( @Composable fun PostTitleAndThumbnail( postView: PostView, - onPostLinkClick: (url: String) -> Unit, account: Account?, ) { Column( @@ -361,7 +358,7 @@ fun PostTitleAndThumbnail( } } } - ThumbnailTile(postView = postView, onPostLinkClick = onPostLinkClick) + ThumbnailTile(postView = postView) } } } @@ -371,7 +368,6 @@ fun PostBody( postView: PostView, fullBody: Boolean, expandedImage: Boolean, - onPostLinkClick: (rl: String) -> Unit, account: Account?, ) { val post = postView.post @@ -381,7 +377,6 @@ fun PostBody( PostTitleBlock( postView = postView, expandedImage = expandedImage, - onPostLinkClick = onPostLinkClick, account = account, ) @@ -430,7 +425,6 @@ fun PostBody( fun PreviewStoryTitleAndMetadata() { PostBody( postView = samplePostView, - onPostLinkClick = {}, fullBody = false, expandedImage = false, account = null, @@ -660,7 +654,6 @@ fun PreviewPostListingCard() { onDownvoteClick = {}, onReplyClick = {}, onPostClick = {}, - onPostLinkClick = {}, onSaveClick = {}, onCommunityClick = {}, onEditPostClick = {}, @@ -688,7 +681,6 @@ fun PreviewLinkPostListing() { onDownvoteClick = {}, onReplyClick = {}, onPostClick = {}, - onPostLinkClick = {}, onSaveClick = {}, onCommunityClick = {}, onEditPostClick = {}, @@ -716,7 +708,6 @@ fun PreviewImagePostListingCard() { onDownvoteClick = {}, onReplyClick = {}, onPostClick = {}, - onPostLinkClick = {}, onSaveClick = {}, onCommunityClick = {}, onEditPostClick = {}, @@ -744,7 +735,6 @@ fun PreviewImagePostListingSmallCard() { onDownvoteClick = {}, onReplyClick = {}, onPostClick = {}, - onPostLinkClick = {}, onSaveClick = {}, onCommunityClick = {}, onEditPostClick = {}, @@ -772,7 +762,6 @@ fun PreviewLinkNoThumbnailPostListing() { onDownvoteClick = {}, onReplyClick = {}, onPostClick = {}, - onPostLinkClick = {}, onSaveClick = {}, onCommunityClick = {}, onEditPostClick = {}, @@ -798,7 +787,6 @@ fun PostListing( onDownvoteClick: (postView: PostView) -> Unit, onReplyClick: (postView: PostView) -> Unit = {}, onPostClick: (postView: PostView) -> Unit, - onPostLinkClick: (url: String) -> Unit, onSaveClick: (postView: PostView) -> Unit, onCommunityClick: (community: CommunitySafe) -> Unit, onEditPostClick: (postView: PostView) -> Unit, @@ -849,7 +837,6 @@ fun PostListing( }, onReplyClick = onReplyClick, onPostClick = onPostClick, - onPostLinkClick = onPostLinkClick, onSaveClick = onSaveClick, onCommunityClick = onCommunityClick, onEditPostClick = onEditPostClick, @@ -886,7 +873,6 @@ fun PostListing( }, onReplyClick = onReplyClick, onPostClick = onPostClick, - onPostLinkClick = onPostLinkClick, onSaveClick = onSaveClick, onCommunityClick = onCommunityClick, onEditPostClick = onEditPostClick, @@ -922,7 +908,6 @@ fun PostListing( onDownvoteClick(it) }, onPostClick = onPostClick, - onPostLinkClick = onPostLinkClick, onCommunityClick = onCommunityClick, onPersonClick = onPersonClick, isModerator = isModerator, @@ -987,7 +972,6 @@ fun PostListingList( onUpvoteClick: (postView: PostView) -> Unit, onDownvoteClick: (postView: PostView) -> Unit, onPostClick: (postView: PostView) -> Unit, - onPostLinkClick: (url: String) -> Unit, onCommunityClick: (community: CommunitySafe) -> Unit, onPersonClick: (personId: Int) -> Unit, isModerator: Boolean, @@ -1088,7 +1072,7 @@ fun PostListingList( ) } } - ThumbnailTile(postView, onPostLinkClick) + ThumbnailTile(postView) } } } @@ -1096,12 +1080,17 @@ fun PostListingList( @Composable private fun ThumbnailTile( postView: PostView, - onPostLinkClick: (url: String) -> Unit, ) { postView.post.url?.also { url -> + var showImageDialog by remember { mutableStateOf(false) } + + if (showImageDialog) { + ImageViewerDialog(url, onBackRequest = { showImageDialog = false }) + } + val postLinkPicMod = Modifier .size(POST_LINK_PIC_SIZE) - .clickable { onPostLinkClick(url) } + .clickable { showImageDialog = true } postView.post.thumbnail_url?.also { thumbnail -> PictrsThumbnailImage( @@ -1147,7 +1136,6 @@ fun PostListingListPreview() { onUpvoteClick = {}, onDownvoteClick = {}, onPostClick = {}, - onPostLinkClick = {}, onCommunityClick = {}, onPersonClick = {}, isModerator = false, @@ -1174,7 +1162,6 @@ fun PostListingListWithThumbPreview() { onUpvoteClick = {}, onDownvoteClick = {}, onPostClick = {}, - onPostLinkClick = {}, onCommunityClick = {}, onPersonClick = {}, isModerator = false, @@ -1192,7 +1179,6 @@ fun PostListingCard( onDownvoteClick: (postView: PostView) -> Unit, onReplyClick: (postView: PostView) -> Unit = {}, onPostClick: (postView: PostView) -> Unit, - onPostLinkClick: (url: String) -> Unit, onSaveClick: (postView: PostView) -> Unit, onCommunityClick: (community: CommunitySafe) -> Unit, onEditPostClick: (postView: PostView) -> Unit, @@ -1232,7 +1218,6 @@ fun PostListingCard( // Title + metadata PostBody( postView = postView, - onPostLinkClick = onPostLinkClick, fullBody = fullBody, expandedImage = expandedImage, account = account, diff --git a/app/src/main/java/com/jerboa/ui/components/post/PostListings.kt b/app/src/main/java/com/jerboa/ui/components/post/PostListings.kt index d0b819f98..0ef7ca507 100644 --- a/app/src/main/java/com/jerboa/ui/components/post/PostListings.kt +++ b/app/src/main/java/com/jerboa/ui/components/post/PostListings.kt @@ -42,7 +42,6 @@ fun PostListings( onUpvoteClick: (postView: PostView) -> Unit, onDownvoteClick: (postView: PostView) -> Unit, onPostClick: (postView: PostView) -> Unit, - onPostLinkClick: (url: String) -> Unit, onSaveClick: (postView: PostView) -> Unit, onEditPostClick: (postView: PostView) -> Unit, onDeletePostClick: (postView: PostView) -> Unit, @@ -97,7 +96,6 @@ fun PostListings( onUpvoteClick = onUpvoteClick, onDownvoteClick = onDownvoteClick, onPostClick = onPostClick, - onPostLinkClick = onPostLinkClick, onSaveClick = onSaveClick, onCommunityClick = onCommunityClick, onEditPostClick = onEditPostClick, @@ -143,7 +141,6 @@ fun PreviewPostListings() { onUpvoteClick = {}, onDownvoteClick = {}, onPostClick = {}, - onPostLinkClick = {}, onSaveClick = {}, onEditPostClick = {}, onDeletePostClick = {},