Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
fixes #341 - removes paste and go
Browse files Browse the repository at this point in the history
  • Loading branch information
boek committed Aug 23, 2017
1 parent 8ba4d31 commit 25656db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 0 additions & 2 deletions Blockzilla.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
0B0D6BC41F3CDDBB00497D08 /* CollapsedURLTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B0D6BC31F3CDDBB00497D08 /* CollapsedURLTest.swift */; };
0B37F9A61E2FCAD4002DF74B /* SearchProviderTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B37F9A51E2FCAD4002DF74B /* SearchProviderTest.swift */; };
0B4868661F2250A3008C3C09 /* PastenGoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B4868651F2250A3008C3C09 /* PastenGoTest.swift */; };
0B70C1631DE6128900CEF7E0 /* WebsiteMemoryTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B70C1621DE6128900CEF7E0 /* WebsiteMemoryTest.swift */; };
0BA39A861DD2B8E4005F970A /* WebsiteAccessTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BA39A851DD2B8E4005F970A /* WebsiteAccessTest.swift */; };
0BA7B7C01E9D6C7E0058EA5B /* XCUITests-Bridging-Header.h in Sources */ = {isa = PBXBuildFile; fileRef = 0BA7B7BF1E9D6C1B0058EA5B /* XCUITests-Bridging-Header.h */; };
Expand Down Expand Up @@ -1199,7 +1198,6 @@
0B70C1631DE6128900CEF7E0 /* WebsiteMemoryTest.swift in Sources */,
4F582F7B1F44A10F006C744B /* OpenInFocusTest.swift in Sources */,
0BC928CE1E366A6E004AC581 /* AsianLocaleTest.swift in Sources */,
0B4868661F2250A3008C3C09 /* PastenGoTest.swift in Sources */,
0BA39A861DD2B8E4005F970A /* WebsiteAccessTest.swift in Sources */,
0B0D6BC41F3CDDBB00497D08 /* CollapsedURLTest.swift in Sources */,
);
Expand Down
21 changes: 11 additions & 10 deletions Blockzilla/OverlayView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class OverlayView: UIView {
private var searchQuery = ""
private let copyButton = InsetButton()
private let copyBorder = UIView()

init() {
super.init(frame: CGRect.zero)
KeyboardHelper.defaultHelper.addDelegate(delegate: self)
Expand All @@ -32,7 +32,7 @@ class OverlayView: UIView {
setUpOverlayButton(button: searchButton)
searchButton.addTarget(self, action: #selector(didPressSearch), for: .touchUpInside)
addSubview(searchButton)

searchBorder.isHidden = true
searchBorder.alpha = 0
searchBorder.backgroundColor = UIConstants.colors.settingsButtonBorder
Expand Down Expand Up @@ -105,10 +105,10 @@ class OverlayView: UIView {
searchQuery = query
let query = query.trimmingCharacters(in: .whitespaces)

if let pasteBoard = UIPasteboard.general.string {
if false, let pasteBoard = UIPasteboard.general.string {
if let pasteURL = URL(string: pasteBoard), pasteURL.isWebPage() {
let attributedURL = NSAttributedString(string: pasteURL.absoluteString, attributes: [NSForegroundColorAttributeName: UIColor.white])
copyButton.setAttributedTitle(attributedURL, for: .normal)
copyButton.setAttributedTitle(attributedURL, for: .normal)
}
else {
setAttributedButtonTitle(phrase: pasteBoard, button: copyButton)
Expand All @@ -125,6 +125,7 @@ class OverlayView: UIView {
updateCopyConstraint()
}
fileprivate func updateCopyConstraint() {
return
if UIPasteboard.general.string != nil {
copyButton.isHidden = false
copyBorder.isHidden = false
Expand All @@ -145,7 +146,7 @@ class OverlayView: UIView {
copyBorder.isHidden = true
}
}

@objc private func didPressSearch() {
delegate?.overlayView(self, didSearchForQuery: searchQuery)
}
Expand All @@ -155,12 +156,12 @@ class OverlayView: UIView {
@objc private func didPressSettings() {
delegate?.overlayViewDidPressSettings(self)
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
delegate?.overlayViewDidTouchEmptyArea(self)
}

func dismiss() {
setSearchQuery(query: "", animated: false)
self.isUserInteractionEnabled = false
Expand All @@ -170,12 +171,12 @@ class OverlayView: UIView {
self.isUserInteractionEnabled = true
}
}

func present() {
setSearchQuery(query: "", animated: false)
self.isUserInteractionEnabled = false
copyButton.isHidden = false
copyBorder.isHidden = false
copyButton.isHidden = true
copyBorder.isHidden = true
animateHidden(false, duration: UIConstants.layout.overlayAnimationDuration) {
self.isUserInteractionEnabled = true
}
Expand Down

0 comments on commit 25656db

Please sign in to comment.