-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RNMobile] Add metadata property to MediaInfo
#48994
Conversation
75d9a7e
to
788daa0
Compare
): Media { | ||
val type = convertToType(mimeType) | ||
return Media(id, url, type, caption ?: "", title ?: "") | ||
return Media(id, url, type, caption ?: "", title ?: "", alt ?: "", metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can replace this function because it was only used in the demo app and it has been updated in this PR. The function above is the one used in the Android app but remains unmodified.
case id, url, type, title, caption, alt, metadata | ||
} | ||
|
||
public init(id: Int32?, url: String?, type: String?, caption: String? = nil, title: String? = nil, alt: String? = nil, metadata: Encodable? = nil) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change shouldn't impact the iOS app as we set a default value for the new parameter metadata
.
@@ -15,7 +15,8 @@ data class Media( | |||
override val type: String, | |||
override val caption: String = "", | |||
override val title: String = "", | |||
override val alt: String = "" | |||
override val alt: String = "", | |||
override val metadata: WritableMap = WritableNativeMap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change shouldn't impact the Android app as we set a default value for the new parameter metadata
.
788daa0
to
bcf173d
Compare
WritableNativeMap metadata = new WritableNativeMap(); | ||
metadata.putString("extraID", "AbCdE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This metadata is used for testing purposes only.
@@ -97,7 +97,8 @@ extension GutenbergViewController: GutenbergBridgeDelegate { | |||
callback([MediaInfo(id: 2, url: "https://i.cloudup.com/YtZFJbuQCE.mov", type: "video"), | |||
MediaInfo(id: 4, url: "https://i.cloudup.com/YtZFJbuQCE.mov", type: "video")]) | |||
} else { | |||
callback([MediaInfo(id: 2, url: "https://i.cloudup.com/YtZFJbuQCE.mov", type: "video", caption: "Cloudup")]) | |||
let metadata = ["extraID": "AbCdE"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This metadata is used for testing purposes only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What?
Add metadata property to
MediaInfo
class.Why?
This new parameter will allow the editor's host to pass extra parameters of media items to blocks.
How?
Added the parameter on native files of the editor. The new parameter shouldn't impact the apps as a default value is defined.
Testing Instructions
{"metadata": {"extraID": "AbCdE"}}
.Testing Instructions for Keyboard
N/A
Screenshots or screencast
N/A