Refactor proxy url

This commit is contained in:
Thomas Ricouard 2024-06-15 09:45:38 +02:00
parent c8c379281f
commit 3e14a92b7d
4 changed files with 4 additions and 3 deletions

View file

@ -56,7 +56,7 @@ private struct SafariRouter: ViewModifier {
UIApplication.shared.open(url)
return .handled
}
} else if url.host() == "social-proxy.com", let accountName = appAccount.currentAccount.accountName {
} else if url.host() == AppInfo.premiumInstance, let accountName = appAccount.currentAccount.accountName {
let newURL = url.appending(queryItems: [
.init(name: "callback", value: "icecubesapp://socialproxy"),
.init(name: "id", value: "@\(accountName)")

View file

@ -125,7 +125,7 @@ struct TipSheetView: View {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
if let selectedTip,
let accountName = appAccount.currentAccount.accountName,
let url = URL(string: "https://social-proxy.com/subscribe/to/\(account.username)?callback=icecubesapp://socialproxy&id=@\(accountName)&amount=\(selectedTip)&currency=USD") {
let url = URL(string: "https://\(AppInfo.premiumInstance)/subscribe/to/\(account.username)?callback=icecubesapp://socialproxy&id=@\(accountName)&amount=\(selectedTip)&currency=USD") {
openURL(url)
}
}

View file

@ -72,7 +72,7 @@ public final class Account: Codable, Identifiable, Hashable, Sendable, Equatable
}
public var isProAccount: Bool {
url?.host() == "social-proxy.com"
url?.host() == AppInfo.premiumInstance
}
public var fullAccountName: String {

View file

@ -9,4 +9,5 @@ public enum AppInfo {
public static let revenueCatKey = "appl_JXmiRckOzXXTsHKitQiicXCvMQi"
public static let defaultServer = "mastodon.social"
public static let keychainGroup = "346J38YKE3.com.thomasricouard.IceCubesApp"
public static let premiumInstance = "social-proxy.com"
}