Move location of Reader View button

This commit is contained in:
Maurice Parker 2019-09-27 11:20:26 -05:00
parent 401f791779
commit 9da949114f
3 changed files with 23 additions and 23 deletions

View File

@ -17,6 +17,15 @@ enum ArticleExtractorButtonState {
class ArticleExtractorButton: UIButton {
init() {
super.init(frame: .zero)
setImage(AppAssets.articleExtractorOff, for: .normal)
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
var buttonState: ArticleExtractorButtonState = .off {
didSet {
if buttonState != oldValue {

View File

@ -22,7 +22,6 @@ enum ArticleViewState: Equatable {
class ArticleViewController: UIViewController {
@IBOutlet private weak var articleExtractorButton: ArticleExtractorButton!
@IBOutlet private weak var nextUnreadBarButtonItem: UIBarButtonItem!
@IBOutlet private weak var prevArticleBarButtonItem: UIBarButtonItem!
@IBOutlet private weak var nextArticleBarButtonItem: UIBarButtonItem!
@ -31,6 +30,8 @@ class ArticleViewController: UIViewController {
@IBOutlet private weak var actionBarButtonItem: UIBarButtonItem!
@IBOutlet private weak var browserBarButtonItem: UIBarButtonItem!
@IBOutlet private weak var webViewContainer: UIView!
private var articleExtractorButton = ArticleExtractorButton()
private var webView: WKWebView!
weak var coordinator: SceneCoordinator!
@ -83,9 +84,9 @@ class ArticleViewController: UIViewController {
NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil)
// For some reason interface builder won't let me set this there.
articleExtractorButton.addTarget(self, action: #selector(toggleArticleExtractor(_:)), for: .touchUpInside)
navigationItem.titleView = articleExtractorButton
ArticleViewControllerWebViewProvider.shared.dequeueWebView() { webView in
self.webView = webView

View File

@ -30,16 +30,6 @@
<viewLayoutGuide key="safeArea" id="VUw-jc-0yf"/>
</view>
<toolbarItems>
<barButtonItem enabled="NO" title="Next Unread" image="chevron.down.circle" catalog="system" id="2w5-e9-C2V">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Next Unread"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="nextUnread:" destination="JEX-9P-axG" id="USD-hC-C6z"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="vAq-iW-Yyo"/>
<barButtonItem title="Toggle Read" image="circle" catalog="system" id="hy0-LS-MzE">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Toggle Read"/>
@ -58,6 +48,16 @@
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="bf9-AH-def"/>
<barButtonItem enabled="NO" title="Next Unread" image="chevron.down.circle" catalog="system" id="2w5-e9-C2V">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Next Unread"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="nextUnread:" destination="JEX-9P-axG" id="USD-hC-C6z"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="vAq-iW-Yyo"/>
<barButtonItem image="square.and.arrow.up" catalog="system" id="9Ut-5B-JKP">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="accEnabled" value="YES"/>
@ -77,14 +77,6 @@
<action selector="openBrowser:" destination="JEX-9P-axG" id="R0r-fI-NI7"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="y6Z-dk-3Zw"/>
<barButtonItem style="plain" id="n8q-YO-ldL">
<button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="n73-9B-rav" customClass="ArticleExtractorButton" customModule="NetNewsWire" customModuleProvider="target">
<rect key="frame" x="358" y="5" width="36" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" image="articleExtractorOff"/>
</button>
</barButtonItem>
</toolbarItems>
<navigationItem key="navigationItem" largeTitleDisplayMode="never" id="mOI-FS-AaM">
<rightBarButtonItems>
@ -112,7 +104,6 @@
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="actionBarButtonItem" destination="9Ut-5B-JKP" id="9bO-kz-cTz"/>
<outlet property="articleExtractorButton" destination="n73-9B-rav" id="zud-XU-Kkx"/>
<outlet property="browserBarButtonItem" destination="DMh-3X-ebd" id="PkT-Tn-8kG"/>
<outlet property="nextArticleBarButtonItem" destination="2qz-M5-Yhk" id="IQd-jx-qEr"/>
<outlet property="nextUnreadBarButtonItem" destination="2w5-e9-C2V" id="xJr-5y-p1N"/>
@ -237,7 +228,6 @@
</scene>
</scenes>
<resources>
<image name="articleExtractorOff" width="18" height="23"/>
<image name="chevron.down" catalog="system" width="64" height="36"/>
<image name="chevron.down.circle" catalog="system" width="64" height="60"/>
<image name="chevron.up" catalog="system" width="64" height="36"/>