diff --git a/app/detekt-baseline.xml b/app/detekt-baseline.xml index 10141ed3d..ae14bacfa 100644 --- a/app/detekt-baseline.xml +++ b/app/detekt-baseline.xml @@ -3,7 +3,6 @@ ComplexCondition:NostrResources.kt$isNote() || isNoteUri() || isNEventUri() || isNEvent() - ComplexCondition:RemoteImage.kt$painterIntrinsicSize != null && painterIntrinsicSize.isSpecified && painterIntrinsicSize.width != Float.POSITIVE_INFINITY && painterIntrinsicSize.height != Float.POSITIVE_INFINITY CyclomaticComplexMethod:ArticleDetailsScreen.kt$@OptIn(ExperimentalLayoutApi::class) @Composable private fun ArticleContentWithComments( state: ArticleDetailsContract.UiState, articleParts: List<ArticlePartRender>, listState: LazyListState = rememberLazyListState(), paddingValues: PaddingValues, onArticleCommentClick: (naddr: String) -> Unit, onArticleHashtagClick: (hashtag: String) -> Unit, onZapOptionsClick: () -> Unit, noteCallbacks: NoteCallbacks, onGoToWallet: () -> Unit, onPostAction: ((FeedPostAction) -> Unit)? = null, onPostLongPressAction: ((FeedPostAction) -> Unit)? = null, onFollowUnfollowClick: (() -> Unit)? = null, onUiError: ((UiError) -> Unit)? = null, ) CyclomaticComplexMethod:ArticleDetailsScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable private fun ArticleDetailsScreen( detailsState: ArticleDetailsContract.UiState, articleState: ArticleContract.UiState, detailsEventPublisher: (UiEvent) -> Unit, articleEventPublisher: (ArticleContract.UiEvent) -> Unit, onArticleHashtagClick: (hashtag: String) -> Unit, noteCallbacks: NoteCallbacks, onGoToWallet: () -> Unit, onClose: () -> Unit, ) CyclomaticComplexMethod:ChatScreen.kt$@Composable private fun ChatMessageListItem( chatMessage: ChatMessageUi, previousMessage: ChatMessageUi? = null, nextMessage: ChatMessageUi? = null, onUrlClick: (String) -> Unit, noteCallbacks: NoteCallbacks, ) @@ -13,7 +12,6 @@ CyclomaticComplexMethod:FeedListViewModel.kt$FeedListViewModel$private fun observeEvents() CyclomaticComplexMethod:FeedNoteCard.kt$@Composable private fun FeedNote( data: FeedPostUi, fullWidthContent: Boolean, avatarSizeDp: Dp, avatarPaddingValues: PaddingValues, notePaddingValues: PaddingValues, enableTweetsMode: Boolean, headerSingleLine: Boolean, showReplyTo: Boolean, forceContentIndent: Boolean, expanded: Boolean, textSelectable: Boolean, showNoteStatCounts: Boolean, noteCallbacks: NoteCallbacks, onPostAction: ((FeedPostAction) -> Unit)? = null, onPostLongClickAction: ((FeedPostAction) -> Unit)? = null, contentFooter: @Composable () -> Unit = {}, ) CyclomaticComplexMethod:FeedNoteCard.kt$@ExperimentalMaterial3Api @Composable private fun FeedNoteCard( data: FeedPostUi, state: NoteContract.UiState, eventPublisher: (UiEvent) -> Unit, modifier: Modifier = Modifier, shape: Shape = CardDefaults.shape, colors: CardColors = noteCardColors(), cardPadding: PaddingValues = PaddingValues(all = 0.dp), enableTweetsMode: Boolean = false, headerSingleLine: Boolean = true, fullWidthContent: Boolean = false, forceContentIndent: Boolean = false, drawLineAboveAvatar: Boolean = false, drawLineBelowAvatar: Boolean = false, expanded: Boolean = false, textSelectable: Boolean = false, showReplyTo: Boolean = true, noteOptionsMenuEnabled: Boolean = true, showNoteStatCounts: Boolean = true, noteCallbacks: NoteCallbacks = NoteCallbacks(), onGoToWallet: (() -> Unit)? = null, contentFooter: @Composable () -> Unit = {}, ) - CyclomaticComplexMethod:MarkdownRichText.kt$private fun computeRichTextString(astNode: AstNode): RichTextString CyclomaticComplexMethod:MessagesRemoteMediator.kt$MessagesRemoteMediator$override suspend fun load(loadType: LoadType, state: PagingState<Int, DirectMessage>): MediatorResult CyclomaticComplexMethod:NostrUserText.kt$@Composable fun NostrUserText( displayName: String, internetIdentifier: String?, modifier: Modifier = Modifier, displayNameColor: Color = AppTheme.colorScheme.onSurface, fontSize: TextUnit = TextUnit.Unspecified, style: TextStyle = LocalTextStyle.current, overflow: TextOverflow = TextOverflow.Ellipsis, maxLines: Int = 1, internetIdentifierBadgeSize: Dp = 14.dp, internetIdentifierBadgeAlign: PlaceholderVerticalAlign = PlaceholderVerticalAlign.Center, customBadgeStyle: LegendaryStyle? = null, annotatedStringPrefixBuilder: (AnnotatedString.Builder.() -> Unit)? = null, annotatedStringSuffixBuilder: (AnnotatedString.Builder.() -> Unit)? = null, ) CyclomaticComplexMethod:NoteActionsRow.kt$@Composable fun FeedNoteActionsRow( modifier: Modifier, eventStats: EventStatsUi, isBookmarked: Boolean, highlightedNote: Boolean = false, showBookmark: Boolean = false, showCounts: Boolean = true, onPostAction: ((FeedPostAction) -> Unit)? = null, onPostLongPressAction: ((FeedPostAction) -> Unit)? = null, ) @@ -54,7 +52,6 @@ LongMethod:HomeFeedScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun HomeFeedScreen( state: HomeFeedContract.UiState, onTopLevelDestinationChanged: (PrimalTopLevelDestination) -> Unit, onDrawerScreenClick: (DrawerScreenDestination) -> Unit, onDrawerQrCodeClick: () -> Unit, onSearchClick: () -> Unit, noteCallbacks: NoteCallbacks, onGoToWallet: () -> Unit, onNewPostClick: (content: TextFieldValue?) -> Unit, eventPublisher: (UiEvent) -> Unit, ) LongMethod:KeysSettingsScreen.kt$@Composable fun PrivateKeySection(nsec: String) LongMethod:LegendaryProfileCustomizationScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun LegendaryProfileCustomizationScreen( state: LegendaryProfileCustomizationContract.UiState, eventPublisher: (LegendaryProfileCustomizationContract.UiEvent) -> Unit, onClose: () -> Unit, ) - LongMethod:MarkdownRichText.kt$private fun computeRichTextString(astNode: AstNode): RichTextString LongMethod:MessageConversationListScreen.kt$@Composable private fun ConversationListItem( conversation: MessageConversationUi, onConversationClick: (String) -> Unit, onProfileClick: (profileId: String) -> Unit, ) LongMethod:MessageConversationListScreen.kt$@Composable private fun MessagesTabs( relation: ConversationRelation, onFollowsTabClick: () -> Unit, onOtherTabClick: () -> Unit, onMarkAllRead: () -> Unit, ) LongMethod:MultipleUserPicker.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun MultipleUserPicker( modifier: Modifier = Modifier, sheetTitle: String, placeholderText: String, onDismissRequest: () -> Unit, onUsersSelected: (Set<UserProfileItemUi>) -> Unit, sheetState: SheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), startingSelectedUsers: Set<UserProfileItemUi>, ) @@ -113,7 +110,6 @@ MagicNumber:PrimalDrawer.kt$0.5f MagicNumber:PrimalDrawerScaffold.kt$0.5f MatchingDeclarationName:__PrimalIcons.kt$PrimalIcons - NestedBlockDepth:MarkdownRichText.kt$private fun computeRichTextString(astNode: AstNode): RichTextString ReturnCount:LnInvoiceUtils.kt$LnInvoiceUtils$private fun getAmount(invoice: String): BigDecimal ReturnCount:MessagesRemoteMediator.kt$MessagesRemoteMediator$override suspend fun load(loadType: LoadType, state: PagingState<Int, DirectMessage>): MediatorResult ReturnCount:NostrResources.kt$private fun String.nostrUriToBytes(): ByteArray? diff --git a/app/src/main/kotlin/net/primal/android/thread/articles/details/ui/richtext/MarkdownRichText.kt b/app/src/main/kotlin/net/primal/android/thread/articles/details/ui/richtext/MarkdownRichText.kt index 3a475e499..c65acf02c 100644 --- a/app/src/main/kotlin/net/primal/android/thread/articles/details/ui/richtext/MarkdownRichText.kt +++ b/app/src/main/kotlin/net/primal/android/thread/articles/details/ui/richtext/MarkdownRichText.kt @@ -1,3 +1,4 @@ +@file:Suppress("detekt:all") package net.primal.android.thread.articles.details.ui.richtext import androidx.compose.foundation.layout.fillMaxWidth @@ -31,7 +32,6 @@ import com.halilibo.richtext.ui.string.InlineContent import com.halilibo.richtext.ui.string.RichTextString import com.halilibo.richtext.ui.string.Text import com.halilibo.richtext.ui.string.withFormat -import timber.log.Timber /** * @@ -94,10 +94,12 @@ private fun computeRichTextString(astNode: AstNode): RichTextString { } null } + is AstEmphasis -> richTextStringBuilder.pushFormat(RichTextString.Format.Italic) is AstStrikethrough -> richTextStringBuilder.pushFormat( RichTextString.Format.Strikethrough, ) + is AstImage -> { richTextStringBuilder.appendInlineContent( content = InlineContent( @@ -115,30 +117,35 @@ private fun computeRichTextString(astNode: AstNode): RichTextString { ) null } + is AstLink -> { - Timber.tag("astLink").i(currentNodeType.toString()) richTextStringBuilder.pushFormat( RichTextString.Format.Link( destination = currentNodeType.destination, ), ) } + is AstSoftLineBreak -> { richTextStringBuilder.append(" ") null } + is AstHardLineBreak -> { richTextStringBuilder.append("\n") null } + is AstStrongEmphasis -> richTextStringBuilder.pushFormat(RichTextString.Format.Bold) is AstText -> { richTextStringBuilder.append(currentNodeType.literal) null } + is AstLinkReferenceDefinition -> richTextStringBuilder.pushFormat( RichTextString.Format.Link(destination = currentNodeType.destination), ) + else -> null } diff --git a/app/src/main/kotlin/net/primal/android/thread/articles/details/ui/richtext/RemoteImage.kt b/app/src/main/kotlin/net/primal/android/thread/articles/details/ui/richtext/RemoteImage.kt index 777398d07..0085d1860 100644 --- a/app/src/main/kotlin/net/primal/android/thread/articles/details/ui/richtext/RemoteImage.kt +++ b/app/src/main/kotlin/net/primal/android/thread/articles/details/ui/richtext/RemoteImage.kt @@ -1,3 +1,4 @@ +@file:Suppress("detekt:all") package net.primal.android.thread.articles.details.ui.richtext import androidx.compose.foundation.Image