-
Notifications
You must be signed in to change notification settings - Fork 37
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
[Custom Fields] Store Json values #3102
Conversation
Having the list as part of WCMetaData itself hints that this is the list of supported keys for all kinds, but actually it was just for orders, so moving it to `StripOrderMetaData` makes following the code easier.
@@ -7,7 +7,7 @@ import javax.inject.Inject | |||
|
|||
class StripProductMetaData @Inject internal constructor() { | |||
operator fun invoke(metaData: List<WCMetaData>): List<WCMetaData> { | |||
return metaData.filter { !it.isJson || SUPPORTED_KEYS.contains(it.key) } | |||
return metaData.filter { it.isDisplayable || SUPPORTED_KEYS.contains(it.key) } |
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.
Another change of this is that we are not going to cache non displayable items, this is done in both platforms to avoid taking up the phone device for unused stuff.
val SUPPORTED_KEYS: Set<String> = buildSet { | ||
add(SubscriptionMetadataKeys.SUBSCRIPTION_RENEWAL) | ||
add(BundleMetadataKeys.BUNDLED_ITEM_ID) | ||
addAll(OrderAttributionInfoKeys.ALL_KEYS) | ||
} |
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.
I moved these to a better location below.
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.
Nice job @hichamboushaba changes look good and everything worked as expected in my test:
Closes woocommerce/woocommerce-android#12696
This PR adds logic to store the JSON custom fields, this is needed because we will allow merchants to see those values in read-only mode in the app.
Testing