From de6bf608ca49d4fa86b391331461e04b476d6d6b Mon Sep 17 00:00:00 2001 From: Chris Brind Date: Fri, 13 Oct 2023 14:12:46 +0100 Subject: [PATCH] swiftlint --- DuckDuckGo/MainViewController+Email.swift | 3 ++- DuckDuckGo/TabViewController.swift | 13 +++++++++---- .../TabViewControllerBrowsingMenuExtension.swift | 3 ++- ...abViewControllerLongPressBookmarkExtension.swift | 9 ++++++--- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/DuckDuckGo/MainViewController+Email.swift b/DuckDuckGo/MainViewController+Email.swift index 1298a7fe0f..f73acd45e6 100644 --- a/DuckDuckGo/MainViewController+Email.swift +++ b/DuckDuckGo/MainViewController+Email.swift @@ -49,8 +49,9 @@ extension MainViewController { } let pasteBoard = UIPasteboard.general pasteBoard.string = emailManager.emailAddressFor(alias) + let addressBarBottom = self.appSettings.currentAddressBarPosition.isBottom ActionMessageView.present(message: UserText.emailBrowsingMenuAlert, - presentationLocation: .withBottomBar(andAddressBarBottom: self.appSettings.currentAddressBarPosition.isBottom)) + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom)) } } } diff --git a/DuckDuckGo/TabViewController.swift b/DuckDuckGo/TabViewController.swift index dca71a682c..2ba270fa41 100644 --- a/DuckDuckGo/TabViewController.swift +++ b/DuckDuckGo/TabViewController.swift @@ -813,8 +813,9 @@ class TabViewController: UIViewController { delegate?.tabLoadingStateDidChange(tab: self) UIApplication.shared.open(url, options: [:]) { opened in if !opened { + let addressBarBottom = self.appSettings.currentAddressBarPosition.isBottom ActionMessageView.present(message: UserText.failedToOpenExternally, - presentationLocation: .withBottomBar(andAddressBarBottom: self.appSettings.currentAddressBarPosition.isBottom)) + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom)) } // just showing a blank tab at this point, so close it @@ -1849,7 +1850,9 @@ extension TabViewController { let downloadWasCancelled = nserror.domain == "NSURLErrorDomain" && nserror.code == -999 if !downloadWasCancelled { - ActionMessageView.present(message: UserText.messageDownloadFailed, presentationLocation: .withBottomBar(andAddressBarBottom: appSettings.currentAddressBarPosition.isBottom)) + let addressBarBottom = self.appSettings.currentAddressBarPosition.isBottom + ActionMessageView.present(message: UserText.messageDownloadFailed, + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom)) } return @@ -1860,8 +1863,9 @@ extension TabViewController { DispatchQueue.main.async { if !download.temporary { let attributedMessage = DownloadActionMessageViewHelper.makeDownloadFinishedMessage(for: download) + let addressBarBottom = self.appSettings.currentAddressBarPosition.isBottom ActionMessageView.present(message: attributedMessage, numberOfLines: 2, actionTitle: UserText.actionGenericShow, - presentationLocation: .withBottomBar(andAddressBarBottom: self.appSettings.currentAddressBarPosition.isBottom), + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom), onAction: { Pixel.fire(pixel: .downloadsListOpened, withAdditionalParameters: [PixelParameters.originatedFromMenu: "0"]) @@ -2476,9 +2480,10 @@ extension TabViewController: SaveLoginViewControllerDelegate { if let newCredential = try vault.websiteCredentialsFor(accountId: credentialID) { DispatchQueue.main.async { + let addressBarBottom = self.appSettings.currentAddressBarPosition.isBottom ActionMessageView.present(message: message, actionTitle: UserText.autofillLoginSaveToastActionButton, - presentationLocation: .withBottomBar(andAddressBarBottom: self.appSettings.currentAddressBarPosition.isBottom), + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom), onAction: { self.showLoginDetails(with: newCredential.account) diff --git a/DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift b/DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift index 36f5b83804..5803357ea7 100644 --- a/DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift +++ b/DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift @@ -54,8 +54,9 @@ extension TabViewController { } Pixel.fire(pixel: .browsingMenuCopy) + let addressBarBottom = strongSelf.appSettings.currentAddressBarPosition.isBottom ActionMessageView.present(message: UserText.actionCopyMessage, - presentationLocation: .withBottomBar(andAddressBarBottom: strongSelf.appSettings.currentAddressBarPosition.isBottom)) + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom)) })) entries.append(BrowsingMenuEntry.regular(name: UserText.actionPrint, image: UIImage(named: "Print-24")!, action: { [weak self] in diff --git a/DuckDuckGo/TabViewControllerLongPressBookmarkExtension.swift b/DuckDuckGo/TabViewControllerLongPressBookmarkExtension.swift index 99bbddf90e..54f825f339 100644 --- a/DuckDuckGo/TabViewControllerLongPressBookmarkExtension.swift +++ b/DuckDuckGo/TabViewControllerLongPressBookmarkExtension.swift @@ -35,21 +35,24 @@ extension TabViewController { syncService.scheduler.notifyDataChanged() DispatchQueue.main.async { + let addressBarBottom = self.appSettings.currentAddressBarPosition.isBottom ActionMessageView.present(message: UserText.webSaveFavoriteDone, - presentationLocation: .withBottomBar(andAddressBarBottom: self.appSettings.currentAddressBarPosition.isBottom)) + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom)) } } else if nil == viewModel.bookmark(for: link.url) { viewModel.createBookmark(title: link.displayTitle, url: link.url) syncService.scheduler.notifyDataChanged() DispatchQueue.main.async { + let addressBarBottom = self.appSettings.currentAddressBarPosition.isBottom ActionMessageView.present(message: UserText.webSaveBookmarkDone, - presentationLocation: .withBottomBar(andAddressBarBottom: self.appSettings.currentAddressBarPosition.isBottom)) + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom)) } } else { DispatchQueue.main.async { + let addressBarBottom = self.appSettings.currentAddressBarPosition.isBottom ActionMessageView.present(message: UserText.webBookmarkAlreadySaved, - presentationLocation: .withBottomBar(andAddressBarBottom: self.appSettings.currentAddressBarPosition.isBottom)) + presentationLocation: .withBottomBar(andAddressBarBottom: addressBarBottom)) } } }