sub.club shuts down

This commit is contained in:
lumaa-dev 2024-12-14 01:51:45 +01:00
parent 42fa1eaf3d
commit 6b33ecde3f
4 changed files with 18 additions and 142 deletions

View File

@ -291,7 +291,7 @@ struct CompactPostView: View {
}
}
// MARK: - Sub Club integration
// TODO: Different bgs for diff appearences
@ViewBuilder
private func postBackground() -> some View {
@ -302,7 +302,7 @@ struct CompactPostView: View {
startPoint: .topTrailing,
endPoint: .bottomLeading
)
.opacity(0.2)
.opacity(0.2) // keeping this as reference
} else {
Color.appBackground
}

View File

@ -146,13 +146,13 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "About sub.club"
"value" : "Tribute to sub.club"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "À propos de sub.club"
"value" : "Hommage à sub.club"
}
}
}
@ -718,38 +718,6 @@
}
}
},
"account.subclub.subscribe" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Subscribe via Sub Club"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Sabonner via Sub Club"
}
}
}
},
"account.subclub.subscribed" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Subscribed"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Abonné"
}
}
}
},
"account.unblock" : {
"localizations" : {
"en" : {
@ -1784,35 +1752,35 @@
}
},
"info.subclub.collaboration" : {
"comment" : "sub.club is a COLLAB, precisely",
"comment" : "sub.club is a COLLAB, precisely. They don't work together",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This feature is from a collaboration between sub.club and Bubble"
"value" : "This feature was from a collaboration between sub.club and Bubble, sub.club and Bubble do not operate together."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Cette fonctionnalité provient dune collaboration entre sub.club et Bubble"
"value" : "Cette fonctionnalité provient dune collaboration entre sub.club et Bubble, sub.club et Bubble nopèrent pas ensemble."
}
}
}
},
"info.subclub.description" : {
"comment" : "Explain that sub.club is NOT attached to Bubble or Lumaa, and explain sub.club's concept",
"comment" : "Explain that sub.club is NOT attached to Bubble or Lumaa, and explain sub.club's concept. // SUB.CLUB WAS SHUT DOWN \\\\",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "sub.club is a third-party service that allows Mastodon accounts to be premium accounts"
"value" : "sub.club was a third-party service that allows Mastodon accounts to be premium accounts. It was shut down in January 2025; this about page will remain as a tribute."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "sub.club est un service tiers qui permet à des comptes Mastodon dêtre des comptes payants"
"value" : "sub.club est un service tiers qui permet à des comptes Mastodon dêtre des comptes payants. sub.club à été arrêté en janvier 2025; cette page dinformation restera en tant quhommage."
}
}
}
@ -1994,7 +1962,6 @@
}
},
"learn.subclub" : {
"comment" : "This is a button that brings to the sub.club website",
"localizations" : {
"en" : {
"stringUnit" : {

View File

@ -36,19 +36,6 @@ struct ProfileView: View {
@State public var account: Account
var isCurrent: Bool = false
//MARK: Sub Club
/// Account ACCT ends with `sub.club`
private var isSubClub: Bool {
account.acct.split(separator: "@").last == "sub.club"
}
/// Account field that may contain `sub.club` user
private var hasSubClub: Account.Field? {
account.fields.filter({ $0.value.asRawText.contains(/(@)?[A-Za-z0-9_]+@sub\.club/) }).first
}
/// Subscribed to the Sub Club account
@State private var isSubscribed: Bool = false
var body: some View {
ZStack (alignment: .center) {
if account != Account.placeholder() {
@ -158,50 +145,6 @@ struct ProfileView: View {
.font(.callout)
VStack {
if let field = hasSubClub, (canFollow ?? true) == true {
Button {
guard !isSubscribed, let extracted = field.extractSubclub(), let usrnme: Substring = extracted.split(separator: "@").first, let userAcc = accountManager.getAccount(), let cliAcc = accountManager.getClient() else {
return
}
let subclubUrl: URL = URL(
string: "https://sub.club/@\(usrnme)/subscribe?callback=threadedapp://subclub&id=@\(userAcc.username)@\(cliAcc.server)&theme=dark"
)!
uniNav.presentedSheet = .safari(url: subclubUrl)
} label: {
HStack {
Spacer()
Text(isSubscribed ? "account.subclub.subscribed" : "account.subclub.subscribe")
.font(.callout)
Spacer()
}
}
.buttonStyle(LargeButton(filled: true, filledColor: Color.subClub, height: 10))
.disabled(isSubscribed)
}
if isSubClub && (canFollow ?? true) == true {
Button {
guard !isSubscribed, let userAcc = accountManager.getAccount(), let cliAcc = accountManager.getClient() else {
return
}
let subclubUrl: URL = URL(
string: "https://sub.club/@\(account.username)/subscribe?callback=threadedapp://subclub&id=@\(userAcc.username)@\(cliAcc.server)&theme=dark"
)!
uniNav.presentedSheet = .safari(url: subclubUrl)
} label: {
HStack {
Spacer()
Text(isSubscribed ? "account.subclub.subscribed" : "account.subclub.subscribe")
.font(.callout)
Spacer()
}
}
.buttonStyle(LargeButton(filled: true, filledColor: Color.subClub, height: 10))
.disabled(isSubscribed)
}
// MARK: Follow button
if (canFollow ?? true) == true {
HStack (spacing: 5) {
@ -387,11 +330,7 @@ struct ProfileView: View {
if let ref: Account = try? await client.get(endpoint: Accounts.accounts(id: accId)) {
account = ref
if let subClubAcc = await getSubclubAccount() {
await updateRelationship(with: [subClubAcc.id], subClubId: subClubAcc.id)
} else {
await updateRelationship()
}
await updateRelationship()
loadingStatuses = true
statuses = try? await client.get(endpoint: Accounts.statuses(id: accId, sinceId: nil, tag: nil, onlyMedia: nil, excludeReplies: nil, pinned: nil))
@ -488,7 +427,7 @@ struct ProfileView: View {
}
}
func updateRelationship(with other: [String] = [], subClubId: String? = nil) async {
func updateRelationship(with other: [String] = []) async {
if let client = accountManager.getClient() {
if let currentAccount: Account = try? await client.get(endpoint: Accounts.verifyCredentials) {
canFollow = currentAccount.id != account.id
@ -506,14 +445,6 @@ struct ProfileView: View {
accountNotify = rel.notifying
accountMuted = rel.muting
accountBlocked = rel.blocking
if let subClubId {
guard let subClubRel: Relationship = relationship.filter({ $0.id == subClubId }).first else {
fatalError("The SubClub Relationship ID doesn't match")
}
isSubscribed = subClubRel.following
}
}
} else {
canFollow = false
@ -521,25 +452,6 @@ struct ProfileView: View {
}
}
private func getSubclubAccount() async -> Account? {
if let field = hasSubClub, let acct = field.extractSubclub(), let client = accountManager.getClient() {
if let res: SearchResults = try? await client.post(
endpoint: Search.accountsSearch(query: acct, type: nil, offset: 0, following: nil)
), !res.isEmpty, !res.accounts.isEmpty {
let subclub = res.accounts.first!
return subclub
}
} else if isSubClub, let client = accountManager.getClient(), let server = account.acct.split(separator: "@").last {
if let res: SearchResults = try? await client.post(
endpoint: Search.accountsSearch(query: "\(account.username)@\(server)", type: nil, offset: 0, following: nil)
), !res.isEmpty, !res.accounts.isEmpty {
let subclub = res.accounts.first!
return subclub
}
}
return nil
}
var loading: some View {
ScrollView {
VStack {
@ -600,13 +512,12 @@ struct ProfileView: View {
} label: {
Text("\(server.description)")
.font(.caption)
.foregroundStyle(!isSubClub ? Color.gray : Color.subClub)
.foregroundStyle(Color.gray)
.multilineTextAlignment(.leading)
.lineLimit(1)
.minimumScaleFactor(0.7)
.pill(tint: !isSubClub ? Color(uiColor: UIColor.label) : Color.subClub)
.pill(tint: Color(uiColor: UIColor.label))
}
.disabled(!isSubClub)
} else {
Text("\(account.username)")
.font(.body)
@ -620,13 +531,12 @@ struct ProfileView: View {
} label: {
Text("\(client?.server ?? "???")")
.font(.caption)
.foregroundStyle(!isSubClub ? Color.gray : Color.subClub)
.foregroundStyle(Color.gray)
.multilineTextAlignment(.leading)
.lineLimit(1)
.minimumScaleFactor(0.7)
.pill(tint: !isSubClub ? Color(uiColor: UIColor.label) : Color.subClub)
.pill(tint: Color(uiColor: UIColor.label))
}
.disabled(!isSubClub)
}
} else {
Text("\(account.username)")
@ -638,13 +548,12 @@ struct ProfileView: View {
} label: {
Text("\(client?.server ?? "???")")
.font(.caption)
.foregroundStyle(!isSubClub ? Color.gray : Color.subClub)
.foregroundStyle(Color.gray)
.multilineTextAlignment(.leading)
.lineLimit(1)
.minimumScaleFactor(0.7)
.pill()
}
.disabled(!isSubClub)
}
}
}

View File

@ -43,7 +43,7 @@ struct UpdateView: View {
newFeature(systemImage: "play.square", title: "Video attachments", text: "Play a video while listening to CHROMAKOPIA, it won't stop it anymore. Play, pause, mute...")
newFeature(systemImage: "person.text.rectangle", title: "Article author", text: "Some news articles will show the account of the writer, like The Verge for example.")
newFeature(image: "SubClubMark", title: "Adieu, sub.club", text: "The owners of sub.club are shutting it down this month. The Bubble integration has been removed.")
}
.frame(height: 500)
}