Commit Graph
24 Commits
Author SHA1 Message Date
Antonio Pallares 0ec39f66ae Fix potential wrong count on diagnosis sync (#4846)
* fix: potential count desync in `DiagnosticsSynchronizer`

* tests: add unit tests for invalid entry lines in local diagnostics file
2025-03-04 08:55:05 +01:00
Antonio Pallares f7fa5d2e81 [Diagnostics] Add extra parameters to applePurchaseAttempt (#4835)
* feat: add missing properties to `apple_purchase_attempt` diagnostics event

* tests: add + edit unit tests for new diagnostics parameters for SK1 purchase attempt

* fix implementation of sk2 product purchase to catch promotional offer signature error again

* tests: edit unit tests for new diagnostics parameters for SK2 purchase attempt

* fix failing test

* refactor: separate error handling in purchase SK2 product method into its own method

* address PR #4835 comments

* lint
2025-03-03 14:38:00 +01:00
Antonio Pallares de879a0889 Use array instead of sets in diagnostics events (#4839)
* tests: remove `Equatable` conformance of `DiagnosticsEvent` and `AnyEncodable` from RevenueCat and added to test targets (where it's needed)

* Use Arrays instead of Sets in Diagnostics events to have predictable order in sent events

* tests: compare Sets vs Arrays in unit test

The conversion from Array --> Set --> Array may change the order of the elements

* remove `DiagnosticsEvent+Equatable` from some targets

* PR #4839 fixes

* remove `AnyEncodable+Equatable.swift` from some targets
2025-03-02 12:50:03 +01:00
Toni Rico 8f5a9488e0 [Diagnostics] Add requestedProductIds and notFoundProductIds to appleProductsRequest (#4828) 2025-02-28 09:43:19 +01:00
Facundo Menzella 6b5c430082 chore: Enable force_unwrapping for SwiftLint (#4820)
* enable force_unwrapping

* avoid force unwrap

* fixed all errors

* remove extra disable
2025-02-26 12:40:49 +01:00
Mark Villacampa 6f8e53ac40 Fix Xcode 16 warnings (#4334)
When compiling with Xcode 16, we started throwing a bunch of new warnings. Here's a list and explanation of each:

- The most common one was needing to explicitly restate the @unchecked Sendable conformance from a parent class.
- There were a couple switches where a new entry was added in tvOS but only for iOS 18, and needed to add it to make it exhaustive.
- There we a couple of places where we were adding a protocol conformance to a class from a different module e.g. extension DispatchTimeInterval: Comparable. This is considered unsafe now because the owners of the module could add the conformance later. Solved by removing the conformance which wasn't being used widely in the codebase, only in tests.
- Finally there was a class where we were capturing SKRequest and SKProductsRequest instances in a sendable block, but only to either log something, or use them as dictionary key, so I just made the classes Sendable (with the new @retroactice attribute because they belong to a different module)
2024-10-02 11:53:45 +02:00
Cesar de la Vega 37e197b81b Fix iOS 15 tests (#4320) 2024-09-30 12:29:24 +02:00
Toni Rico 4503a837e6 [Diagnostics] Refactor diagnostics track methods to handle background work automatically (#4270)
* Refactor diagnostics track methods to handle background work automaticaly

* fix swiftlint
2024-09-26 16:33:28 +02:00
Toni Rico f95799901a [Diagnostics] Add apple_products_request event (#4247)
* [Diagnostics] Add apple_products_request event

* Fixes from review

* Change tests to use to(beNil())

* Make MockDiagnosticsTracker sendable to fix tests

* Add new property to track storekit error type

* Use new method to process sk errors
2024-09-26 14:46:16 +02:00
Cesar de la Vega 93e3f3f477 [Diagnostics] Add apple_purchase_attempt event (#4253) 2024-09-25 16:41:05 +02:00
Toni Rico 597af5f215 [Diagnostics] Add backend_error_code property (#4236)
<!-- Thank you for contributing to Purchases! Before pressing the
"Create Pull Request" button, please provide the following: -->

### Checklist
- [ ] If applicable, unit tests
- [ ] If applicable, create follow-up issues for `purchases-android` and
hybrids

### Motivation
<!-- Why is this change required? What problem does it solve? -->
<!-- Please link to issues following this format: Resolves #999999 -->

### Description
This adds the `backend_error_code` property to diagnostics
`http_request_performed` events.
2024-09-04 09:03:34 +02:00
NachoSoto 2bcd0ce328 5.0.0 changes: support SK2 by default 2024-07-01 14:37:21 -05:00
Toni Rico ffe5b8b363 Diagnostics: Add logic to retry on server errors (#3930)
### Description
This will make sure that we delete the diagnostics file if there is an
issue syncing it over multiple retries (note these retries only happen
during SDK configuration).
2024-06-03 13:57:59 +02:00
Toni Rico bb8066d9b3 Add http_request_performed diagnostics event (#3897)
### Description
This adds a new diagnostics event `http_request_performed` with some
useful information we would like to track about the http requests
performed to our servers.
2024-05-16 15:13:40 +02:00
Toni Rico 0a534c8260 Clear diagnostics file if we detect it's too big during event tracking (#3824)
### Description
This makes it so, if we detect the diagnostics file gets too big while
tracking an event, we just clear it and start over. Additionally, we add
an event tracking that this happened to the diagnostics file.
2024-05-10 17:00:28 +02:00
Cesar de la Vega 5e0bc32867 Add diagnostics event for Customer Info verification (#3823)
Track CustomerInfo verification results
2024-04-25 23:03:45 +02:00
c55c03d678 Add DiagnosticsSynchronizer (#3787)
Adds capability to synchronize diagnostics events from the JSONL file to
the backend

---------

Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Co-authored-by: James <109382862+jamesrb1@users.noreply.github.com>
2024-04-16 13:18:31 +02:00
Cesar de la VegaandToni Rico 74d3960262 Create DiagnosticsTracker (#3784)
Create `DiagnosticsTracker` and adds it to the `Purchases`
initialization. I don't expose the `diagnosticsEnabled` yet

---------

Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
2024-04-12 11:47:57 +02:00
Cesar de la Vega f813e3217b Create DiagnosticsPostOperation (#3795)
Add DiagnosticsPostOperation and DiagnosticsAPI
2024-04-11 17:12:04 +02:00
Cesar de la Vega 03d93bb061 Add HTTPRequest.DiagnosticsPath (#3791)
Create DiagnosticsHTTPRequestPath for Diagnostics

Depends on #3790 which adds the name
2024-04-10 13:00:48 +02:00
Cesar de la Vega 6c4d75fc23 iOS append events to JSONL file and get diagnostics events (#3781)
Based off https://github.com/RevenueCat/purchases-ios/pull/2672/

Equivalent to https://github.com/RevenueCat/purchases-android/pull/784/

Adds DiagnosticsEntry classes and implements adding an entry to the
file, getting all entries, and deleting X first entries
2024-04-08 12:47:54 +02:00
NachoSoto dc628a2aaa Paywalls: events unit and integration tests (#3169)
### Changes:
- Added `PurchasesOrchestrator` tests for paywall data sent through post
receipt
- Fixed and tested state issue with cached paywall data and failed
purchases
- Added `Integration Tests` for tracking and flushing events
- Configured `Integration Tests` with a custom documents directory to
ensure it's empty on every test invocation
- Changed deployment target on `Integration Tests` to iOS 16 to simplify
code
- Setting `Purchases.logLevel` before configuring purchases on
`Integration Tests`
- Added assertion to ensure `FileHandler` never runs on the main thread
2023-09-14 18:28:11 -07:00
NachoSoto 46b6b14237 Paywalls: created PaywallEventStore (#3157)
- New `PaywallEventStore` using `FileHandler` (#2673)
- `MockFileHandler`
- `PaywallStoredEvent`: this contains the necessary information to store
an event: `PaywallEvent` + user ID
- Created `PaywallEventSerializer`
2023-09-14 18:28:11 -07:00
NachoSoto f05fd88214 Diagnostics: new FileHandler for abstracting file operations (#2673)
Implemented as an `actor` to easily synchronize operations on a file.

Simple interface:
![Screenshot 2023-06-16 at 16 45
14](https://github.com/RevenueCat/purchases-ios/assets/685609/2f4850a3-f915-4330-a5e2-3abf9b37fb54)
2023-06-22 13:02:34 -07:00