Add advanced parser annotation

This commit is contained in:
David Langley 2021-12-16 13:13:40 +00:00
parent a3a8a5b0b5
commit bc6ca2449e
2 changed files with 11 additions and 2 deletions

View File

@ -108,6 +108,13 @@ import javax.inject.Qualifier
@Retention(AnnotationRetention.RUNTIME)
internal annotation class SimpleCommonmarkParser
/**
* Used to inject the advanced commonmark Parser
*/
@Qualifier
@Retention(AnnotationRetention.RUNTIME)
internal annotation class AdvancedCommonmarkParser
@Module
internal abstract class RoomModule {
@ -128,8 +135,9 @@ internal abstract class RoomModule {
}
@Provides
@AdvancedCommonmarkParser
@JvmStatic
fun providesParser(): Parser {
fun providesAdvancedParser(): Parser {
return Parser.builder().build()
}

View File

@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.session.room.send
import org.commonmark.parser.Parser
import org.commonmark.renderer.html.HtmlRenderer
import org.matrix.android.sdk.internal.session.room.AdvancedCommonmarkParser
import org.matrix.android.sdk.internal.session.room.SimpleCommonmarkParser
import org.matrix.android.sdk.internal.session.room.send.pills.TextPillsUtils
import javax.inject.Inject
@ -28,7 +29,7 @@ import javax.inject.Inject
* If any change is required, please add a test covering the problem and make sure all the tests are still passing.
*/
internal class MarkdownParser @Inject constructor(
private val advancedParser: Parser,
@AdvancedCommonmarkParser private val advancedParser: Parser,
@SimpleCommonmarkParser private val simpleParser: Parser,
private val htmlRenderer: HtmlRenderer,
private val textPillsUtils: TextPillsUtils