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

Hide Open Settings in Mark As Read confirmation #4402

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
16 changes: 11 additions & 5 deletions iOS/Timeline/MarkAsReadAlertController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ struct MarkAsReadAlertController {
completion: @escaping (UIAlertAction) -> Void) -> UIAlertController where T: MarkAsReadAlertControllerSourceType {


let hasShownAlertKey = "hasShownMarkAsReadAlert"
let hasShownAlert = UserDefaults.standard.bool(forKey: hasShownAlertKey)

let title = NSLocalizedString("Mark As Read", comment: "Mark As Read")
let message = NSLocalizedString("You can turn this confirmation off in Settings.",
let message = hasShownAlert ? nil : NSLocalizedString("You can turn this confirmation off in Settings.",
comment: "You can turn this confirmation off in Settings.")
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
let settingsTitle = NSLocalizedString("Open Settings", comment: "Open Settings")
Expand All @@ -56,13 +59,16 @@ struct MarkAsReadAlertController {
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel) { _ in
cancelCompletion?()
}
let settingsAction = UIAlertAction(title: settingsTitle, style: .default) { _ in
coordinator.showSettings(scrollToArticlesSection: true)
}
let markAction = UIAlertAction(title: confirmTitle, style: .default, handler: completion)

alertController.addAction(markAction)
alertController.addAction(settingsAction)
if (!hasShownAlert) {
let settingsAction = UIAlertAction(title: settingsTitle, style: .default) { _ in
coordinator.showSettings(scrollToArticlesSection: true)
}
alertController.addAction(settingsAction)
UserDefaults.standard.set(true, forKey: hasShownAlertKey)
}
alertController.addAction(cancelAction)

if let barButtonItem = sourceType as? UIBarButtonItem {
Expand Down