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

Fix thumbnail links being treated as images. Fixes #815 #816

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
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: 15 additions & 1 deletion app/src/main/java/com/jerboa/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class MainActivity : ComponentActivity() {
) {
val navController = rememberNavController()
val ctx = LocalContext.current
var serverVersionOutdatedViewed = remember { mutableStateOf(false) }
val serverVersionOutdatedViewed = remember { mutableStateOf(false) }

MarkdownHelper.init(
navController,
Expand Down Expand Up @@ -183,6 +183,8 @@ class MainActivity : ComponentActivity() {
postEditViewModel = postEditViewModel,
appSettingsViewModel = appSettingsViewModel,
showVotingArrowsInListView = appSettings?.showVotingArrowsInListView ?: true,
useCustomTabs = appSettings?.useCustomTabs ?: true,
usePrivateTabs = appSettings?.usePrivateTabs ?: false,
)
}
composable(
Expand Down Expand Up @@ -223,6 +225,8 @@ class MainActivity : ComponentActivity() {
appSettingsViewModel = appSettingsViewModel,
showVotingArrowsInListView = appSettings?.showVotingArrowsInListView ?: true,
siteViewModel = siteViewModel,
useCustomTabs = appSettings?.useCustomTabs ?: true,
usePrivateTabs = appSettings?.usePrivateTabs ?: false,
)
}
// Only necessary for community deeplinks
Expand Down Expand Up @@ -272,6 +276,8 @@ class MainActivity : ComponentActivity() {
appSettingsViewModel = appSettingsViewModel,
showVotingArrowsInListView = appSettings?.showVotingArrowsInListView ?: true,
siteViewModel = siteViewModel,
useCustomTabs = appSettings?.useCustomTabs ?: true,
usePrivateTabs = appSettings?.usePrivateTabs ?: false,
)
}
composable(
Expand Down Expand Up @@ -312,6 +318,8 @@ class MainActivity : ComponentActivity() {
appSettingsViewModel = appSettingsViewModel,
showVotingArrowsInListView = appSettings?.showVotingArrowsInListView ?: true,
siteViewModel = siteViewModel,
useCustomTabs = appSettings?.useCustomTabs ?: true,
usePrivateTabs = appSettings?.usePrivateTabs ?: false,
)
}
// Necessary for deep links
Expand Down Expand Up @@ -354,6 +362,8 @@ class MainActivity : ComponentActivity() {
appSettingsViewModel = appSettingsViewModel,
showVotingArrowsInListView = appSettings?.showVotingArrowsInListView ?: true,
siteViewModel = siteViewModel,
useCustomTabs = appSettings?.useCustomTabs ?: true,
usePrivateTabs = appSettings?.usePrivateTabs ?: false,
)
}
composable(
Expand Down Expand Up @@ -476,6 +486,8 @@ class MainActivity : ComponentActivity() {
commentReplyViewModel = commentReplyViewModel,
postEditViewModel = postEditViewModel,
navController = navController,
useCustomTabs = appSettings?.useCustomTabs ?: true,
usePrivateTabs = appSettings?.usePrivateTabs ?: false,
showCollapsedCommentContent = appSettings?.showCollapsedCommentContent ?: false,
showActionBarByDefault = appSettings?.showCommentActionBarByDefault ?: true,
showVotingArrowsInListView = appSettings?.showVotingArrowsInListView ?: true,
Expand Down Expand Up @@ -512,6 +524,8 @@ class MainActivity : ComponentActivity() {
commentReplyViewModel = commentReplyViewModel,
postEditViewModel = postEditViewModel,
navController = navController,
useCustomTabs = appSettings?.useCustomTabs ?: true,
usePrivateTabs = appSettings?.usePrivateTabs ?: false,
showCollapsedCommentContent = appSettings?.showCollapsedCommentContent ?: false,
showActionBarByDefault = appSettings?.showCommentActionBarByDefault ?: true,
showVotingArrowsInListView = appSettings?.showVotingArrowsInListView ?: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ fun CommunityActivity(
accountViewModel: AccountViewModel,
appSettingsViewModel: AppSettingsViewModel,
showVotingArrowsInListView: Boolean,
useCustomTabs: Boolean,
usePrivateTabs: Boolean,
) {
Log.d("jerboa", "got to community activity")

Expand Down Expand Up @@ -317,6 +319,8 @@ fun CommunityActivity(
enableDownVotes = siteViewModel.enableDownvotes(),
showAvatar = siteViewModel.showAvatar(),
showVotingArrowsInListView = showVotingArrowsInListView,
useCustomTabs = useCustomTabs,
usePrivateTabs = usePrivateTabs,
)
}
else -> {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ fun HomeActivity(
postEditViewModel: PostEditViewModel,
appSettingsViewModel: AppSettingsViewModel,
showVotingArrowsInListView: Boolean,
useCustomTabs: Boolean,
usePrivateTabs: Boolean,
) {
Log.d("jerboa", "got to home activity")

Expand Down Expand Up @@ -135,6 +137,8 @@ fun HomeActivity(
navController = navController,
postListState = postListState,
showVotingArrowsInListView = showVotingArrowsInListView,
useCustomTabs = useCustomTabs,
usePrivateTabs = usePrivateTabs,
)
},
floatingActionButtonPosition = FabPosition.End,
Expand Down Expand Up @@ -202,6 +206,8 @@ fun MainPostListingsContent(
postListState: LazyListState,
appSettingsViewModel: AppSettingsViewModel,
showVotingArrowsInListView: Boolean,
useCustomTabs: Boolean,
usePrivateTabs: Boolean,
) {
when (val siteRes = siteViewModel.siteRes) {
ApiState.Loading ->
Expand Down Expand Up @@ -358,6 +364,8 @@ fun MainPostListingsContent(
enableDownVotes = siteViewModel.enableDownvotes(),
showAvatar = siteViewModel.showAvatar(),
showVotingArrowsInListView = showVotingArrowsInListView,
useCustomTabs = useCustomTabs,
usePrivateTabs = usePrivateTabs,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ fun PersonProfileActivity(
postEditViewModel: PostEditViewModel,
appSettingsViewModel: AppSettingsViewModel,
showVotingArrowsInListView: Boolean,
useCustomTabs: Boolean,
usePrivateTabs: Boolean,
) {
Log.d("jerboa", "got to person activity")

Expand Down Expand Up @@ -172,6 +174,8 @@ fun PersonProfileActivity(
showVotingArrowsInListView = showVotingArrowsInListView,
enableDownVotes = siteViewModel.enableDownvotes(),
showAvatar = siteViewModel.showAvatar(),
useCustomTabs = useCustomTabs,
usePrivateTabs = usePrivateTabs,
)
},
bottomBar = {
Expand Down Expand Up @@ -228,6 +232,8 @@ fun UserTabs(
showVotingArrowsInListView: Boolean,
enableDownVotes: Boolean,
showAvatar: Boolean,
useCustomTabs: Boolean,
usePrivateTabs: Boolean,
) {
val tabTitles = if (savedMode) {
listOf(
Expand Down Expand Up @@ -471,6 +477,8 @@ fun UserTabs(
enableDownVotes = enableDownVotes,
showAvatar = showAvatar,
showVotingArrowsInListView = showVotingArrowsInListView,
useCustomTabs = useCustomTabs,
usePrivateTabs = usePrivateTabs,
)
}
}
Expand Down Expand Up @@ -498,15 +506,15 @@ fun UserTabs(
val unExpandedComments = remember { mutableStateListOf<Int>() }
val commentsWithToggledActionBar = remember { mutableStateListOf<Int>() }

var toggleExpanded = { commentId: Int ->
val toggleExpanded = { commentId: Int ->
if (unExpandedComments.contains(commentId)) {
unExpandedComments.remove(commentId)
} else {
unExpandedComments.add(commentId)
}
}

var toggleActionBar = { commentId: Int ->
val toggleActionBar = { commentId: Int ->
if (commentsWithToggledActionBar.contains(commentId)) {
commentsWithToggledActionBar.remove(commentId)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ import com.jerboa.ui.components.common.simpleVerticalScrollbar
import com.jerboa.ui.components.home.SiteViewModel
import com.jerboa.ui.components.post.edit.PostEditViewModel

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun CommentsHeaderTitle(
selectedSortType: CommentSortType,
Expand Down Expand Up @@ -117,6 +116,8 @@ fun PostActivity(
commentReplyViewModel: CommentReplyViewModel,
postEditViewModel: PostEditViewModel,
navController: NavController,
useCustomTabs: Boolean,
usePrivateTabs: Boolean,
showCollapsedCommentContent: Boolean,
showActionBarByDefault: Boolean,
showVotingArrowsInListView: Boolean,
Expand Down Expand Up @@ -367,6 +368,8 @@ fun PostActivity(
enableDownVotes = siteViewModel.enableDownvotes(),
showAvatar = siteViewModel.showAvatar(),
showVotingArrowsInListView = showVotingArrowsInListView,
useCustomTabs = useCustomTabs,
usePrivateTabs = usePrivateTabs,
)
}

Expand Down Expand Up @@ -394,15 +397,15 @@ fun PostActivity(
val commentParentId = getCommentParentId(firstComment)
val showContextButton = depth != null && depth > 0

var toggleExpanded = { commentId: Int ->
val toggleExpanded = { commentId: Int ->
if (unExpandedComments.contains(commentId)) {
unExpandedComments.remove(commentId)
} else {
unExpandedComments.add(commentId)
}
}

var toggleActionBar = { commentId: Int ->
val toggleActionBar = { commentId: Int ->
if (commentsWithToggledActionBar.contains(commentId)) {
commentsWithToggledActionBar.remove(commentId)
} else {
Expand Down
Loading