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

[Enhancement] Replace Subscribe with Follow #2356

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ public enum FeatureFlag: String, CaseIterable {
/// Push two auto downloads on subscribe of a podcast
case autoDownloadOnSubscribe

/// Replace Subscribe/Unsubscribe with Follow/Unfollow
case useFollowNaming

public var enabled: Bool {
if let overriddenValue = FeatureFlagOverrideStore().overriddenValue(for: self) {
return overriddenValue
Expand Down Expand Up @@ -229,6 +232,8 @@ public enum FeatureFlag: String, CaseIterable {
true
case .autoDownloadOnSubscribe:
true
case .useFollowNaming:
false
}
}

Expand Down
5 changes: 3 additions & 2 deletions podcasts/BundlePodcastCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import UIKit

class BundlePodcastCell: ThemeableCell {
Expand Down Expand Up @@ -28,8 +29,8 @@ class BundlePodcastCell: ThemeableCell {
subscribeButton.onImage = UIImage(named: "discover_tick")?.tintedImage(ThemeColor.support02())
subscribeButton.offImage = UIImage(named: "discover_add")?.tintedImage(ThemeColor.primaryIcon02())

subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed

NotificationCenter.default.addObserver(self, selector: #selector(podcastWasAdded), name: Constants.Notifications.podcastAdded, object: nil)
}
Expand Down
5 changes: 3 additions & 2 deletions podcasts/CategorySponsoredCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import UIKit

class CategorySponsoredCell: ThemeableCell {
Expand Down Expand Up @@ -39,8 +40,8 @@ class CategorySponsoredCell: ThemeableCell {
subscribeButton.onImage = UIImage(named: "discover_tick")
subscribeButton.offImage = UIImage(named: "discover_add")
subscribeButton.tintColor = ThemeColor.secondaryIcon01()
subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed

NotificationCenter.default.addObserver(self, selector: #selector(podcastWasAdded), name: Constants.Notifications.podcastAdded, object: nil)
}
Expand Down
5 changes: 3 additions & 2 deletions podcasts/DescriptiveCollectionCell.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import PocketCastsServer
import PocketCastsUtils
import UIKit

class DescriptiveCollectionCell: ThemeableCollectionCell {
Expand All @@ -8,8 +9,8 @@ class DescriptiveCollectionCell: ThemeableCollectionCell {
subscribeButton.onImage = UIImage(named: "discover_tick")?.tintedImage(ThemeColor.support02())
subscribeButton.offImage = UIImage(named: "discover_add")?.tintedImage(ThemeColor.primaryIcon02())

subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed
}
}

Expand Down
5 changes: 3 additions & 2 deletions podcasts/DiscoverFeaturedView.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import UIKit

class DiscoverFeaturedView: ThemeableView {
Expand Down Expand Up @@ -32,8 +33,8 @@ class DiscoverFeaturedView: ThemeableView {
subscribeButton.offImage = UIImage(named: "discover_add")
subscribeButton.tintColor = ThemeColor.contrast02()

subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed
}
}

Expand Down
5 changes: 3 additions & 2 deletions podcasts/DiscoverPodcastTableCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import UIKit

class DiscoverPodcastTableCell: ThemeableCell {
Expand Down Expand Up @@ -35,8 +36,8 @@ class DiscoverPodcastTableCell: ThemeableCell {
subscribeButton.offImage = UIImage(named: "discover_add")
subscribeButton.tintColor = ThemeColor.secondaryIcon01()

subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed

NotificationCenter.default.addObserver(self, selector: #selector(podcastWasAdded), name: Constants.Notifications.podcastAdded, object: nil)
}
Expand Down
2 changes: 1 addition & 1 deletion podcasts/FilterPreviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class FilterPreviewViewController: LargeNavBarViewController, FilterChipActionDe
@IBOutlet var noEpisodeCriteriaLabel: ThemeableLabel! {
didSet {
noEpisodeCriteriaLabel.style = .primaryText02
noEpisodeCriteriaLabel.text = L10n.filterCreateNoEpisodesDescriptionExplanation
noEpisodeCriteriaLabel.text = FeatureFlag.useFollowNaming.enabled ? L10n.filterCreateNoEpisodesDescriptionExplanationNew : L10n.filterCreateNoEpisodesDescriptionExplanation
}
}

Expand Down
3 changes: 2 additions & 1 deletion podcasts/ImportExportViewController.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import UIKit

class ImportExportViewController: PCViewController, UIDocumentInteractionControllerDelegate {
Expand All @@ -15,7 +16,7 @@ class ImportExportViewController: PCViewController, UIDocumentInteractionControl

@IBOutlet var importPodcastsDescription: ThemeableLabel! {
didSet {
importPodcastsDescription.text = L10n.importPodcastsDescription
importPodcastsDescription.text = FeatureFlag.useFollowNaming.enabled ? L10n.importPodcastsDescriptionNew : L10n.importPodcastsDescription
}
}

Expand Down
5 changes: 3 additions & 2 deletions podcasts/LargeListCell.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import PocketCastsServer
import PocketCastsUtils
import UIKit

class LargeListCell: ThemeableCollectionCell {
Expand All @@ -18,8 +19,8 @@ class LargeListCell: ThemeableCollectionCell {
subscribeButton.tintColor = ThemeColor.contrast01()
subscribeButton.backgroundColor = ThemeColor.veil()

subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed
}
}

Expand Down
3 changes: 2 additions & 1 deletion podcasts/Onboarding/Import/ImportViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Foundation
import SwiftUI
import PocketCastsUtils

class ImportViewModel: OnboardingModel {
var navigationController: UINavigationController?
Expand Down Expand Up @@ -33,7 +34,7 @@ class ImportViewModel: OnboardingModel {
.init(id: .castro, displayName: "Castro", steps: L10n.importInstructionsCastro),
.init(id: .castbox, displayName: "Castbox", steps: L10n.importInstructionsCastbox),
.init(id: .overcast, displayName: "Overcast", steps: L10n.importInstructionsOvercast),
.init(id: .other, displayName: "other apps", steps: L10n.importPodcastsDescription),
.init(id: .other, displayName: "other apps", steps: FeatureFlag.useFollowNaming.enabled ? L10n.importPodcastsDescriptionNew : L10n.importPodcastsDescription),
.init(id: .opmlFromURL, displayName: "URL", steps: L10n.importOpmlFromUrl)
]

Expand Down
5 changes: 3 additions & 2 deletions podcasts/PodcastFilterOverlayController.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import PocketCastsDataModel
import PocketCastsUtils
import UIKit

class PodcastFilterOverlayController: PodcastChooserViewController, PodcastSelectionDelegate {
Expand Down Expand Up @@ -144,9 +145,9 @@ class PodcastFilterOverlayController: PodcastChooserViewController, PodcastSelec
func setSwitchSubtitle() {
let allSelected = selectedUuids.count == allPodcasts.count
if allSelected {
headerView.subtitleLabel.text = L10n.filterAutoAddSubtitle
headerView.subtitleLabel.text = FeatureFlag.useFollowNaming.enabled ? L10n.filterAutoAddSubtitleNew : L10n.filterAutoAddSubtitle
} else {
headerView.subtitleLabel.text = L10n.filterManualAddSubtitle
headerView.subtitleLabel.text = FeatureFlag.useFollowNaming.enabled ? L10n.filterManualAddSubtitleNew : L10n.filterManualAddSubtitle
}
}

Expand Down
5 changes: 3 additions & 2 deletions podcasts/PodcastGroupCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import UIKit

class PodcastGroupCell: ThemeableCell {
Expand All @@ -20,8 +21,8 @@ class PodcastGroupCell: ThemeableCell {
didSet {
subscribeButton.onImage = UIImage(named: "discover_tick")
subscribeButton.offImage = UIImage(named: "discover_add")
subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed

subscribeButton.tintColor = ThemeColor.secondaryIcon01()
}
Expand Down
7 changes: 5 additions & 2 deletions podcasts/PodcastHeadingTableCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,11 @@ class PodcastHeadingTableCell: ThemeableCell, SubscribeButtonDelegate, Expandabl
private func setupButtons() {
guard let podcast = delegate?.displayedPodcast(), let _ = delegate?.isSummaryExpanded() else { return }

let subscribedLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed
let unsubscribedLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe

subscribeButton.isSelected = podcast.isSubscribed()
subscribeButton.accessibilityLabel = podcast.isSubscribed() ? L10n.subscribed : L10n.subscribe
subscribeButton.accessibilityLabel = podcast.isSubscribed() ? subscribedLabel : unsubscribedLabel
subscribeButton.setBackgroundColors()
if subscribeButton.isSelected {
folderButton.isHidden = !showFolderButton()
Expand Down Expand Up @@ -506,7 +509,7 @@ class PodcastHeadingTableCell: ThemeableCell, SubscribeButtonDelegate, Expandabl
self.layoutIfNeeded()
}, completion: { _ in
self.isAnimatingToSubscribed = false
self.subscribeButton.accessibilityLabel = L10n.subscribed
self.subscribeButton.accessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion podcasts/PodcastSettingsViewController+Table.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import IntentsUI
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import UIKit

extension PodcastSettingsViewController: UITableViewDataSource, UITableViewDelegate {
Expand Down Expand Up @@ -185,7 +186,7 @@ extension PodcastSettingsViewController: UITableViewDataSource, UITableViewDeleg
}
case .unsubscribe:
let cell = tableView.dequeueReusableCell(withIdentifier: PodcastSettingsViewController.destructiveButtonCellId, for: indexPath) as! DestructiveButtonCell
cell.buttonTitle.text = L10n.unsubscribe
cell.buttonTitle.text = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.unsubscribe
cell.buttonTitle.textColor = ThemeColor.support05()
return cell
}
Expand Down
4 changes: 3 additions & 1 deletion podcasts/PodcastSettingsViewController.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import DifferenceKit
import PocketCastsDataModel
import PocketCastsUtils
import UIKit

class PodcastSettingsViewController: PCViewController {
Expand Down Expand Up @@ -98,7 +99,8 @@ class PodcastSettingsViewController: PCViewController {
}
}
let optionPicker = OptionsPicker(title: downloadedCount > 0 ? nil : L10n.areYouSure)
let unsubscribeAction = OptionAction(label: L10n.unsubscribe, icon: nil, action: { [weak self] in
let label = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.unsubscribe
let unsubscribeAction = OptionAction(label: label, icon: nil, action: { [weak self] in
self?.performUnsubscribe()
})
if downloadedCount > 0 {
Expand Down
3 changes: 2 additions & 1 deletion podcasts/PodcastViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,8 @@ class PodcastViewController: FakeNavViewController, PodcastActionsDelegate, Sync
}

let optionPicker = OptionsPicker(title: downloadedCount > 0 ? nil : L10n.areYouSure)
let unsubscribeAction = OptionAction(label: L10n.unsubscribe, icon: nil, action: { [weak self] in
let label = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.unsubscribe
let unsubscribeAction = OptionAction(label: label, icon: nil, action: { [weak self] in
self?.performUnsubscribe()
})
if downloadedCount > 0 {
Expand Down
5 changes: 3 additions & 2 deletions podcasts/SinglePodcastViewController.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import PocketCastsServer
import PocketCastsUtils
import UIKit

class SinglePodcastViewController: UIViewController, DiscoverSummaryProtocol {
Expand All @@ -23,8 +24,8 @@ class SinglePodcastViewController: UIViewController, DiscoverSummaryProtocol {
subscribeButton.onImage = UIImage(named: "discover_tick")?.tintedImage(ThemeColor.support02())
subscribeButton.offImage = UIImage(named: "discover_add")?.tintedImage(ThemeColor.primaryIcon02())

subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed
}
}

Expand Down
5 changes: 3 additions & 2 deletions podcasts/SmallListCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import UIKit

class SmallListCell: ThemeableCollectionCell {
Expand All @@ -9,8 +10,8 @@ class SmallListCell: ThemeableCollectionCell {
subscribeButton.onImage = UIImage(named: "discover_tick")?.tintedImage(ThemeColor.support02())
subscribeButton.offImage = UIImage(named: "discover_add")?.tintedImage(ThemeColor.primaryIcon02())

subscribeButton.offAccessibilityLabel = L10n.subscribe
subscribeButton.onAccessibilityLabel = L10n.subscribed
subscribeButton.offAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
subscribeButton.onAccessibilityLabel = FeatureFlag.useFollowNaming.enabled ? L10n.unfollow : L10n.subscribed
}
}

Expand Down
14 changes: 14 additions & 0 deletions podcasts/Strings+Generated.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion podcasts/SubscribeButton.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import UIKit
import PocketCastsUtils

protocol SubscribeButtonDelegate: AnyObject {
func subscribeButtonTapped()
Expand All @@ -15,7 +16,7 @@ class SubscribeButton: ThemeableView {

@IBOutlet var titleLabel: ThemeableLabel! {
didSet {
titleLabel.text = L10n.subscribe
titleLabel.text = FeatureFlag.useFollowNaming.enabled ? L10n.follow : L10n.subscribe
titleLabel.style = .primaryInteractive02
}
}
Expand Down
Loading