Skip to content

Commit c5cc85a

Browse files
committed
Fix subscribe/follow crash
1 parent 10c0adf commit c5cc85a

File tree

4 files changed

+35
-61
lines changed

4 files changed

+35
-61
lines changed

PodcastsTableViewController.swift

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class PodcastsTableViewController: UIViewController {
6060

6161
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(removePlayerNavButtonAndReload), name: Constants.kPlayerHasNoItem, object: nil)
6262
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(reloadPodcastData), name: Constants.kDownloadHasFinished, object: nil)
63-
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(unsubscribeFromPodcast(_:)), name: Constants.kUnsubscribeFromPodcast, object: nil)
6463
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(clearParsingActivity), name: Constants.kInternetIsUnreachable, object: nil)
6564
updateParsingActivity()
6665

@@ -88,25 +87,6 @@ class PodcastsTableViewController: UIViewController {
8887
refreshPodcastFeeds()
8988
}
9089

91-
func unsubscribeFromPodcast(notification:NSNotification) {
92-
if let unsubscribedPodcastInfo = notification.userInfo {
93-
for(index, podcast) in self.subscribedPodcastsArray.enumerate() {
94-
if podcast.feedURL == unsubscribedPodcastInfo["feedURL"] as? String {
95-
//ATTENTION NOTE: Any additional view controllers pushed on this nav stack need to be checked and popped
96-
if let topVC = self.navigationController?.topViewController as? EpisodesTableViewController where topVC.selectedPodcast.feedURL == podcast.feedURL {
97-
self.navigationController?.popToRootViewControllerAnimated(false)
98-
}
99-
else if let topVC = self.navigationController?.topViewController as? ClipsTableViewController where topVC.selectedPodcast.feedURL == podcast.feedURL {
100-
self.navigationController?.popToRootViewControllerAnimated(false)
101-
}
102-
103-
subscribedPodcastsArray.removeAtIndex(index)
104-
self.tableView.reloadData()
105-
}
106-
}
107-
}
108-
}
109-
11090
private func refreshPodcastFeeds() {
11191
let moc = self.coreDataHelper.managedObjectContext
11292
let podcastsPredicate = NSPredicate(format: "isSubscribed == %@", NSNumber(bool: true))
@@ -389,7 +369,7 @@ extension PodcastsTableViewController: PVFeedParserDelegate {
389369
} else if let url = feedURL, let index = self.followedPodcastsArray.indexOf({ url == $0.feedURL }) {
390370
let podcast = CoreDataHelper.fetchEntityWithID(self.followedPodcastsArray[index].objectID, moc: self.managedObjectContext) as! Podcast
391371
self.followedPodcastsArray[index] = podcast
392-
self.tableView.reloadRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: 0)], withRowAnimation: .None)
372+
self.tableView.reloadRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: 1)], withRowAnimation: .None)
393373
}
394374
else {
395375
self.reloadPodcastData()

0 commit comments

Comments
 (0)