Repository navigation
feat: 自前のペイウォールと RevenueCat Paywalls のペイウォールを切り替えられるようにする - #4
Merged
Merged
Conversation
- RevenueCatUI に依存するプロダクト SubscriptionRevenueCatUI を足す。 RevenueCatPaywallView と、どちらのペイウォールも同じ一か所から出す PaywallContainer を持つ。 Subscription と SubscriptionUI は RevenueCatUI に依存しないまま - SubscriptionUI に PaywallMode(.custom / .revenueCat(offering:) / .automatic(offering:))と 判定の純粋関数 PaywallMode.choice(for:) を置く。RevenueCat 側で出せない理由があれば自前に戻す - 購入・復元のあとは CustomerInfo ではなく SubscriptionUseCase に権利を問い合わせる。 設定した entitlement で判定し、EntitlementCache も更新される - PaywallHandlers で、どちらのペイウォールでも onEntitled / onError / onDismiss を同じ形で受け取る - Offering.hasPaywall を使うため、RevenueCat SDK の下限を 5.19.0 に上げる Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ESWEc4G3nTqzvj9XAFZJeV
関連値つきの case と同じ名前の static プロパティが並ぶと、型を明示しない `PaywallMode.automatic` が ambiguous になっていた。PaywallMode を struct にし、 `.custom` / `.revenueCat` / `.automatic` を static let、offering を指定する形を static func にする。型名から書く形と型を明示した代入の両方をテストで確認する。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ESWEc4G3nTqzvj9XAFZJeV
taniguchi-kyoichi
marked this pull request as ready for review
September 27, 2026 05:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
アプリが、自前のペイウォール(
SubscriptionUIのPaywallViewなど)と、RevenueCat のダッシュボードで作ったペイウォール(RevenueCatUI)を切り替えられるようにする。変更
SubscriptionRevenueCatUI。RevenueCatUI に依存するのはこのプロダクトだけRevenueCatPaywallView(offering:displayCloseButton:onEntitled:onError:onDismiss:)PaywallContainer(mode:onEntitled:onError:onDismiss:custom:):どちらのペイウォールも同じ一か所から出すRevenueCatPaywallError.offeringNotFound(String?)SubscriptionUIに追加(RevenueCatUI に依存しない)PaywallMode:.custom/.revenueCat(offering:)/.automatic(offering:)、current を指す.revenueCat/.automaticPaywallMode.choice(for: PaywallOfferingLookup) -> PaywallChoice:判定の純粋関数PaywallHandlers:onEntitled/onError/onDismissOffering.hasPaywallが入ったバージョン)判定
.custom.revenueCat.automaticunavailableは、環境にSubscriptionUseCaseが無い・Purchases.isConfiguredが false・offering の読み込みに失敗した、のいずれか。Purchases.sharedは未設定だと落ちるので、先にisConfiguredを見る。包み方(chrome)
コンテナはどちらにも枠を付けない。自前のペイウォールは
customクロージャの中で NavigationStack と閉じるボタンまで付けて返し、RevenueCat のペイウォールは自分の閉じるボタンで表示する。これで閉じるボタンが二重にならない。権利の判定
RevenueCat のペイウォールで購入・復元が終わったら、RevenueCatUI が渡す
CustomerInfoではなくSubscriptionUseCase.checkSubscriptionStatus()に問い合わせる。設定した entitlement で判定でき、EntitlementCacheも更新される。何も見つからなかった復元ではonEntitledを呼ばない。確認
swift build/swift test(XCTest 37 件、Swift Testing 13 件)xcodebuild -scheme Subscription-Package -destination 'generic/platform=iOS Simulator' buildscripts/compute-next-version.sh --baseline 2.0.0→bump=minor next=2.1.0 removed=0 added=31タグ・リリースはしない。
🤖 Generated with Claude Code
https://claude.ai/code/session_01ESWEc4G3nTqzvj9XAFZJeV