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

Offering: improved confusing log for PackageType.custom #1884

Merged
merged 1 commit into from
Sep 6, 2022

Conversation

NachoSoto
Copy link
Contributor

@NachoSoto NachoSoto commented Sep 5, 2022

Fixes CSDK-450.

We were logging a message for packages with custom duration that says "Unknown subscription length for package, ignoring."
This is very confusing for customers, as it looks like something is wrong. However it’s expected and normal behavior for packages with custom duration.

Fixes [CSDK-450].

We were logging a message for packages with custom duration that says "Unknown subscription length for package, ignoring."
This is very confusing for customers, as it looks like something is wrong. However it’s expected and normal behavior for packages with custom duration.
@NachoSoto NachoSoto added the fix A bug fix label Sep 5, 2022
@NachoSoto NachoSoto requested a review from a team September 5, 2022 20:54
@@ -138,11 +139,13 @@ import Foundation
case .custom where package.storeProduct.productCategory == .nonSubscription:
// Non-subscription product, ignoring
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still left this extra case because it doesn't even warrant a log.

Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -109,6 +109,7 @@ import Foundation
return package(identifier: key)
}

// swiftlint:disable:next cyclomatic_complexity
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm might be good to try to refactor this to avoid this issue... But NABD.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I thought about it but this needs to be in init in order to make the type immutable so I couldn't think of how to extract it out. Ultimately it's just a factor of the number of cases and putting a limit to that is kind of arbitrary.

@@ -38,6 +38,8 @@ enum OfferingStrings {
case configuration_error_no_products_for_offering
case offering_empty(offeringIdentifier: String)
case product_details_empty_title(productIdentifier: String)
case unknown_package_type(Package)
case custom_package_type(Package)
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the cases above have a parameter name in addition to the type. Is that ok? And if so, it might be a good idea to consolidate them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's useful for parameters like Strings because it's not clear what they contain. But a package is always going to be a package 😅

@NachoSoto NachoSoto merged commit e63782e into main Sep 6, 2022
@NachoSoto NachoSoto deleted the custom-package-log branch September 6, 2022 12:06
NachoSoto pushed a commit that referenced this pull request Sep 8, 2022
**This is an automatic release.**

### Bugfixes
* `watchOS`: fixed crash when ran on single-target apps with Xcode 14 and before `watchOS 9.0` (#1895) via NachoSoto (@NachoSoto)
* `CustomerInfoManager`/`OfferingsManager`: improved display of underlying errors (#1888) via NachoSoto (@NachoSoto)
* `Offering`: improved confusing log for `PackageType.custom` (#1884) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: don't log warning if `allowSharingAppStoreAccount` setting was never explicitly set (#1885) via NachoSoto (@NachoSoto)
* Introduced type-safe `PurchasesError` and fixed some incorrect returned error types (#1879) via NachoSoto (@NachoSoto)
* `CustomerInfoManager`: fixed thread-unsafe implementation (#1878) via NachoSoto (@NachoSoto)
### New Features
* Disable SK1's `StoreKitWrapper` if SK2 is enabled and available (#1882) via NachoSoto (@NachoSoto)
* `Sendable` support (#1795) via NachoSoto (@NachoSoto)
### Other Changes
* Renamed `StoreKitWrapper` to `StoreKit1Wrapper` (#1886) via NachoSoto (@NachoSoto)
* Enabled `DEAD_CODE_STRIPPING` (#1887) via NachoSoto (@NachoSoto)
* `HTTPClient`: added `X-Client-Bundle-ID` and logged on SDK initialization (#1883) via NachoSoto (@NachoSoto)
* add link to SDK reference (#1872) via Andy Boedo (@aboedo)
* Added `StoreKit2Setting.shouldOnlyUseStoreKit2` (#1881) via NachoSoto (@NachoSoto)
* Introduced `TestLogHandler` to simplify how we test logged messages (#1858) via NachoSoto (@NachoSoto)
* `Integration Tests`: added test for purchasing `StoreProduct` instead of `Package` (#1875) via NachoSoto (@NachoSoto)
* `ErrorUtils`: added test to verify that returned errors can be converted to `ErrorCode` (#1871) via NachoSoto (@NachoSoto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants