fix(android): make getUri and isResource available for override (#46152)

Summary:
Fixes following issues:
- https://github.com/facebook/react-native/issues/46150
- https://github.com/facebook/react-native/issues/46155

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[ANDROID] [FIXED] - Make getUri and isResource open

Pull Request resolved: https://github.com/facebook/react-native/pull/46152

Reviewed By: NickGerleman, rshest, blakef

Differential Revision: D61845164

Pulled By: cortinico

fbshipit-source-id: 88ccdad92423b5add9b2fad4c98f296b6cbfb27d
This commit is contained in:
shubhamguptadream11
2024-08-27 05:00:36 -07:00
committed by Facebook GitHub Bot
parent b10ed0e19d
commit 8c81ffa60a
2 changed files with 8 additions and 6 deletions
@@ -6720,9 +6720,9 @@ public class com/facebook/react/views/imagehelper/ImageSource {
public final fun getSize ()D
public final fun getSource ()Ljava/lang/String;
public static final fun getTransparentBitmapImageSource (Landroid/content/Context;)Lcom/facebook/react/views/imagehelper/ImageSource;
public final fun getUri ()Landroid/net/Uri;
public fun getUri ()Landroid/net/Uri;
public fun hashCode ()I
public final fun isResource ()Z
public fun isResource ()Z
}
public final class com/facebook/react/views/imagehelper/ImageSource$Companion {
@@ -23,12 +23,14 @@ constructor(
) {
/** Get the URI for this image - can be either a parsed network URI or a resource URI. */
public val uri: Uri = computeUri(context)
public open val uri: Uri = computeUri(context)
/** Get the area of this image. */
public val size: Double = width * height
/** Get whether this image source represents an Android resource or a network URI. */
public var isResource: Boolean = false
private set
public open val isResource: Boolean
get() = _isResource
private var _isResource: Boolean = false
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -58,7 +60,7 @@ constructor(
}
private fun computeLocalUri(context: Context): Uri {
isResource = true
_isResource = true
return ResourceDrawableIdHelper.instance.getResourceDrawableUri(context, source)
}