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

CustomerInfoManager: don't cache offline CustomerInfo #2378

Merged

Conversation

NachoSoto
Copy link
Contributor

@NachoSoto NachoSoto commented Mar 24, 2023

This is meant to be a temporary CustomerInfo while the backend is offline.
See also #2368.

@NachoSoto NachoSoto requested a review from a team March 24, 2023 21:02
@NachoSoto NachoSoto force-pushed the nacho/sdk-3029-change-offline-customerinfo-verification branch from 3a1e8db to 6299912 Compare March 24, 2023 21:03
Sources/Identity/CustomerInfoManager.swift Outdated Show resolved Hide resolved
Sources/Identity/CustomerInfoManager.swift Show resolved Hide resolved
@NachoSoto NachoSoto force-pushed the nacho/sdk-2991-write-flow-to-use-locally-computed branch from 58d97c8 to 0ebbb54 Compare March 24, 2023 23:06
@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Merging #2378 (883a606) into main (ce53ff4) will decrease coverage by 0.87%.
The diff coverage is 92.30%.

❗ Current head 883a606 differs from pull request most recent head c19f1cf. Consider uploading reports for the commit c19f1cf to get more accurate results

@@            Coverage Diff             @@
##             main    #2378      +/-   ##
==========================================
- Coverage   87.70%   86.84%   -0.87%     
==========================================
  Files         197      198       +1     
  Lines       13327    13364      +37     
==========================================
- Hits        11689    11606      -83     
- Misses       1638     1758     +120     
Impacted Files Coverage Δ
...ntitlements/CustomerInfo+OfflineEntitlements.swift 92.98% <ø> (+1.75%) ⬆️
...rces/OfflineEntitlements/PurchasedSK2Product.swift 92.85% <ø> (ø)
...OfflineEntitlements/PurchasedProductsFetcher.swift 71.42% <61.11%> (-13.19%) ⬇️
Sources/Networking/Backend.swift 86.31% <70.00%> (-2.19%) ⬇️
Sources/Identity/CustomerInfoManager.swift 94.21% <91.66%> (-0.06%) ⬇️
...rations/Handling/CustomerInfoResponseHandler.swift 97.67% <96.77%> (-2.33%) ⬇️
Sources/Caching/DeviceCache.swift 95.06% <100.00%> (+0.10%) ⬆️
Sources/Error Handling/BackendError.swift 92.43% <100.00%> (+0.19%) ⬆️
Sources/Logging/Strings/CustomerInfoStrings.swift 93.02% <100.00%> (+0.34%) ⬆️
...s/Logging/Strings/OfflineEntitlementsStrings.swift 81.81% <100.00%> (+10.38%) ⬆️
... and 6 more

... and 60 files with indirect coverage changes

@NachoSoto NachoSoto force-pushed the nacho/sdk-3029-change-offline-customerinfo-verification branch from 883a606 to 2eefe0b Compare April 10, 2023 15:19
@NachoSoto NachoSoto force-pushed the nacho/sdk-2991-write-flow-to-use-locally-computed branch from 0ebbb54 to 1e86508 Compare April 10, 2023 16:26
@NachoSoto NachoSoto force-pushed the nacho/sdk-3029-change-offline-customerinfo-verification branch 3 times, most recently from d546aae to 20ef64c Compare April 10, 2023 17:08
@NachoSoto NachoSoto force-pushed the nacho/sdk-2991-write-flow-to-use-locally-computed branch from 1e86508 to 275cd71 Compare May 15, 2023 23:04
@NachoSoto NachoSoto force-pushed the nacho/sdk-3029-change-offline-customerinfo-verification branch from 20ef64c to 95abf7b Compare May 15, 2023 23:43
@NachoSoto NachoSoto force-pushed the nacho/sdk-2991-write-flow-to-use-locally-computed branch from 2da1a32 to 1f385f9 Compare May 17, 2023 17:31
@NachoSoto NachoSoto force-pushed the nacho/sdk-3029-change-offline-customerinfo-verification branch from 95abf7b to 08582ea Compare May 17, 2023 18:11
@NachoSoto NachoSoto force-pushed the nacho/sdk-3029-change-offline-customerinfo-verification branch from 08582ea to c19f1cf Compare May 17, 2023 18:19
@NachoSoto NachoSoto changed the base branch from nacho/sdk-2991-write-flow-to-use-locally-computed to main May 17, 2023 18:19
@NachoSoto NachoSoto enabled auto-merge (squash) May 17, 2023 18:20
@NachoSoto
Copy link
Contributor Author

Rebased this off of main so we can merge it before #2368.

