Add remote config for donor badges
This commit is contained in:
parent
76f9c3559a
commit
355fd82e07
@ -245,7 +245,7 @@ class AppSettingsViewController: OWSTableViewController2 {
|
||||
self?.showInviteFlow()
|
||||
}
|
||||
))
|
||||
if FeatureFlags.subscriptions {
|
||||
if RemoteConfig.donorBadgeAcquisition {
|
||||
if DonationUtilities.isApplePayAvailable {
|
||||
section4.add(.disclosureItem(
|
||||
icon: .settingsDonate,
|
||||
|
||||
@ -123,7 +123,7 @@ class ProfileSettingsViewController: OWSTableViewController2 {
|
||||
self.presentFormSheet(OWSNavigationController(rootViewController: vc), animated: true)
|
||||
}
|
||||
))
|
||||
if FeatureFlags.configureBadges, !allBadges.isEmpty {
|
||||
if RemoteConfig.donorBadgeDisplay, !allBadges.isEmpty {
|
||||
mainSection.add(.disclosureItem(
|
||||
icon: .settingsBadges,
|
||||
name: NSLocalizedString(
|
||||
|
||||
@ -89,7 +89,7 @@ public class SignalServiceProfile: NSObject {
|
||||
|
||||
self.credential = try params.optionalBase64EncodedData(key: "credential")
|
||||
|
||||
if FeatureFlags.fetchAndDisplayBadges,
|
||||
if RemoteConfig.donorBadgeDisplay,
|
||||
let badgeArray: [[String: Any]] = try params.optional(key: "badges") {
|
||||
self.badges = badgeArray.compactMap {
|
||||
do {
|
||||
|
||||
@ -233,15 +233,6 @@ public class FeatureFlags: BaseFlags {
|
||||
@objc
|
||||
public static let canUseNativeWebsocket = false
|
||||
|
||||
@objc
|
||||
public static let fetchAndDisplayBadges = build.includes(.qa)
|
||||
|
||||
@objc
|
||||
public static let configureBadges = build.includes(.qa)
|
||||
|
||||
@objc
|
||||
public static let subscriptions = build.includes(.qa)
|
||||
|
||||
@objc
|
||||
public static var notificationServiceExtension: Bool {
|
||||
// The CallKit APIs for the NSE are only available from iOS 14.5 and on,
|
||||
@ -471,6 +462,12 @@ public class DebugFlags: BaseFlags {
|
||||
@objc
|
||||
public static let forceViewedReceiptSending = true
|
||||
|
||||
@objc
|
||||
public static let forceDonorBadgeDisplay = build.includes(.beta)
|
||||
|
||||
@objc
|
||||
public static let forceDonorBadgeAcquisition = build.includes(.beta)
|
||||
|
||||
@objc
|
||||
public static let extraDebugLogs = build.includes(.openPreview)
|
||||
|
||||
|
||||
@ -189,6 +189,16 @@ public class RemoteConfig: BaseFlags {
|
||||
interval(.messageSendLogEntryLifetime, defaultInterval: 2 * kWeekInterval)
|
||||
}
|
||||
|
||||
@objc
|
||||
public static var donorBadgeDisplay: Bool {
|
||||
DebugFlags.forceDonorBadgeDisplay || isEnabled(.donorBadgeDisplay)
|
||||
}
|
||||
|
||||
@objc
|
||||
public static var donorBadgeAcquisition: Bool {
|
||||
DebugFlags.forceDonorBadgeAcquisition || isEnabled(.donorBadgeAcquisition)
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
||||
private static func interval(
|
||||
@ -376,6 +386,8 @@ private struct Flags {
|
||||
case viewedReceiptSending
|
||||
case senderKeyKillSwitch
|
||||
case messageResendKillSwitch
|
||||
case donorBadgeDisplay
|
||||
case donorBadgeAcquisition
|
||||
}
|
||||
|
||||
// Values defined in this array remain set once they are
|
||||
|
||||
@ -528,7 +528,7 @@ public enum ConversationAvatarDataSource: Equatable, Dependencies, CustomStringC
|
||||
// TODO: Badges — Should this be async?
|
||||
fileprivate func fetchBadge(configuration: ConversationAvatarView.Configuration, transaction: SDSAnyReadTransaction?) -> UIImage? {
|
||||
guard configuration.addBadgeIfApplicable else { return nil }
|
||||
guard FeatureFlags.fetchAndDisplayBadges else {
|
||||
guard RemoteConfig.donorBadgeDisplay else {
|
||||
Logger.warn("Ignoring badge request. Badge flag currently disabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user