From 313c7d27c820ee9922e4cb6e1c3857feb8b74a81 Mon Sep 17 00:00:00 2001 From: Uttiya <uttiya.dutta.10@gmail.com> Date: Wed, 22 Apr 2020 16:42:54 -0400 Subject: [PATCH] Update Source Selection Button In watch tab, the button will now always show the currently selected source. --- NineAnimator/Base.lproj/AnimeDiscovery.storyboard | 14 ++------------ .../DiscoverySceneViewController.swift | 13 ++++++++++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/NineAnimator/Base.lproj/AnimeDiscovery.storyboard b/NineAnimator/Base.lproj/AnimeDiscovery.storyboard index 69392d123..3e9206eee 100644 --- a/NineAnimator/Base.lproj/AnimeDiscovery.storyboard +++ b/NineAnimator/Base.lproj/AnimeDiscovery.storyboard @@ -3,7 +3,7 @@ <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> @@ -595,9 +595,7 @@ <navigationItem key="navigationItem" title="Watch Next" id="AWC-Sv-NA3"> <barButtonItem key="rightBarButtonItem" title="Select Source" id="S9D-GU-IOj"> <connections> - <segue destination="16P-Tr-XC2" kind="popoverPresentation" popoverAnchorBarButtonItem="S9D-GU-IOj" id="QIE-hh-9O1"> - <popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/> - </segue> + <action selector="selectSourceButtonPressed:" destination="9sh-0o-xaW" id="lGm-40-TUc"/> </connections> </barButtonItem> </navigationItem> @@ -777,14 +775,6 @@ </objects> <point key="canvasLocation" x="1137.68115942029" y="107.8125"/> </scene> - <!--ServerSelection--> - <scene sceneID="g8v-Gs-nG0"> - <objects> - <viewControllerPlaceholder storyboardName="ServerSelection" id="16P-Tr-XC2" sceneMemberID="viewController"/> - <placeholder placeholderIdentifier="IBFirstResponder" id="L1C-dx-18P" userLabel="First Responder" sceneMemberID="firstResponder"/> - </objects> - <point key="canvasLocation" x="193" y="510"/> - </scene> <!--Watch Next--> <scene sceneID="d6G-dE-Ax4"> <objects> diff --git a/NineAnimator/Controllers/Anime Discovery Scenes/DiscoverySceneViewController.swift b/NineAnimator/Controllers/Anime Discovery Scenes/DiscoverySceneViewController.swift index 0d24462da..0efbe81d9 100644 --- a/NineAnimator/Controllers/Anime Discovery Scenes/DiscoverySceneViewController.swift +++ b/NineAnimator/Controllers/Anime Discovery Scenes/DiscoverySceneViewController.swift @@ -38,11 +38,21 @@ class DiscoverySceneViewController: UITableViewController { private var recommendationLoadingTasks = [ObjectIdentifier: NineAnimatorAsyncTask]() private var dirtySources = Set<ObjectIdentifier>() private var shouldReloadDirtySourceImmedietly = false - + override var preferredStatusBarStyle: UIStatusBarStyle { Theme.current.preferredStatusBarStyle } + var source: Source { NineAnimator.default.user.source } + + @IBAction private func selectSourceButtonPressed(_ sender: Any) { + ServerSelectionViewController.presentSelectionDialog { + [weak self] _ in + guard let self = self else { return } + self.selectSourceButton.title = self.source.name + } + } + override func viewDidLoad() { super.viewDidLoad() @@ -83,6 +93,7 @@ class DiscoverySceneViewController: UITableViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) tableView.makeThemable() + self.selectSourceButton.title = source.name } override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {