Skip to content
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

[VIO-104] feat: Implement IAP (part 2) #1070

Merged
merged 14 commits into from
Jan 16, 2024
Merged

[VIO-104] feat: Implement IAP (part 2) #1070

merged 14 commits into from
Jan 16, 2024

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented Dec 13, 2023

This PR:

  • Adds cozy's base domain to Android IAP requests si the Cloudery can differentiate between dev and prod environments
  • Implements loading and error pages that are displayed during IAP process so the user knows that something is happening
  • Implements restart push notifications

}
}
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use the cozy-stack API to send the notification? I don't know if it's a good thing to directly call fcm.

log.debug('Received notification from onMessage event')

if (!notification.notification?.title || !notification.notification.body) {
log.error('Received a notification without title or body. Skip.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log.error will go to sentry no ? Is it really needed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This case should never happen, and if this happens I suppose we should warn the dev team using Sentry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you think that one day it will ? Like tomorrow product team may decide that we want a notification with just a title ? And then every user who do not update will trigger the log.

@Ldoppea Ldoppea changed the title feat: Implement IAP (part 2) [VIO-104] feat: Implement IAP (part 2) Dec 27, 2023
flex: 1,
backgroundColor: colors.primaryColor
},
headerTextStyle: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why we don't use our Typography component instead

When Android IAP is processed by the Cloudery, the Cozy's base domain
is required to differentiate between test and production environments
This package is needed by the following commits to handle restart push
notifications

We target version `0.0.24` to ensure compatibility with
react-native `0.66`
When the IAP is received by the Cloudery, it should change the Cozy's
plan and then send a push notification to the user's apps

This notification's goal is to tell the user that the Cozy's migration
has been done, but also to restart the app when the user is ready to do
it

The app restart is required so we are sure all new plan related flags
are applied
Google allows to get multiple subscription at the same time, so when
the user upgrade or downgrade their offer, then we need to revoke the
old one. To allow this we need to provide the `purchaseToken` to the
request. This info is provided by the Cloudery using the
`purchaseToken` query string

Then we also need to specify how proration is calculated, the app does
not make this choice, instead the Cloudery provide the info through the
`prorationMode` query string
The stores require us to display localized prices and descriptions to
the user when displaying IAP options

So we want to provide them to the Cloudery using the `iap_offers` query
parameter
When `isFlagship=true` is given to the OAuthClientsLimit route, then
cozy-stacks will open links as new windows

This was a requested feature to ease detection of cozy-app opening
requests

To handle this new behaviour we have to copy the interception code from
`interceptNavigation` into `interceptOpenWindow`
We want to reduce noise in console logs and FlagshipUI changes are not
so useful when not debuging this specific feature
@Ldoppea Ldoppea merged commit 43970bf into master Jan 16, 2024
1 check passed
@Ldoppea Ldoppea deleted the feat/iap_part2 branch January 16, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants