From 6b33ecde3fed4cbdfeaeeef9ef07cf915314e270 Mon Sep 17 00:00:00 2001 From: lumaa-dev Date: Sat, 14 Dec 2024 01:51:45 +0100 Subject: [PATCH] sub.club shuts down --- Bubble/Components/Post/CompactPostView.swift | 4 +- Bubble/Localizable.xcstrings | 49 ++------- Bubble/Views/Profile/ProfileView.swift | 105 ++----------------- Bubble/Views/Settings/UpdateView.swift | 2 +- 4 files changed, 18 insertions(+), 142 deletions(-) diff --git a/Bubble/Components/Post/CompactPostView.swift b/Bubble/Components/Post/CompactPostView.swift index c548c89..cf6fa52 100644 --- a/Bubble/Components/Post/CompactPostView.swift +++ b/Bubble/Components/Post/CompactPostView.swift @@ -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 } diff --git a/Bubble/Localizable.xcstrings b/Bubble/Localizable.xcstrings index 61c9ad7..06e746e 100644 --- a/Bubble/Localizable.xcstrings +++ b/Bubble/Localizable.xcstrings @@ -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" : "S’abonner 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 d’une collaboration entre sub.club et Bubble" + "value" : "Cette fonctionnalité provient d’une collaboration entre sub.club et Bubble, sub.club et Bubble n’opè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 d’information restera en tant qu’hommage." } } } @@ -1994,7 +1962,6 @@ } }, "learn.subclub" : { - "comment" : "This is a button that brings to the sub.club website", "localizations" : { "en" : { "stringUnit" : { diff --git a/Bubble/Views/Profile/ProfileView.swift b/Bubble/Views/Profile/ProfileView.swift index 7a2f766..e87b9c3 100644 --- a/Bubble/Views/Profile/ProfileView.swift +++ b/Bubble/Views/Profile/ProfileView.swift @@ -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) } } } diff --git a/Bubble/Views/Settings/UpdateView.swift b/Bubble/Views/Settings/UpdateView.swift index 8a07cf9..955155d 100644 --- a/Bubble/Views/Settings/UpdateView.swift +++ b/Bubble/Views/Settings/UpdateView.swift @@ -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) }