Skip to content

New SwiftUI Purchase Tester example#1722

Merged
joshdholtz merged 4 commits into
mainfrom
new-swiftui-purchase-tester
Jun 24, 2022
Merged

New SwiftUI Purchase Tester example#1722
joshdholtz merged 4 commits into
mainfrom
new-swiftui-purchase-tester

Conversation

@joshdholtz

@joshdholtz joshdholtz commented Jun 21, 2022

Copy link
Copy Markdown
Member

Motivation / Description

New app that tests almost all iOS SDK functionality.

This is not an example like MagicWeather that shows how to use RevenueCat in an app but will instead be an example for testing all the SDK functions on any RevenueCat app.

History

This wasn't really on my list of things to ever do but I was debugging something a few months ago when I was on call and the easiest way to do it was to build out some of these screens in SwiftUI. I spent a little bit more to polish it up and this was the result 🤷‍♂️

RocketSim_Recording_iPhone_13_Pro_Max_2022-06-21_12.12.18.mp4

@joshdholtz joshdholtz requested a review from a team June 22, 2022 00:12
@aboedo

aboedo commented Jun 22, 2022

Copy link
Copy Markdown
Member

Look at that thing 😻 This is awesome

@aboedo aboedo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OMG I think I'm gonna cry

IMG_BFC4183F4712-1

This is absolutely fantastic @joshdholtz 🚀

Small thing: when trying this on a physical device I had to add a copy files phase to copy the RevenueCat framework in it, lmk if I was missing something

Comment thread Examples/PurchaseTester/Constants.swift
.textFieldAlert(isShowing: self.$showOtherAlert, title: self.revenueCatKind?.rawValue ?? self.thirdPartyKind?.rawValue ?? "<ERROR>", fields: [
("Value", "Value", self.$otherValue),
]) {
if let kind = self.revenueCatKind {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WAAAT

IMG_A49010FE020B-1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I might be missing a few here! This is also using the deprecated version of these so those should be updated with the new attribution namespace thing at some point 🤷‍♂️

import SwiftUI
import RevenueCat

struct OfferingDetailView: View {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤯

IMG_9B47DAE40B6D-1

import SwiftUI
import RevenueCat

struct TransactionsView: View {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👏👏👏👏
IMG_BFC4183F4712-1

@joshdholtz joshdholtz requested a review from aboedo June 22, 2022 16:19

@aboedo aboedo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🚀🚀🚀

@NachoSoto NachoSoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is amazing 👏🏻

I know this is just a starting point so none of my comments are blocking.

Comment thread Tests/TestingApps/PurchaseTesterSwiftUI/Constants.swift Outdated
Comment thread Tests/TestingApps/PurchaseTesterSwiftUI/Constants.swift
Comment thread Tests/TestingApps/PurchaseTesterSwiftUI/PurchaseTester.xcodeproj/project.pbxproj Outdated
productReference = 2CD2C4F5278C9B02005D1CC2 /* PurchaseTester.app */;
productType = "com.apple.product-type.application";
};
2CD2C4FA278C9B02005D1CC2 /* PurchaseTester (macOS) */ = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would combine both targets into a cross-platform one, but again can be done in a separate PR.

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto for schemes, we don't need one for each platform.

Comment thread Tests/TestingApps/PurchaseTesterSwiftUI/Tests iOS/Tests_iOS.swift Outdated
@joshdholtz

Copy link
Copy Markdown
Member Author

Updated with a bunch of suggestions from @NachoSoto 💪

@joshdholtz joshdholtz merged commit 971b596 into main Jun 24, 2022
@joshdholtz joshdholtz deleted the new-swiftui-purchase-tester branch June 24, 2022 14:33
@NachoSoto NachoSoto mentioned this pull request Jun 30, 2022
NachoSoto added a commit that referenced this pull request Jul 4, 2022
### Changes:
* Replaced `CustomerInfo.nonSubscriptionTransactions` with a new non-`StoreTransaction` type (#1733) via NachoSoto (@NachoSoto)
* `Purchases.configure`: added overload taking a `Configuration.Builder` (#1720) via NachoSoto (@NachoSoto)
* Extract Attribution logic out of Purchases (#1693) via Joshua Liebowitz (@taquitos)
* Remove create alias (#1695) via Joshua Liebowitz (@taquitos)

All attribution APIs can now be accessed from `Purchases.shared.attribution`.

### Improvements:
* Improved purchasing logs, added promotional offer information (#1725) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: don't log attribute errors if there are none (#1742) via NachoSoto (@NachoSoto)
* `FatalErrorUtil`: don't override `fatalError` on release builds (#1736) via NachoSoto (@NachoSoto)
* `SKPaymentTransaction`: added more context to warnings about missing properties (#1731) via NachoSoto (@NachoSoto)
* New SwiftUI Purchase Tester example (#1722) via Josh Holtz (@joshdholtz)
* update docs for `showManageSubscriptions` (#1729) via aboedo (@aboedo)
* `PurchasesOrchestrator`: unify finish transactions between SK1 and SK2 (#1704) via NachoSoto (@NachoSoto)
* `SubscriberAttribute`: converted into `struct` (#1648) via NachoSoto (@NachoSoto)
* `CacheFetchPolicy.notStaleCachedOrFetched`: added warning to docstring (#1708) via NachoSoto (@NachoSoto)
* Clear cached offerings and products after Storefront changes (2/4) (#1583) via Juanpe Catalán (@Juanpe)
* `ROT13`: optimized initialization and removed magic numbers (#1702) via NachoSoto (@NachoSoto)

### Fixes:
* `logIn`/`logOut`: sync attributes before aliasing (#1716) via NachoSoto (@NachoSoto)
* `Purchases.customerInfo(fetchPolicy:)`: actually use `fetchPolicy` parameter (#1721) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: fix behavior dealing with `nil` `SKPaymentTransaction.productIdentifier` during purchase (#1680) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator.handlePurchasedTransaction`: always refresh receipt data (#1703) via NachoSoto (@NachoSoto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants