-
Notifications
You must be signed in to change notification settings - Fork 179
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
Add back IntroductoryPrice.introPricePeriodUnit string #319
Conversation
This pull request has been linked to Shortcut Story #13246: [Flutter] Release 3.9.4 bringing string version of priceIntroductoryPrice.periodUnit. |
f82cf44
to
4523fd3
Compare
@@ -19,6 +15,8 @@ enum PeriodUnit { | |||
|
|||
/// Contains all the introductory information associated with a [Product] | |||
class IntroductoryPrice with _$IntroductoryPrice { | |||
const IntroductoryPrice._(); |
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.
needed to add this to enable the custom getter of the PeriodUnit type. see https://github.com/rrousselGit/freezed#custom-getters-and-methods
@@ -127,6 +132,21 @@ class _UpsellScreenState extends State<UpsellScreen> { | |||
), | |||
); | |||
} | |||
|
|||
void apiTestIntroductoryPrice(IntroductoryPrice introPrice) { |
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 had this here so i could test with a real API response, but maybe it makes more sense for this to be in the unit tests?
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 ran the API tester method added here on 3.8.0 and noticed that there was also a name change on the introPrice properties. the properties themselves were prefixed with "introPrice" (i.e. introPriceNumberOfPeriodUnits became numberOfPeriodUnits, see attached screenshot for the names in 3.8.0). i didn't see any callout in our releases since 3.8.0 for this change, though perhaps it was encompassed in some of the downstream changes. i'll do more follow-up on monday, but figured i'd post here in case someone has a quick answer...
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 think we need to add all of them back since they are breaking changes right?
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.
yeah i think so. was just confirming i didn't somehow miss these changes somewhere, like in links in changelogs
4523fd3
to
001c012
Compare
@@ -127,6 +132,21 @@ class _UpsellScreenState extends State<UpsellScreen> { | |||
), | |||
); | |||
} | |||
|
|||
void apiTestIntroductoryPrice(IntroductoryPrice introPrice) { |
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 ran the API tester method added here on 3.8.0 and noticed that there was also a name change on the introPrice properties. the properties themselves were prefixed with "introPrice" (i.e. introPriceNumberOfPeriodUnits became numberOfPeriodUnits, see attached screenshot for the names in 3.8.0). i didn't see any callout in our releases since 3.8.0 for this change, though perhaps it was encompassed in some of the downstream changes. i'll do more follow-up on monday, but figured i'd post here in case someone has a quick answer...
/// String representation of unit for the billing period of the introductory | ||
/// price, can be DAY, WEEK, MONTH or YEAR. | ||
@Deprecated('Use periodUnit property of type PeriodUnit instead.') | ||
@JsonKey(name: 'periodUnit') String introPricePeriodUnit, |
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.
couldn't have two properties with same JsonKey, so i pulled the enum out
…ual to the new ones. update apitest method with deprecated props
f256086
to
5f269a3
Compare
5f269a3
to
2380c3e
Compare
@vegaro ready for re-review |
lib/models/introductory_price.dart
Outdated
|
||
/// Formatted introductory price of a subscription, including | ||
/// its currency sign, such as €3.99. | ||
/// @Deprecated('Use priceString instead.') |
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.
/// @Deprecated('Use priceString instead.') | |
@Deprecated('Use priceString instead.') |
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.
good catch
In https://github.com/RevenueCat/purchases-flutter/pull/270/files#diff-31ad10b1074cdc6e6c82c3cc2ab3221a117afbaaee017193b6b189d7f34bc769R40 we changed periodUnit from a string to a PeriodUnit enum. An issue was opened indicating we released this change without reflecting it in the changelog and did a minor instead of a major.
This fix adds back the string type and deprecates it. We can leave the PeriodUnit enum type since the properties have different names.
Also:
We will release a 3.9.4 with this fix.
[sc-13246]