Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
planarvoid committed Dec 10, 2024
1 parent 726dd24 commit 71f2112
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import org.wordpress.aztec.AztecAttributes
interface ComposePlaceholderAdapter : PlaceholderManager.PlaceholderAdapter {
/**
* Use this method to draw the placeholder using Jetpack Compose.
* @param placeholderUuid the placeholder UUID
* @param attrs aztec attributes of the view
*/
@Composable
fun Placeholder(
placeholderUuid: String,
attrs: AztecAttributes,
) {}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import org.wordpress.aztec.AztecContentChangeWatcher
import org.wordpress.aztec.AztecText
import org.wordpress.aztec.Constants
import org.wordpress.aztec.Html
import org.wordpress.aztec.placeholders.PlaceholderManager.*
import org.wordpress.aztec.placeholders.PlaceholderManager.Companion.DEFAULT_HTML_TAG
import org.wordpress.aztec.placeholders.PlaceholderManager.Companion.EDITOR_INNER_PADDING
import org.wordpress.aztec.placeholders.PlaceholderManager.Companion.TYPE_ATTRIBUTE
Expand Down Expand Up @@ -60,7 +59,7 @@ class ViewPlaceholderManager(
IHtmlPreprocessor {
private val adapters = mutableMapOf<String, ViewPlaceholderAdapter>()
private val positionToIdMutex = Mutex()
private val positionToId = mutableSetOf<Placeholder>()
private val positionToId = mutableSetOf<PlaceholderManager.Placeholder>()
private val job = Job()
override val coroutineContext: CoroutineContext
get() = Dispatchers.Main + job
Expand Down Expand Up @@ -97,7 +96,7 @@ class ViewPlaceholderManager(
* @param type placeholder type
* @param attributes other attributes passed to the view. For example a `src` for an image.
*/
override suspend fun insertItem(type: String, vararg attributes: Pair<String, String>) {
suspend override fun insertItem(type: String, vararg attributes: Pair<String, String>) {
val adapter = adapters[type]
?: throw IllegalArgumentException("Adapter for inserted type not found. Register it with `registerAdapter` method")
val attrs = getAttributesForMedia(type, attributes)
Expand All @@ -114,7 +113,7 @@ class ViewPlaceholderManager(
* @param shouldMergeItem this method should return true when the previous type is compatible and should be updated
* @param updateItem function to update current parameters with new params
*/
override suspend fun insertOrUpdateItem(
suspend override fun insertOrUpdateItem(
type: String,
shouldMergeItem: (currentItemType: String) -> Boolean,
updateItem: (
Expand Down Expand Up @@ -187,7 +186,7 @@ class ViewPlaceholderManager(
* @param shouldUpdateItem This function should return true if the span can be updated, false if it should be removed
* @param updateItem Function that updates the selected item
*/
override suspend fun removeOrUpdate(uuid: String, shouldUpdateItem: (Attributes) -> Boolean, updateItem: (currentAttributes: Map<String, String>) -> Map<String, String>): Boolean {
suspend override fun removeOrUpdate(uuid: String, shouldUpdateItem: (Attributes) -> Boolean, updateItem: (currentAttributes: Map<String, String>) -> Map<String, String>): Boolean {
val currentItem = aztecText.editableText.getSpans(0, aztecText.length(), AztecPlaceholderSpan::class.java).find {
it.attributes.getValue(UUID_ATTRIBUTE) == uuid
} ?: return false
Expand Down Expand Up @@ -370,7 +369,7 @@ class ViewPlaceholderManager(
}

positionToIdMutex.withLock {
positionToId.add(Placeholder(targetPosition, uuid))
positionToId.add(PlaceholderManager.Placeholder(targetPosition, uuid))
}
if (box.parent == null) {
container.addView(box)
Expand Down

0 comments on commit 71f2112

Please sign in to comment.