Skip to content

Commit

Permalink
Change result reporting
Browse files Browse the repository at this point in the history
Reviewed By: steelrooter

Differential Revision: D58056581

fbshipit-source-id: 517313ccff2de8f2e9a74c3a594c3d6627e3da87
  • Loading branch information
Artem Kholodnyi authored and facebook-github-bot committed Jun 3, 2024
1 parent a3960d1 commit f1df7b8
Showing 1 changed file with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,24 @@ package com.facebook.fresco.urimod
import android.net.Uri
import com.facebook.drawee.drawable.ScalingUtils.ScaleType

const val NOT_MODIFIED_DISABLED: String = "Smart fetch is disabled"

interface UriModifierInterface {

fun modifyUri(uri: Uri, viewport: Dimensions?, scaleType: ScaleType?): ModificationResult

sealed class ModificationResult {
object Disabled : ModificationResult() {
override fun toString(): String {
return "Disabled"
}
}
/** This is used for IMAGE_LOAD_PERF logging. */
sealed class ModificationResult(private val comment: String) {
override fun toString(): String = comment

data class Modified(val newUri: Uri) : ModificationResult() {
override fun toString(): String {
return "Modified"
}
}
object Disabled : ModificationResult("Disabled")

data class Unmodified(val reason: String) : ModificationResult() {
override fun toString(): String {
return "Unmodified(reason='$reason')"
}
sealed class Modified(val newUri: Uri, comment: String) : ModificationResult(comment) {
class ModifiedToAllowlistedSize(newUrl: Uri) : Modified(newUrl, "ModifiedToAllowlistedSize")

class ModifiedToMaxDimens(newUrl: Uri) : Modified(newUrl, "ModifiedToMaxDimens")
}

object FallbackToOriginalUrl : ModificationResult("FallbackToOriginalUrl")

data class Unmodified(val reason: String) : ModificationResult("Unmodified(reason='$reason'")
}
}

0 comments on commit f1df7b8

Please sign in to comment.