Commit Graph
13 Commits
Author SHA1 Message Date
Will Taylor d9e4258c65 run CI jobs on iOS18/watchOS11 & use Xcode 16 2024-10-01 10:04:54 -05:00
Josh HoltzandRevenueCat Git Bot a9737aa7fc Add targeting to PresentedOfferingContext (#3730)
### Motivation

Get more context with targeting information 

### Description

- Parse targeting information into `Offerings`
- Add targeting context into `Offerings.current`
- Add targeting context into `getCurrentOffering(forPlacement: String)`
- Post targeting context in post receipts

---------

Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
2024-02-28 16:10:52 -06:00
61d66bbc32 Add currentOffering(forPlacement: String) to Offerings (#3707)
### Motivation

New function to get `Offering` by a placement identifier

### Description

New `currentOffering(forPlacement: String): Offering?` method on
`Offerings`
- Added demo button for this in purchase tester app

```swift
// Example usage
if let offering = offerings.currentOffering(forPlacement: "onboarding") {
  showPaywall(offering)
}
```

#### Logic flow

- If a placement identifier explicitly exists within the
`placements.offeringIdsByPlacement` dictionary, the method attempts to
fetch the corresponding `Offering` without resorting to a fallback
- Example: when there is a `nil` / null value for a placement, we don't
want to use the fallback
- If the placement identifier does not exist, the method then attempts
to fetch a fallback offering defined by `placements.fallbackOfferingId`

#### New placements object in offerings response

```js
{
    // other offerings stuff
    "placements": {
        "fallback_offering_id": "offering_a", // can be null
        "offering_ids_by_placement": {
            "onboarding_start": null,
            "onboarding_end": "offering_b",
        }
  }
}
```

---------

Co-authored-by: Guido Torres <guido@revenuecat.com>
Co-authored-by: Josh Holtz <me@joshholtz.com>
Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
2024-02-28 15:11:48 -06:00
NachoSoto d0bb035b72 Xcode 15.3 beta 1: fix warnings on tests (#3600)
Depends on #3599.
2024-01-26 08:41:38 +01:00
NachoSoto 67b421e2b1 .debugRevenueCatOverlay: added Locale (#3539)
This adds the `Locale.identifier` and the currency code.
It can help debug issues with paywalls, currencies, localization, etc.

![Simulator Screenshot - iPhone 15 Pro Max - 2023-12-21 at 11 05
36](https://github.com/RevenueCat/purchases-ios/assets/685609/c0b5db10-8ab8-4119-9992-522065979612)
2023-12-21 12:19:54 -08:00
NachoSoto 4d95c03798 CI: added workaround for Snapshots in Xcode Cloud (#2857)
See
https://github.com/pointfreeco/swift-snapshot-testing/discussions/553.
Blocked by https://github.com/codecov/uploader/issues/1126.
2023-10-21 11:12:16 -07:00
NachoSoto a13dbb907c CI: run all iOS 17 tests (#3312)
Xcode 15.0.1 (#3311) fixed performance issues, so we should be able to
run all tests on iOS 17.
2023-10-17 15:04:41 -07:00
NachoSoto 4bca13f90d Debug View: display receipt status (#3303) 2023-10-16 07:34:34 -07:00
NachoSoto 31757a1f18 Paywalls: changed snapshots to scale 1 (#3016)
This reduces the total size of all paywall snapshots from 247MB to 34MB.
2023-09-14 18:28:11 -07:00
NachoSoto 69a18fa410 Paywalls: initial RevenueCatUI target setup (#2776)
- Added `RevenueCatUI` to `Package.json`
- Set up tests for `RevenueCatUI` using `snapshot-testing` (not in CI
during initial development)
- Added Schemes to allow easily building packages while working on the
`Package.swift`
- Updated `SimpleApp` to use new package
2023-09-14 18:28:11 -07:00
NachoSoto b55de6ae09 CI: enable iOS 17 tests (#2829)
Filed `FB12653515` because `StoreKitUnitTests` hang when beginning:
> Runner never began executing tests after launching

This at least enables iOS 17 without StoreKit tests.
2023-09-14 12:21:36 -07:00
NachoSoto dab5035a19 visionOS: support for Xcode 15 beta 6 (#2989)
### Context:

`#if os(iOS)` no longer evaluates to `true` when compiling for
`visionOS`
Which means we need `|| os(xrOS)`.
But to support older Xcode we need `#if swift(>=5.9) && os(xrOS)`.
But, fun fact, short-circuiting doesn’t work in `Xcode 13`.
And we still need that to run iOS <15 tests (`FB12223404` /
`FB12805891`)

💩 

This works around that by defining our own `VISION_OS` flag.

### Changes:
- Added `VISION_OS` compile time flag to determine SDK
- Replaced `#if os(xrOS)` with `#if VISION_OS`
- Added flag to `Package.swift` (thanks @neonichu for helping with this)
2023-08-09 11:19:40 -07:00
NachoSoto edd5a238da Tests: optimized several tests (#2754)
`RevenueCat` took 16 seconds on Xcode 15, now it takes 8 seconds.

### Changes
-
`HTTPClient.testPerformSerialRequestWaitsUntilRequestsAreDoneBeforeStartingNext`
took almost ~1 second because of the artificial delays, now it takes
0.1s
- `FileHandlerTests.testRemoveMultipleLinesOnLineFile` was really slow
(~1 second) because it was appending one line at a time
` DebugViewSwiftUITests` are slow because of the nature of snapshotting
images. I moved them to `StoreKitUnitTests` because that's the slower
suite.

![Screenshot 2023-07-06 at 08 33
06](https://github.com/RevenueCat/purchases-ios/assets/685609/1ca64916-b9b0-4ab0-a3ee-dc50abaceeea)
2023-07-07 19:22:20 +02:00