Don't use dependency injection for HtmlSanitizer
This commit is contained in:
parent
013e0dc788
commit
7c05ec5b21
4 changed files with 6 additions and 9 deletions
|
@ -2,10 +2,9 @@ package com.fsck.k9.message.html
|
|||
|
||||
import org.jsoup.nodes.Document
|
||||
|
||||
class HtmlProcessor internal constructor(
|
||||
private val htmlSanitizer: HtmlSanitizer,
|
||||
private val displayHtml: DisplayHtml
|
||||
) {
|
||||
class HtmlProcessor internal constructor(private val displayHtml: DisplayHtml) {
|
||||
private val htmlSanitizer = HtmlSanitizer()
|
||||
|
||||
fun processForDisplay(html: String?): String {
|
||||
return htmlSanitizer.sanitize(html)
|
||||
.addCustomHeadContents()
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package com.fsck.k9.message.html
|
||||
|
||||
class HtmlProcessorFactory(
|
||||
private val htmlSanitizer: HtmlSanitizer,
|
||||
private val displayHtmlFactory: DisplayHtmlFactory
|
||||
) {
|
||||
fun create(settings: HtmlSettings): HtmlProcessor {
|
||||
val displayHtml = displayHtmlFactory.create(settings)
|
||||
return HtmlProcessor(htmlSanitizer, displayHtml)
|
||||
return HtmlProcessor(displayHtml)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.message.html
|
|||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Document
|
||||
|
||||
class HtmlSanitizer {
|
||||
internal class HtmlSanitizer {
|
||||
private val headCleaner = HeadCleaner()
|
||||
private val bodyCleaner = BodyCleaner()
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.fsck.k9.message.html
|
|||
import org.koin.dsl.module
|
||||
|
||||
val htmlModule = module {
|
||||
single { HtmlProcessorFactory(get(), get()) }
|
||||
single { HtmlSanitizer() }
|
||||
single { HtmlProcessorFactory(displayHtmlFactory = get()) }
|
||||
single { DisplayHtmlFactory() }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue