-
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
[Woo] Extract subscriptions outside of WCProductModel table #3106
Conversation
171b7c1
to
f30d1b6
Compare
data class MetadataChanges( | ||
val insertedMetadata: List<WCMetaData> = emptyList(), | ||
val updatedMetadata: List<WCMetaData> = emptyList(), | ||
val deletedMetadataIds: List<Long> = emptyList(), | ||
) { |
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 extracted this bit to a separate class, this class can now be used in other places when needed (now it's used in WCProductStore, but can be used for orders as well), while the UpdateMetadataRequest
will still be used for the MetadataStore operations.
My goal of extracting this is to not have to deal with unneeded information for the other usages (I mean parentItemId
and parentItemType
).
ce95ccf
to
5dd2a27
Compare
operator fun invoke(value: String?): WCMetaDataValue { | ||
if (value == null) return StringValue(null) | ||
|
||
return runCatching { JsonParser().parse(value) } | ||
.getOrElse { JsonPrimitive(value) } | ||
.let { fromJsonElement(it) } | ||
} | ||
operator fun invoke(value: Number): WCMetaDataValue = NumberValue(value) | ||
operator fun invoke(value: Boolean): WCMetaDataValue = BooleanValue(value) |
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.
Just a nicer way to instantiate the values instead of the fromRawString
version.
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.
Well done LGTM!
|
||
204 -> migrateAddOn(ADDON_WOOCOMMERCE, version) { | ||
// Drop the column METADATA from WCProductModel | ||
// Since SQLite version varies accross devices, we can't rely on the support of DROP COLUMN, |
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.
Well spotted as most Android versions won't support alter table -> drop column operation. It seems this was added in SQLite 3.35.0
and it was in Android API 34 when SQLite was updated to a version > 3.35.0
Super minor np, typo in across
word
This PR has two main changes:
METADATA
column from theWCProductModel
table.Testing
Testing steps are provided in woocommerce/woocommerce-android#12766 and woocommerce/woocommerce-android#12767