-
Notifications
You must be signed in to change notification settings - Fork 135
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
[Products] Extract subscriptions outside of the Product DB table - Part 1 #12766
Merged
+820
−693
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d66f2b3
Add tests for the subscription date sync parsing
hichamboushaba 470a4c6
Fix parsing bug
hichamboushaba 874b636
Introduce ProductAggregate class
hichamboushaba d202337
First pass at updating product detail screen to use ProductAggregate
hichamboushaba 4bef253
Few fixes to ensure the logic is still the same
hichamboushaba 9fa672a
Introduce an overload to the subscription details mapper
hichamboushaba a830f55
Update logic to fetch and use ProductAggregate
hichamboushaba 0335cf2
Add logic for creating the default product aggregate
hichamboushaba 5b51374
Remove the subscription property of the Product model
hichamboushaba b210d2b
Bump fluxc
hichamboushaba 34cb39a
Fix unit tests
hichamboushaba e537a29
Fix detekt
hichamboushaba d5c3475
Fix unit tests
hichamboushaba 185a1ad
Simplify expression
hichamboushaba 69c43df
Merge branch 'trunk' into issue/12752-subscriptions-meta-1
hichamboushaba 57e9381
Bump fluxc
hichamboushaba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
WooCommerce/src/main/kotlin/com/woocommerce/android/model/ProductAggregate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.woocommerce.android.model | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
/** | ||
* Container class for product and any additional details that are stored as product metadata. | ||
* | ||
* For now, the additional details include subscription details only. | ||
* | ||
* @param product The product. | ||
* @param subscription The subscription details. | ||
*/ | ||
@Parcelize | ||
data class ProductAggregate( | ||
val product: Product, | ||
val subscription: SubscriptionDetails? = null | ||
) : Parcelable { | ||
val remoteId: Long | ||
get() = product.remoteId | ||
|
||
val hasShipping: Boolean | ||
get() = product.hasShipping || subscription?.oneTimeShipping == true | ||
|
||
fun isSame(other: ProductAggregate): Boolean { | ||
return product.isSameProduct(other.product) && subscription == other.subscription | ||
} | ||
|
||
fun merge(other: ProductAggregate): ProductAggregate { | ||
return copy( | ||
product = product.mergeProduct(other.product), | ||
subscription = other.subscription | ||
) | ||
} | ||
} |
124 changes: 60 additions & 64 deletions
124
WooCommerce/src/main/kotlin/com/woocommerce/android/model/SubscriptionDetailsMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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've noticed a bug around this. But i could confirm is not related to the changes from this PR so I created a GH issue to address it.