Skip to content

Commit

Permalink
Hide 'Learn More' button in the Sync paused alert when Sync UI is not…
Browse files Browse the repository at this point in the history
… visible
  • Loading branch information
ayoy committed Dec 21, 2023
1 parent 043a058 commit 0a9ecca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, FileDownloadManagerDel
if isDataSyncingAvailable {
self?.syncDidShowSyncPausedByFeatureFlagAlert = false
} else if syncService?.authState == .active, self?.syncDidShowSyncPausedByFeatureFlagAlert == false {
let alert = NSAlert.dataSyncingDisabledByFeatureFlag()
let isSyncUIVisible = syncService?.featureFlags.contains(.userInterface) == true
let alert = NSAlert.dataSyncingDisabledByFeatureFlag(showLearnMore: isSyncUIVisible)
let response = alert.runModal()
self?.syncDidShowSyncPausedByFeatureFlagAlert = true

Expand Down
6 changes: 4 additions & 2 deletions DuckDuckGo/Common/Extensions/NSAlertExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,15 @@ extension NSAlert {
return alert
}

static func dataSyncingDisabledByFeatureFlag(upgradeRequired: Bool = false) -> NSAlert {
static func dataSyncingDisabledByFeatureFlag(showLearnMore: Bool, upgradeRequired: Bool = false) -> NSAlert {
let alert = NSAlert()
alert.messageText = UserText.syncPausedTitle
alert.informativeText = upgradeRequired ? UserText.syncUnavailableMessageUpgradeRequired : UserText.syncUnavailableMessage
alert.alertStyle = .warning
alert.addButton(withTitle: UserText.ok)
alert.addButton(withTitle: UserText.learnMore)
if showLearnMore {
alert.addButton(withTitle: UserText.learnMore)
}
return alert
}

Expand Down

0 comments on commit 0a9ecca

Please sign in to comment.