Skip to content

Commit

Permalink
Move documentation from FreemiumKit repo here
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Jun 5, 2024
1 parent b73fbba commit 950e87a
Show file tree
Hide file tree
Showing 14 changed files with 570 additions and 32 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy Documentation to GitHub Pages

on:
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Install Swift
uses: swift-actions/setup-swift@v2

- name: Build Documentation
run: |
swift package --allow-writing-to-directory ./docs \
generate-documentation --target FreemiumKit \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path FreemiumKit \
--output-path ./docs
- name: Deploy to Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: docs
24 changes: 24 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"originHash" : "8fcbf64afeccf02f1d78925ef5381292359a92c3c5078b6afe73a0d007c200e0",
"pins" : [
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"revision" : "26ac5758409154cc448d7ab82389c520fa8a8247",
"version" : "1.3.0"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
}
],
"version" : 3
}
22 changes: 4 additions & 18 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "FreemiumKit-Docs",
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "FreemiumKit-Docs",
targets: ["FreemiumKit-Docs"]),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "FreemiumKit-Docs"),
.testTarget(
name: "FreemiumKit-DocsTests",
dependencies: ["FreemiumKit-Docs"]),
]
name: "FreemiumKit",
products: [.library(name: "FreemiumKit", targets: ["FreemiumKit"])],
dependencies: [.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0")],
targets: [.target(name: "FreemiumKit")]
)
2 changes: 0 additions & 2 deletions Sources/FreemiumKit-Docs/FreemiumKit_Docs.swift

This file was deleted.

52 changes: 52 additions & 0 deletions Sources/FreemiumKit/FreemiumKit.docc/FAQ/FAQ-HowItWorks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# How does FreemiumKit work? Can I trust it?

Learn why you can trust FreemiumKit to scale with your app and why there's no long-term lock-in risk for your app.

@Metadata {
@TitleHeading("FAQs")
@PageKind(sampleCode)
}

## Short Answer

FreemiumKit is built on top of StoreKit 2 and official App Store Connect APIs. Therefore, most of what FreemiumKit does is following modern Apple best practices, without being dependent on our servers. For the paywall remote configuration, we use a Content Delivery Network (CN) for fast global distribution – but there's also a local fallback in your project, in case of downtimes.

## Full Answer

FreemiumKit is here to automate the cumbersome and fiddly steps in setting up and maintaining purchases for your app. Our goal is not to cover every possible pricing model, neither is it to support all technological stacks. For example, we will probably never support Android. Instead, we keep the scope focused on the most modern Apple technologies and pricing concepts.

We will always try to support all Apple platforms you can choose as a destination for your target in Xcode and keep up with the latest OS releases. We will always prefer official APIs over private APIs and keep every dependency out that is not absolutely needed. This means, we stick to official Apple APIs wherever possible.

This lead to the following current tech stack:

- Native apps for iOS, macOS, and visionOS (tvOS has no biometric authentication)
- App connects to official [App Store Connect API](https://developer.apple.com/documentation/appstoreconnectapi/) endpoints to handle purchases
- [SwiftUI](https://developer.apple.com/xcode/swiftui/) SDK targeting iOS, macOS, visionOS, and tvOS (watchOS is not a destination)
- SDK is built on top of [StoreKit 2](https://developer.apple.com/storekit/) and SwiftUI 3 (supporting iOS/tvOS 15+, macOS 12+)
- [Vapor](https://vapor.codes)-based server for push notifications when purchases are made (reported by SDK)
- [Supabase](https://supabase.com)-based Content Delivery Network (CDN) for remote configuration of paywalls
- [CloudKit](https://developer.apple.com/icloud/cloudkit/)-based persistence of purchase history in your Apple Account for backup & sync

The only non-Apple technologies here are our server and CDN. We included these dependencies in a thoughtful manner – let's suppose both are down, then:

- ❌ You would no longer receive **live push notifications** when users make purchases
- ❌ You would no longer be able to **remotely configure** your paywall or A/B test
- ✅ The Paywall UI would continue to work, using the local "fallback" configuration
- ✅ Users can continue to make purchases, as the SDK only needs StoreKit 2 for that
- ✅ Even paying users will continue to have access to paid features (via StoreKit 2)

Of course, we don't expect our servers to be down any significant amount of time. This was just to show you that we have considered all cases when designing FreemiumKit conceptually. And because all the purchases are directly configured on App Store Connect, you could even decide to move away from FreemiumKit entirely if you find our feature set does not fulfill your needs. There are no lock-in features. But beware, you will miss all our built-in conveniences! 😉

## Contact

Have questions or need support? Reach out to me at [[email protected]](mailto:[email protected]).

---

## Legal

@Small {
Cihat Gündüz © 2024. All rights reserved.
Privacy: No personal data is tracked on this site.
[Imprint](https://www.fline.dev/imprint/)
}
43 changes: 43 additions & 0 deletions Sources/FreemiumKit/FreemiumKit.docc/FAQ/FAQ-Privacy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# How does FreemiumKit handle User Privacy?

Learn how FreemiumKit was designed to keep your users data private and reduce the exposure of your purchase data to a minimum.

@Metadata {
@TitleHeading("FAQs")
@PageKind(sampleCode)
}


## Short Answer

We don't send any personal user data to our servers, respecting user privacy. And we delete purchase data from our servers as soon as they are fetched to your devices. Your purchase data is persisted via CloudKit. This ensures we can't access your purchase history.


## Full Answer

Firstly, we follow the principle of **data minimization** and don't send any personal data to our servers. The only data we send are the date and country of the purchase and the purchased product with its price. This way even if our servers were breached, there's nothing useful to be obtained for attackers.

Secondly, we **don't keep the data for long**: The moment the FreemiumKit app on your devices successfully fetch the purchase data, they are deleted from our servers. If you install FreemiumKit on your iPhone and have push notifications turned on, this happens just seconds after a purchase was made, keeping the amount of data we store on our servers close to zero basically all the time.

> Tip: All our servers are hosted within the European Union (EU), ensuring your data complies with strict EU privacy laws, including GDPR, for enhanced protection and security.
To ensure your data is backed up and syncs across devices, we use CloudKit. This way, even if you delete the FreemiumKit app or lose your device, you can just reinstall FreemiumKit on another device and your full purchase history statistics will stay available within the same Apple Account.

If you happen to stop using the FreemiumKit app for some reason, new purchases are kept up to 90 days on our servers. So you'll always be able to fetch tha last 90 days if you decide to return. If you have push notifications disabled, you need to open the app at least once every 90 days to not lose any purchase history data. If you returned after 100 days, you would lose 10 days of data, for example.

That's why we strongly recommend to **keep push notifications enabled** on FreemiumKit for iPhone, even if you don't wish to actually receive push notifications. You can turn off push notifications within the FreemiumKit app, which will disable the local push notification sent by the app while woken up in the background by a silent push notification. This way, the app will continue fetching purchase data without bothering you with push notifications.


## Contact

Have questions or need support? Reach out to me at [[email protected]](mailto:[email protected]).

---

## Legal

@Small {
Cihat Gündüz © 2024. All rights reserved.
Privacy: No personal data is tracked on this site.
[Imprint](https://www.fline.dev/imprint/)
}
36 changes: 36 additions & 0 deletions Sources/FreemiumKit/FreemiumKit.docc/FAQ/FAQ-Validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Does FreemiumKit validate purchases?

Learn how FreemiumKit deals with validation and how it helps you focus on what's important – your app's features!

@Metadata {
@TitleHeading("FAQs")
@PageKind(sampleCode)
}

## Short Answer

Yes, we handle validation automatically and only report purchases that have been verified by the App Store. No action needed on your end, it all happens within our SDK automatically.


## Full Answer

The FreemiumKit SDK is built on top of StoreKit 2, which automatically verifies any transaction is "signed by the App Store for _my_ app for _this_ device" (quote from WWDC22 session [Meet StoreKit 2](https://developer.apple.com/videos/play/wwdc2021/10114/?time=694)). StoreKit 2 leaves developers the choice to accept even unverified purchases. But FreemiumKit doesn't do that, it simply **always** ignores unverified purchases. When FreemiumKit reports a purchase, it has already successfully passed transaction verification. 💯

While StoreKit 2 makes sure a transaction is coming from Apple and has not been tampered with, it's still possible that a highly skilled attacker could tamper with the devices memory or the app logic on a jailbroken device to bypass these checks. It is possible to guard against these kinds of attacks with additional server-side validation and by moving some of the paid feature logic to your servers.

The complexity of such an attack is very high though and most apps are vulnerable to it even with server-side validation receipt validation because the attacker can simply bypass the boolean check inside the apps logic if they have this level of access to your apps code. Protecting against all potential security risks is impossible and we think that the built-in transaction verification is a good level of security for most apps.


## Contact

Have questions or need support? Reach out to me at [[email protected]](mailto:[email protected]).

---

## Legal

@Small {
Cihat Gündüz © 2024. All rights reserved.
Privacy: No personal data is tracked on this site.
[Imprint](https://www.fline.dev/imprint/)
}
31 changes: 31 additions & 0 deletions Sources/FreemiumKit/FreemiumKit.docc/FAQs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# FAQs

The most frequently asked questions about FreemiumKit.

@Metadata {
@PageImage(purpose: icon, source: "FreemiumKit")
@TitleHeading("FreemiumKit")
@PageKind(article)
}

## Topics

- <doc:FAQ-HowItWorks>
- <doc:FAQ-Privacy>
- <doc:FAQ-Validation>



## Contact

Have questions or need support? Reach out to me at [[email protected]](mailto:[email protected]).

---

## Legal

@Small {
Cihat Gündüz © 2024. All rights reserved.
Privacy: No personal data is tracked on this site.
[Imprint](https://www.fline.dev/imprint/)
}
Loading

0 comments on commit 950e87a

Please sign in to comment.