Skip to content

Commit

Permalink
Display warning icon in Sync Settings cell when data syncing is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Dec 20, 2023
1 parent 4240dd5 commit c15b7ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion DuckDuckGo/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ class SettingsViewController: UITableViewController {

private func configureSyncCell() {
syncCell.textLabel?.text = "Sync & Backup"
if SyncBookmarksAdapter.isSyncBookmarksPaused || SyncCredentialsAdapter.isSyncCredentialsPaused {
let isDataSyncingDisabled = !syncService.featureFlags.contains(.dataSyncing) && syncService.authState == .active
if SyncBookmarksAdapter.isSyncBookmarksPaused || SyncCredentialsAdapter.isSyncCredentialsPaused || isDataSyncingDisabled {
syncCell.textLabel?.text = "⚠️ " + "Sync & Backup"
}
syncCell.isHidden = !shouldShowSyncCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ struct UserText {
static let fetchFaviconsOnboardingButtonTitle = NSLocalizedString("fetch.favicons.onboarding.button.title", value: "Keep Bookmarks Icons Updated", comment: "Fetch Favicons Onboarding - Button Title")

// Sync Feature Flags
static let serviceUnavailable = NSLocalizedString("sync.warning.service.unavailable", value: "Service Unavailable", comment: "Title of the warning message")
static let warningSyncDisabled = NSLocalizedString("sync.warning.sync.disabled", value: "We apologize, but the service is currently unavailable. Please try again later.", comment: "Sync unavailable warning message")
static let warningAccountCreationDisabled = NSLocalizedString("sync.warning.account.creation.disabled", value: "We apologize, but new account creation is currently unavailable for this service. Please try again later.", comment: "Sync unavailable warning message")
static let syncUnavailableTitle = NSLocalizedString("sync.warning.sync.unavailable", value: "Sync & Backup is Unavailable", comment: "Title of the warning message")
static let syncPausedTitle = NSLocalizedString("sync.warning.sync.paused", value: "Sync & Backup is Paused", comment: "Title of the warning message")
static let syncUnavailableMessage = NSLocalizedString("sync.warning.data.syncing.disabled", value: "Sorry, but Sync & Backup is currently unavailable. Please try again later.", comment: "Data syncing unavailable warning message")
static let syncUnavailableMessageUpgradeRequired = NSLocalizedString("sync.warning.data.syncing.disabled.upgrade.required", value: "Sorry, but Sync & Backup is no longer available in this app version. Please update DuckDuckGo to the latest version to continue.", comment: "Data syncing unavailable warning message")

// swiftlint:enable line_length
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ extension SyncSettingsView {

@ViewBuilder
fileprivate func syncUnavailableViewWhileLoggedOut() -> some View {
if !model.isDataSyncingAvailable || !model.isConnectingDevicesAvailable {
SyncWarningMessageView(title: UserText.serviceUnavailable, message: UserText.warningSyncDisabled)
} else if !model.isAccountCreationAvailable {
SyncWarningMessageView(title: UserText.serviceUnavailable, message: UserText.warningAccountCreationDisabled)
if !model.isDataSyncingAvailable || !model.isConnectingDevicesAvailable || !model.isAccountCreationAvailable {
SyncWarningMessageView(title: UserText.syncUnavailableTitle, message: UserText.syncUnavailableMessage)
} else {
EmptyView()
}
Expand Down Expand Up @@ -182,7 +180,7 @@ extension SyncSettingsView {
if model.isDataSyncingAvailable {
EmptyView()
} else {
SyncWarningMessageView(title: UserText.serviceUnavailable, message: UserText.warningSyncDisabled)
SyncWarningMessageView(title: UserText.syncPausedTitle, message: UserText.syncUnavailableMessage)
}
}

Expand Down

0 comments on commit c15b7ec

Please sign in to comment.