Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workaround to allow using proxy URL in Local.xcconfig #4810

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Local.xcconfig.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@
// Set your RevenueCat API key for local development here (without quotes!):
// REVENUECAT_API_KEY = your-api-key-without-quotes

// Set your your RevenueCat Proxy URL for local development here (without quotes!):
// REVENUECAT_PROXY_URL = your-revenuecat-proxy-url-without-quotes
// Set your your RevenueCat Proxy URL scheme and host for local development here (without quotes!):
// REVENUECAT_PROXY_URL_SCHEME = http
// REVENUECAT_PROXY_URL_HOST = localhost:9000

// Because two slashes are interpreted as a comment in this file, the scheme and host need to be set separately
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ enum Constants {
REVENUECAT_PROXY_URL = your-api-key
*/
static let proxyURL: String? = {
Bundle.main.object(forInfoDictionaryKey: "REVENUECAT_PROXY_URL") as? String
guard
var scheme = Bundle.main.object(forInfoDictionaryKey: "REVENUECAT_PROXY_URL_SCHEME") as? String,
let host = Bundle.main.object(forInfoDictionaryKey: "REVENUECAT_PROXY_URL_HOST") as? String else {
return nil
}
if !scheme.hasSuffix(":") {
scheme.append(":")
}
return "\(scheme)//\(host)"
}()
}
6 changes: 4 additions & 2 deletions Tests/TestingApps/PaywallsTester/PaywallsTester/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
</dict>
<key>REVENUECAT_API_KEY</key>
<string>$(REVENUECAT_API_KEY)</string>
<key>REVENUECAT_PROXY_URL</key>
<string>$(REVENUECAT_PROXY_URL)</string>
<key>REVENUECAT_PROXY_URL_HOST</key>
<string>$(REVENUECAT_PROXY_URL_HOST)</string>
<key>REVENUECAT_PROXY_URL_SCHEME</key>
<string>$(REVENUECAT_PROXY_URL_SCHEME)</string>
</dict>
</plist>