Merge pull request #3285 from vladyslav-iosdev/#3279

When browser's DappBrowserNavigationBar.state is .browserOnly, the home button, bookmarks, history, etc shouldn't be shown #3279
pull/3286/head
Hwee-Boon Yar 3 years ago committed by GitHub
commit 14e5e0e810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      AlphaWallet/Browser/Coordinators/DappBrowserCoordinator.swift
  2. 2
      AlphaWallet/Browser/Views/DappBrowserNavigationBar.swift

@ -279,20 +279,24 @@ final class DappBrowserCoordinator: NSObject, Coordinator {
let cancelAction = UIAlertAction(title: R.string.localizable.cancel(), style: .cancel) { _ in }
alertController.addAction(reloadAction)
alertController.addAction(myBookmarksAction)
alertController.addAction(historyAction)
alertController.addAction(setAsHomePageAction)
alertController.addAction(shareAction)
alertController.addAction(addBookmarkAction)
alertController.addAction(switchNetworkAction)
if browserOnly {
//no-op
} else {
alertController.addAction(scanQrCodeAction)
}
alertController.addAction(cancelAction)
let mappedAlertActionsToDisplay: [(action: UIAlertAction, flag: Bool)] = [
(action: reloadAction, flag: true),
(action: myBookmarksAction, flag: !browserOnly),
(action: historyAction, flag: !browserOnly),
(action: setAsHomePageAction, flag: !browserOnly),
(action: shareAction, flag: true),
(action: addBookmarkAction, flag: !browserOnly),
(action: switchNetworkAction, flag: !browserOnly),
(action: scanQrCodeAction, flag: !browserOnly),
(action: cancelAction, flag: true)
]
for each in mappedAlertActionsToDisplay {
guard each.flag else { continue }
alertController.addAction(each.action)
}
return alertController
}

@ -171,7 +171,7 @@ final class DappBrowserNavigationBar: UINavigationBar {
viewsToShowWhenNotEditing.append(contentsOf: [spacer0, spacer1, backwardForwardButtonStackView, textField, spacer2, homeButton, spacer3, moreButton])
viewsToShowWhenEditing.append(contentsOf: [textField, cancelEditingButton])
viewsToShowWhenBrowserOnly.append(contentsOf: [spacer0, backwardForwardButtonStackView, domainNameLabel, spacer1, closeButton, spacer2, homeButton, spacer3, moreButton])
viewsToShowWhenBrowserOnly.append(contentsOf: [spacer0, backwardForwardButtonStackView, domainNameLabel, spacer1, closeButton, spacer3, moreButton])
changeServerButton.setContentCompressionResistancePriority(.required, for: .horizontal)
changeServerButton.setContentHuggingPriority(.required, for: .horizontal)

Loading…
Cancel
Save