-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Handle planId
parameter in startIap
url, pass language code to Cloudery and improve IAP
#1131
Conversation
0cd2de4
to
8a31cdf
Compare
b154201
to
c1cd2a4
Compare
In previous implementation the cloudery did pass only a `productId` parameter that would contain a `planId` on Android platform With the new implementation, the cloudery passes the `planId` in a new parameter in addition to the `productId` that now always contains the real `productId` on both platforms This simplifies the `getSubscriptionOffers` method that does not require a nested map anymore in order to retrieve the missing `productId`
The stores require us to display localized prices and descriptions to the user when displaying IAP options Our understanding is that descriptions and prices should displayed using the phone's language (vs the cozy's language) So we want to provide the phone's language code to the Cloudery using the `lang` query parameter
c1cd2a4
to
828ac6d
Compare
@@ -116,9 +117,12 @@ export const useClouderyOffer = (): ClouderyOfferState => { | |||
setPopupUrl(null) | |||
} else { | |||
const offersParam = formatOffers(subscriptions) | |||
const lang = getLocales()[0].languageCode |
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 have getDeviceLanguage
that does the same job in our wrapper src/locales/i18n.ts
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.
Yep but it is not exported, so after talking with @acezard we chose to directly call getLocales()
here instead of exporting the other method.
await getSubscriptions({ skus: SKUS }) | ||
setPartialPopupUrl(current => current ?? href) | ||
} catch (error: unknown) { | ||
const errorMessage = getErrorMessage(error) |
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.
:o I finally understood the purpose of getErrorMessage
. I will use it in backup feature...
This is the last PR for IAP before merging everything
feat: Handle planId parameter in startIap url
In previous implementation the cloudery did pass only a
productId
parameter that would contain a
planId
on Android platformWith the new implementation, the cloudery passes the
planId
in a newparameter in addition to the
productId
that now always contains thereal
productId
on both platformsThis simplifies the
getSubscriptionOffers
method that does notrequire a nested map anymore in order to retrieve the missing
productId
feat: Add device's language code to Cloudery url when displaying offers
The stores require us to display localized prices and descriptions to
the user when displaying IAP options
Our understanding is that descriptions and prices should displayed
using the phone's language (vs the cozy's language)
So we want to provide the phone's language code to the Cloudery using
the
lang
query parameter