Skip to content

Commit

Permalink
Reformat VideoBlockProcessor after conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
irfano committed Jun 11, 2024
1 parent e639e66 commit 4d4abeb
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,28 @@ import com.google.gson.JsonObject
import org.jsoup.nodes.Document
import org.wordpress.android.util.helpers.MediaFile

class VideoBlockProcessor(localId: String, mediaFile: MediaFile) :
BlockProcessor(localId, mediaFile) {
class VideoBlockProcessor(localId: String, mediaFile: MediaFile) : BlockProcessor(localId, mediaFile) {
override fun processBlockContentDocument(document: Document): Boolean {
// select video element with our local id
val targetVideo = document.select("video").first()

// if a match is found for video, proceed with replacement
if (targetVideo != null) {
return targetVideo?.let {
// replace attribute
targetVideo.attr("src", remoteUrl)

// return injected block
return true
}

return false
true
} ?: false
}

override fun processBlockJsonAttributes(jsonAttributes: JsonObject): Boolean {
val id = jsonAttributes["id"]
if (id != null && !id.isJsonNull && id.asString == localId) {
return if (id != null && !id.isJsonNull && id.asString == localId) {
addIntPropertySafely(jsonAttributes, "id", remoteId)
return true
true
} else {
false
}
return false
}
}

0 comments on commit 4d4abeb

Please sign in to comment.