@NachoSoto NachoSoto merged commit 64287a5 into main May 17, 2023
@NachoSoto NachoSoto deleted the nacho/sdk-3029-change-offline-customerinfo-verification branch May 17, 2023 18:36
NachoSoto added a commit that referenced this pull request May 19, 2023
…er is down (#2368)

### Changes:
- Created `PurchasedProductsFetcherType` to be able to mock and hold
fetchers, even on older devices
- Created `ProductEntitlementMappingFetcher` to abstract injecting
`ProductEntitlementMapping`
- Added logic to `CustomerInfoResponseHandler` to compute offline
`CustomerInfo` after a server error (see #2367). **This is used by all
`CustomerInfo` requests as well as `PostReceiptDataOperation`**.
- Wrote comprehensive `CustomerInfoResponseHandler` tests

### TODO:
- [x] Don't cache offline computed `CustomerInfo`: #2378
- [x] Integration tests: #2501.
This was referenced May 31, 2023
@NachoSoto NachoSoto mentioned this pull request May 31, 2023
NachoSoto added a commit that referenced this pull request Jun 1, 2023
**This is an automatic release.**

### New Features
* `Offline Entitlements`: use offline-computed `CustomerInfo` when
server is down (#2368) via NachoSoto (@NachoSoto)

### Bugfixes
* `AppleReceipt.debugDescription`: don't pretty-print JSON (#2564) via
NachoSoto (@NachoSoto)
* `SK2StoreProduct`: fix crash on iOS 12 (#2565) via NachoSoto
(@NachoSoto)
* `GetCustomerInfo` posts receipts if there are pending transactions
(#2533) via NachoSoto (@NachoSoto)
### Performance Improvements
* `PurchasedProductsFetcher`: cache current entitlements (#2507) via
NachoSoto (@NachoSoto)
* Performance: new check to ensure serialization / deserialization is
done from background thread (#2496) via NachoSoto (@NachoSoto)
### Dependency Updates
* Bump fastlane from 2.212.2 to 2.213.0 (#2544) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* `CustomerInfoManager`: post all unfinished transactions (#2563) via
NachoSoto (@NachoSoto)
* `PostReceiptOperation`: added ability to also post `AdServices` token
(#2566) via NachoSoto (@NachoSoto)
* `Offline Entitlements`: improved computation log (#2562) via NachoSoto
(@NachoSoto)
* Added `TransactionPoster` tests (#2557) via NachoSoto (@NachoSoto)
* Refactored `TransactionPoster`: removed 2 dependencies and abstracted
parameters (#2542) via NachoSoto (@NachoSoto)
* `CustomerInfoManagerTests`: wait for `getAndCacheCustomerInfo` to
finish (#2555) via NachoSoto (@NachoSoto)
* `StoreTransaction`: implemented `description` (#2556) via NachoSoto
(@NachoSoto)
* `Backend.ResponseHandler` is now `@Sendable` (#2541) via NachoSoto
(@NachoSoto)
* Extracted `TransactionPoster` from `PurchasesOrchestrator` (#2540) via
NachoSoto (@NachoSoto)
* `enableAdServicesAttributionTokenCollection`: added integration test
(#2551) via NachoSoto (@NachoSoto)
* `AttributionPoster`: replaced hardcoded strings with constants (#2548)
via NachoSoto (@NachoSoto)
* `DefaultDecodable`: moved to `Misc/Codable/DefaultDecodable.swift`
(#2528) via NachoSoto (@NachoSoto)
* `CircleCI`: specify device to run `backend_integration_tests` (#2547)
via NachoSoto (@NachoSoto)
* Created `StoreKit2TransactionFetcher` (#2539) via NachoSoto
(@NachoSoto)
* Fix load shedder integration tests (#2546) via Josh Holtz
(@joshdholtz)
* Fix doc on `Offering.getMetadataValue` (#2545) via Josh Holtz
(@joshdholtz)
* Extracted and tested `AsyncSequence.extractValues` (#2538) via
NachoSoto (@NachoSoto)
* `Offline Entitlements`: don't compute offline `CustomerInfo` when
purchasing a consumable products (#2522) via NachoSoto (@NachoSoto)
* `OfflineEntitlementsManager`: disable offline `CustomerInfo` in
observer mode (#2520) via NachoSoto (@NachoSoto)
* `BasePurchasesTests`: fixed leak detection (#2534) via NachoSoto
(@NachoSoto)
* `PurchaseTesterSwiftUI`: added `ProxyView` to `iOS` (#2531) via
NachoSoto (@NachoSoto)
* `PurchasedProductsFetcher`: removed `AppStore.sync` call (#2521) via
NachoSoto (@NachoSoto)
* `PurchaseTesterSwiftUI`: added new window on Mac to manage proxy
(#2518) via NachoSoto (@NachoSoto)
* `PurchasedProductsFetcher`: added log if fetching purchased products
is slow (#2515) via NachoSoto (@NachoSoto)
* `Offline Entitlements`: disable for custom entitlements mode (#2509)
via NachoSoto (@NachoSoto)
* `Offline Entitlements`: fixed iOS 12 tests (#2514) via NachoSoto
(@NachoSoto)
* `PurchasedProductsFetcher`: don't throw errors if purchased products
were found (#2506) via NachoSoto (@NachoSoto)
* `Offline Entitlements`: allow creating offline `CustomerInfo` with
empty `ProductEntitlementMapping` (#2504) via NachoSoto (@NachoSoto)
* `Offline Entitlements`: integration tests (#2501) via NachoSoto
(@NachoSoto)
* `CustomerInfoManager`: don't cache offline `CustomerInfo` (#2378) via
NachoSoto (@NachoSoto)
* `DangerousSettings`: debug-only `forceServerErrors` (#2486) via
NachoSoto (@NachoSoto)
* `CocoapodsInstallation`: fixed `Xcode 14.3.0` issue (#2489) via
NachoSoto (@NachoSoto)
* `CarthageInstallation`: removed workaround (#2488) via NachoSoto
(@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
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.

2 participants