Commit Graph
11 Commits
Author SHA1 Message Date
Antonio Pallares e9e5f791cb Show redacted Test Api key in alert when detected in Release configuration (#5897)
* Include redacted version of Test Store API key in alert and log when running in Release configuration

* Add unit tests for redacting API keys

* Support redaction in old api keys with no prefix

* Fix lint

* Use constants instead of magic numbers
2025-12-02 20:40:34 +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
NachoSoto 2f1a4e0be8 PaywallViewController: new initializer with Offering identifier (#3587)
Depends on #3586.

This will be used by the hybrid SDKs to be able to load paywalls with an
offering identifier.
2024-01-22 09:00:36 -08:00
NachoSoto 3da1c50925 HTTPRequest.Path: escape appUserID (#2747)
We were escaping users for every (hopefully) request. This refactor
moves that responsibility to the path creation in `HTTPRequest.Path` to
ensure it's done consistently.

Additionally, this is required so that `SigningTests` produce a
consistent path (see #2746).
2023-07-05 15:41:51 -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
NachoSoto 25c78f862a Removed unnecessary Strings.trimmedOrError (#2601) 2023-06-09 07:43:41 -07:00
NachoSoto 5f2161e0ee ROT13: optimized initialization and removed magic numbers (#1702)
### Changes:

- Using `Dictionary.init(minimumCapacity:)` to allocate the necessary size initially instead of growing when adding data to it
- Defined `uppercase` in terms of `lowercase`
- Removed magic `13` and `26` numbers
2022-06-14 12:56:00 -07:00
NachoSoto 7ca28477f4 Fixed ROT13.string thread-safety (#1686)
Fixes #1685.

### Description

Swift's `lazy` and `static` property initialization is always thread-safe. However, `key` was only created as an empty dictionary, and the evaluation of `ROT13.string`, which was the one initializing that data, wasn't isolated.
By creating `ROT13.key` inline, this ensures that the initialization is only done once in a thread-safe way.
2022-06-10 11:31:04 -07:00
NachoSoto a634e493f1 Added String.asData to avoid dealing with Data? (#1566)
Turns out `Data(string.utf8)` is a much simpler way of converting `String` to `Data` that doesn't lead to an `Optional`.
UTF-8 can represent all valid Unicode code points, so this was always safe, but now we know at compile time.

The reason the old variant returned an `Optional` is because it accepts other encodings like `.ascii` which might not be able to represent everything in the `String`.

This simplifies several parts of the code that were dealing with an error that was impossible.
2022-05-20 15:53:27 -07:00
NachoSoto 3f1a527c9b Moved response error and status checking to HTTPClient (#1431)
Follow up to #1429. For #695.

This was duplicated in all operations.
`HTTPClient` now only forwards `Result.success` if the request actually succeeded,
leaving each `NetworkOperation` to just parse the body (which will become part of `HTTPClient` too).

Other changes:
- Simplified logic for when to retry requests in `HTTPClient` by using a new `Result.asOptionalResult`
- Removed several response handlers that don't need to do anything anymore
- Removed several tests that were basically duplicated:
  - The `finishable` checks are already tested as part of `ErrorResponse`.
  - All the checks for the error details are also part of `ErrorResponse`.
  - No longer need to have a test for each type of failed response since that's part of `HTTPClient` tests now.
2022-04-05 11:39:49 -07:00
aboedo f5697de730 renamed Purchases folder to Sources (#1416)
* renamed `Purchases` folder to `Sources`

* temporarily enabling installation test jobs

* re-disabling installation test jobs
2022-03-28 11:53:24 -03:00