-
Notifications
You must be signed in to change notification settings - Fork 316
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 missing logs to ProductsFetcherSK2 #1780
Changes from 5 commits
55a91d0
31b7005
965d85a
ac73aae
7713332
8eff1fd
c7c6f99
20abf07
159a388
8109ee8
9fcbd95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,13 +18,13 @@ enum StoreKitStrings { | |||||
|
||||||
case skrequest_failed(error: Error) | ||||||
|
||||||
case skproductsrequest_failed(error: Error) | ||||||
case store_products_request_failed(error: Error) | ||||||
|
||||||
case skproductsrequest_timed_out(after: Int) | ||||||
|
||||||
case skproductsrequest_finished | ||||||
case store_product_request_did_finish | ||||||
|
||||||
case skproductsrequest_received_response | ||||||
case store_product_request_received_response | ||||||
|
||||||
case skunknown_payment_mode(String) | ||||||
|
||||||
|
@@ -36,6 +36,8 @@ enum StoreKitStrings { | |||||
|
||||||
case sk1_discount_missing_locale | ||||||
|
||||||
case no_cached_requests_and_products_starting_skproduct_request(identifiers: Set<String>) | ||||||
|
||||||
} | ||||||
|
||||||
extension StoreKitStrings: CustomStringConvertible { | ||||||
|
@@ -46,20 +48,20 @@ extension StoreKitStrings: CustomStringConvertible { | |||||
case .skrequest_failed(let error): | ||||||
return "SKRequest failed: \(error.localizedDescription)" | ||||||
|
||||||
case .skproductsrequest_failed(let error): | ||||||
return "SKProductsRequest failed! error: \(error.localizedDescription)" | ||||||
case .store_products_request_failed(let error): | ||||||
return "Store products request failed! error: \(error.localizedDescription)" | ||||||
|
||||||
case .skproductsrequest_timed_out(let afterTimeInSeconds): | ||||||
return "SKProductsRequest took longer than \(afterTimeInSeconds) seconds, " + | ||||||
"cancelling request and returning an empty set. This seems to be an App Store quirk. " + | ||||||
"If this is happening to you consistently, you might want to try using a new Sandbox account. " + | ||||||
"More information: https://rev.cat/skproductsrequest-hangs" | ||||||
|
||||||
case .skproductsrequest_finished: | ||||||
case .store_product_request_did_finish: | ||||||
return "SKProductsRequest did finish" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can change as well:
Suggested change
|
||||||
|
||||||
case .skproductsrequest_received_response: | ||||||
return "SKProductsRequest request received response" | ||||||
case .store_product_request_received_response: | ||||||
return "Store products request request received response" | ||||||
|
||||||
case let .skunknown_payment_mode(name): | ||||||
return "Unrecognized PaymentMode: \(name)" | ||||||
|
@@ -77,6 +79,10 @@ extension StoreKitStrings: CustomStringConvertible { | |||||
case .sk1_discount_missing_locale: | ||||||
return "There is an issue with the App Store, this SKProductDiscount is missing a Locale - " + | ||||||
"The current device Locale will be used instead." | ||||||
|
||||||
case .no_cached_requests_and_products_starting_skproduct_request(let identifiers): | ||||||
return "No existing requests and " + | ||||||
"products not cached, starting SKProducts request for: \(identifiers)" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto, you're still using this in SK2, maybe change it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was leaving this one in case we decided to cache requests... might be worth a different string until we decide to cache There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cache products, just not concurrent requests, which might be good enough? |
||||||
} | ||||||
} | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -106,8 +106,10 @@ private extension ProductsManager { | |||||
_ = Task<Void, Never> { | ||||||
do { | ||||||
let products = try await self.sk2StoreProducts(withIdentifiers: identifiers) | ||||||
Logger.debug(Strings.storeKit.store_product_request_did_finish) | ||||||
completion(.success(Set(products))) | ||||||
} catch { | ||||||
Logger.debug(Strings.storeKit.store_products_request_failed(error: error)) | ||||||
completion(.failure(error)) | ||||||
} | ||||||
} | ||||||
|
@@ -119,9 +121,11 @@ private extension ProductsManager { | |||||
productsFetcherSK1.products(withIdentifiers: removedProductIdentifiers, completion: { result in | ||||||
switch result { | ||||||
case.success: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hun looks like this is missing a space?
Suggested change
|
||||||
Logger.debug(Strings.storeKit.skproductsrequest_finished) | ||||||
// this one is duplicate, though other in ProductsFetcherSK1 is rcSuccess | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. options i see are:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we've looked into these logs very much in detail, so this refactor is great 👍🏻
|
||||||
Logger.debug(Strings.storeKit.store_product_request_did_finish) | ||||||
case .failure(let error): | ||||||
Logger.debug(Strings.storeKit.skproductsrequest_failed(error: error)) | ||||||
// this one is duplicate, though other in ProductsFetcherSK1 is appleError | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I'd say this one should be |
||||||
Logger.debug(Strings.storeKit.store_products_request_failed(error: error)) | ||||||
} | ||||||
}) | ||||||
} | ||||||
|
@@ -134,9 +138,10 @@ private extension ProductsManager { | |||||
if !removedProductIdentifiers.isEmpty { | ||||||
do { | ||||||
_ = try await self.productsFetcherSK2.products(identifiers: removedProductIdentifiers) | ||||||
Logger.debug(Strings.storeKit.skproductsrequest_finished) | ||||||
|
||||||
Logger.debug(Strings.storeKit.store_product_request_did_finish) | ||||||
} catch { | ||||||
Logger.debug(Strings.storeKit.skproductsrequest_failed(error: error)) | ||||||
Logger.debug(Strings.storeKit.store_products_request_failed(error: error)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: For consistency I'd keep the "finished" wording, or change this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, i'm lost, which finished wording? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Just mentioning that since you changed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh got it, i was looking for "finished" in that string you commented on. monday brain, thanks |
||||||
} | ||||||
} | ||||||
} | ||||||
|
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.
Nit: