Skip to content

Commit

Permalink
swiftlint
Browse files Browse the repository at this point in the history
  • Loading branch information
brindy committed Oct 13, 2023
1 parent aaace19 commit de6bf60
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion DuckDuckGo/MainViewController+Email.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions DuckDuckGo/TabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"])
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions DuckDuckGo/TabViewControllerLongPressBookmarkExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}
Expand Down

0 comments on commit de6bf60

Please sign in to comment.