Skip to content

Commit

Permalink
[MBL-1439] Remove 'Block Users' Feature Flag (#2059)
Browse files Browse the repository at this point in the history
* remove flag

* Update testRemoteConfigFeatureFlagToolsViewController.1.png
  • Loading branch information
scottkicks authored May 15, 2024
1 parent 761a562 commit 2d7d832
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ final class CommentRepliesViewController: UITableViewController, MessageBannerVi

private func handleCommentCellHeaderTapped(in cell: UITableViewCell, _ author: Comment.Author) {
guard
featureBlockUsersEnabled(),
let currentUser = AppEnvironment.current.currentUser,
String(currentUser.id) != author.id,
!author.isBlocked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ extension CommentsViewController {
extension CommentsViewController: CommentCellDelegate {
func commentCellDidTapHeader(_ cell: CommentCell, _ author: Comment.Author) {
guard
featureBlockUsersEnabled(),
let currentUser = AppEnvironment.current.currentUser,
String(currentUser.id) != author.id,
!author.isBlocked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ final class CommentCell: UITableViewCell, ValueCell {
self.viewRepliesView.isAccessibilityElement = true
self.viewRepliesView.accessibilityTraits.insert(.button)
self.commentCellHeaderStackView.isAccessibilityElement = true
if featureBlockUsersEnabled() {
self.commentCellHeaderStackView.accessibilityTraits.insert(.button)
}
self.commentCellHeaderStackView.accessibilityTraits.insert(.button)
self.commentCellHeaderStackView.postTimeLabel.isAccessibilityElement = true
self.bodyTextView.isAccessibilityElement = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ final class RootCommentCell: UITableViewCell, ValueCell {
self.bodyTextView
]
self.commentCellHeaderStackView.isAccessibilityElement = true
if featureBlockUsersEnabled() {
self.commentCellHeaderStackView.accessibilityTraits.insert(.button)
}
self.commentCellHeaderStackView.accessibilityTraits.insert(.button)
self.commentCellHeaderStackView.postTimeLabel.isAccessibilityElement = true
self.bodyTextView.isAccessibilityElement = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ extension MessagesViewController: BackingCellDelegate {
extension MessagesViewController: MessageCellDelegate {
func messageCellDidTapHeader(_ cell: MessageCell, _ user: User) {
guard
featureBlockUsersEnabled(),
let currentUser = AppEnvironment.current.currentUser,
currentUser != user,
!user.isBlocked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ internal final class MessageCell: UITableViewCell, ValueCell {

private func configureAccessibilityElements() {
self.participantStackView.isAccessibilityElement = true
if featureBlockUsersEnabled() {
self.participantStackView.accessibilityTraits.insert(.button)
}
self.participantStackView.accessibilityTraits.insert(.button)
self.timestampLabel.isAccessibilityElement = true
self.bodyTextView.isAccessibilityElement = true
self.isAccessibilityElement = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ extension ProjectPageViewController: ProjectPamphletMainCellDelegate {
goToCreatorForProject project: Project
) {
guard
featureBlockUsersEnabled(),
let currentUser = AppEnvironment.current.currentUser,
currentUser != project.creator,
!project.creator.isBlocked
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions Library/RemoteConfig/RemoteConfigFeature+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ private func featureEnabled(feature: RemoteConfigFeature, defaultValue: Bool = f
return defaultValue
}

public func featureBlockUsersEnabled() -> Bool {
return featureEnabled(feature: .blockUsersEnabled)
}

public func featureConsentManagementDialogEnabled() -> Bool {
return featureEnabled(feature: .consentManagementDialogEnabled)
}
Expand Down
16 changes: 0 additions & 16 deletions Library/RemoteConfig/RemoteConfigFeature+HelpersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,6 @@ final class RemoteConfigFeatureHelpersTests: TestCase {
}
}

func testBlockUsers_RemoteConfig_FeatureFlag_False() {
self
.assert(
featureFlagIsFalse: featureBlockUsersEnabled,
whenRemoteConfigFeatureIsFalse: .blockUsersEnabled
)
}

func testBlockUsers_RemoteConfig_FeatureFlag_True() {
self
.assert(
featureFlagIsTrue: featureBlockUsersEnabled,
whenRemoteConfigFeatureIsTrue: .blockUsersEnabled
)
}

func testConsentManagementDialog_RemoteConfig_FeatureFlag_False() {
self
.assert(
Expand Down
2 changes: 0 additions & 2 deletions Library/RemoteConfig/RemoteConfigFeature.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Foundation

public enum RemoteConfigFeature: String, CaseIterable {
case blockUsersEnabled = "block_users"
case consentManagementDialogEnabled = "consent_management_dialog"
case darkModeEnabled = "dark_mode"
case facebookLoginInterstitialEnabled = "facebook_interstitial"
Expand All @@ -14,7 +13,6 @@ public enum RemoteConfigFeature: String, CaseIterable {
extension RemoteConfigFeature: CustomStringConvertible {
public var description: String {
switch self {
case .blockUsersEnabled: return "Block Users"
case .consentManagementDialogEnabled: return "Consent Management Dialog"
case .darkModeEnabled: return "Dark Mode"
case .facebookLoginInterstitialEnabled: return "Facebook Login Interstitial"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ public final class RemoteConfigFeatureFlagToolsViewModel: RemoteConfigFeatureFla

private func isFeatureEnabled(_ feature: RemoteConfigFeature) -> Bool {
switch feature {
case .blockUsersEnabled:
return featureBlockUsersEnabled()
case .consentManagementDialogEnabled:
return featureConsentManagementDialogEnabled()
case .darkModeEnabled:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ final class RemoteConfigFlagToolsViewModelTests: TestCase {
func testUpdateUserDefaultsWithFeatures_ReloadWithData_UserDefaultsIsUpdated() {
let mockRemoteConfigClient = MockRemoteConfigClient()
|> \.features .~ [
RemoteConfigFeature.blockUsersEnabled.rawValue: false
RemoteConfigFeature.consentManagementDialogEnabled.rawValue: false
]

withEnvironment(remoteConfigClient: mockRemoteConfigClient, userDefaults: userDefaults) {
Expand All @@ -112,7 +112,7 @@ final class RemoteConfigFlagToolsViewModelTests: TestCase {
userDefaults
.dictionary(forKey: "com.kickstarter.KeyValueStoreType.remoteConfigFeatureFlags") as? [String: Bool],
[
RemoteConfigFeature.blockUsersEnabled.rawValue: true
RemoteConfigFeature.consentManagementDialogEnabled.rawValue: true
]
)
}
Expand Down

0 comments on commit 2d7d832

Please sign in to comment.