From 48fef65bc4ea194e86f496190ed8c7a75adc4c27 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 13 Nov 2019 17:13:06 -0600 Subject: [PATCH] Remove refresh interval setting. Issue #1293 --- NetNewsWire.xcodeproj/project.pbxproj | 6 - iOS/AppDefaults.swift | 12 -- iOS/AppDelegate.swift | 4 +- .../RefreshIntervalViewController.swift | 111 ------------------ iOS/Settings/Settings.storyboard | 83 +++---------- iOS/Settings/SettingsViewController.swift | 17 +-- 6 files changed, 19 insertions(+), 214 deletions(-) delete mode 100644 iOS/Settings/RefreshIntervalViewController.swift diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 1c8df4ab1..819da2fc1 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -108,7 +108,6 @@ 5183CCE5226F4DFA0010922C /* RefreshInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE4226F4DFA0010922C /* RefreshInterval.swift */; }; 5183CCE6226F4E110010922C /* RefreshInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE4226F4DFA0010922C /* RefreshInterval.swift */; }; 5183CCE8226F68D90010922C /* AccountRefreshTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE7226F68D90010922C /* AccountRefreshTimer.swift */; }; - 5183CCE9226F68D90010922C /* AccountRefreshTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE7226F68D90010922C /* AccountRefreshTimer.swift */; }; 518651B223555EB20078E021 /* NNW3Document.swift in Sources */ = {isa = PBXBuildFile; fileRef = 518651AB23555EB20078E021 /* NNW3Document.swift */; }; 518651DA235621840078E021 /* ImageTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 518651D9235621840078E021 /* ImageTransition.swift */; }; 5186A635235EF3A800C97195 /* VibrantLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5186A634235EF3A800C97195 /* VibrantLabel.swift */; }; @@ -121,7 +120,6 @@ 51938DF3231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51938DF1231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift */; }; 519B8D332143397200FA689C /* SharingServiceDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519B8D322143397200FA689C /* SharingServiceDelegate.swift */; }; 519E743D22C663F900A78E47 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519E743422C663F900A78E47 /* SceneDelegate.swift */; }; - 51A16997235E10D700EB091F /* RefreshIntervalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1698D235E10D600EB091F /* RefreshIntervalViewController.swift */; }; 51A16999235E10D700EB091F /* LocalAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A1698F235E10D600EB091F /* LocalAccountViewController.swift */; }; 51A1699A235E10D700EB091F /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51A16990235E10D600EB091F /* Settings.storyboard */; }; 51A1699B235E10D700EB091F /* AccountInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16991235E10D600EB091F /* AccountInspectorViewController.swift */; }; @@ -1280,7 +1278,6 @@ 51938DF1231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTimelineFeedDelegate.swift; sourceTree = ""; }; 519B8D322143397200FA689C /* SharingServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingServiceDelegate.swift; sourceTree = ""; }; 519E743422C663F900A78E47 /* SceneDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - 51A1698D235E10D600EB091F /* RefreshIntervalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RefreshIntervalViewController.swift; sourceTree = ""; }; 51A1698F235E10D600EB091F /* LocalAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalAccountViewController.swift; sourceTree = ""; }; 51A16990235E10D600EB091F /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = ""; }; 51A16991235E10D600EB091F /* AccountInspectorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountInspectorViewController.swift; sourceTree = ""; }; @@ -1798,7 +1795,6 @@ 51A16990235E10D600EB091F /* Settings.storyboard */, 51A16995235E10D600EB091F /* AboutViewController.swift */, 51A16992235E10D600EB091F /* AddAccountViewController.swift */, - 51A1698D235E10D600EB091F /* RefreshIntervalViewController.swift */, 516A09382360A2AE00EAE89B /* SettingsAccountTableViewCell.swift */, 516A091D23609A3600EAE89B /* SettingsAccountTableViewCell.xib */, 516A093A2360A4A000EAE89B /* SettingsTableViewCell.xib */, @@ -3963,14 +3959,12 @@ 51A1699B235E10D700EB091F /* AccountInspectorViewController.swift in Sources */, 51C452762265091600C03939 /* MasterTimelineViewController.swift in Sources */, 5108F6D823763094001ABC45 /* TickMarkSlider.swift in Sources */, - 5183CCE9226F68D90010922C /* AccountRefreshTimer.swift in Sources */, 51C452882265093600C03939 /* AddFeedViewController.swift in Sources */, 51A169A0235E10D700EB091F /* FeedbinAccountViewController.swift in Sources */, 51934CCE2310792F006127BE /* ActivityManager.swift in Sources */, 5108F6B72375E612001ABC45 /* CacheCleaner.swift in Sources */, 518651DA235621840078E021 /* ImageTransition.swift in Sources */, 514219372352510100E07E2C /* ImageScrollView.swift in Sources */, - 51A16997235E10D700EB091F /* RefreshIntervalViewController.swift in Sources */, 516AE9B32371C372007DEEAA /* MasterFeedTableViewSectionHeaderLayout.swift in Sources */, 51C4529B22650A1000C03939 /* FaviconDownloader.swift in Sources */, 84DEE56622C32CA4005FC42C /* SmartFeedDelegate.swift in Sources */, diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift index d68d1bd48..e2e576835 100644 --- a/iOS/AppDefaults.swift +++ b/iOS/AppDefaults.swift @@ -24,7 +24,6 @@ struct AppDefaults { static let timelineIconSize = "timelineIconSize" static let timelineSortDirection = "timelineSortDirection" static let displayUndoAvailableTip = "displayUndoAvailableTip" - static let refreshInterval = "refreshInterval" static let lastRefresh = "lastRefresh" } @@ -45,16 +44,6 @@ struct AppDefaults { } } - static var refreshInterval: RefreshInterval { - get { - let rawValue = AppDefaults.shared.integer(forKey: Key.refreshInterval) - return RefreshInterval(rawValue: rawValue) ?? RefreshInterval.everyHour - } - set { - AppDefaults.shared.set(newValue.rawValue, forKey: Key.refreshInterval) - } - } - static var timelineGroupByFeed: Bool { get { return bool(for: Key.timelineGroupByFeed) @@ -112,7 +101,6 @@ struct AppDefaults { static func registerDefaults() { let defaults: [String : Any] = [Key.lastImageCacheFlushDate: Date(), - Key.refreshInterval: RefreshInterval.everyHour.rawValue, Key.timelineGroupByFeed: false, Key.timelineNumberOfLines: 2, Key.timelineIconSize: MasterTimelineIconSize.medium.rawValue, diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 58c741ea4..8fc666e1b 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -290,9 +290,9 @@ private extension AppDelegate { /// Schedules a background app refresh based on `AppDefaults.refreshInterval`. func scheduleBackgroundFeedRefresh() { let request = BGAppRefreshTaskRequest(identifier: "com.ranchero.NetNewsWire.FeedRefresh") - request.earliestBeginDate = Date(timeIntervalSinceNow: AppDefaults.refreshInterval.inSeconds()) + request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60) - // We send this to a dedicated seria queue because as of 11/05/19 on iOS 13.2 the call to the + // We send this to a dedicated serial queue because as of 11/05/19 on iOS 13.2 the call to the // task scheduler can hang indefinitely. bgTaskDispatchQueue.async { do { diff --git a/iOS/Settings/RefreshIntervalViewController.swift b/iOS/Settings/RefreshIntervalViewController.swift deleted file mode 100644 index 8f3d89ba9..000000000 --- a/iOS/Settings/RefreshIntervalViewController.swift +++ /dev/null @@ -1,111 +0,0 @@ -// -// RefreshIntervalViewController.swift -// NetNewsWire -// -// Created by Maurice Parker on 4/25/19. -// Copyright © 2019 Ranchero Software. All rights reserved. -// - -import UIKit - -class RefreshIntervalViewController: UITableViewController { - - override func numberOfSections(in tableView: UITableView) -> Int { - return 1 - } - - override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 7 - } - - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - - let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) - - cell.textLabel?.adjustsFontForContentSizeCategory = true - - let userRefreshInterval = AppDefaults.refreshInterval - - switch indexPath.row { - case 0: - cell.textLabel?.text = RefreshInterval.manually.description() - if userRefreshInterval == RefreshInterval.manually { - cell.accessoryType = .checkmark - } else { - cell.accessoryType = .none - } - case 1: - cell.textLabel?.text = RefreshInterval.every10Minutes.description() - if userRefreshInterval == RefreshInterval.every10Minutes { - cell.accessoryType = .checkmark - } else { - cell.accessoryType = .none - } - case 2: - cell.textLabel?.text = RefreshInterval.every30Minutes.description() - if userRefreshInterval == RefreshInterval.every30Minutes { - cell.accessoryType = .checkmark - } else { - cell.accessoryType = .none - } - case 3: - cell.textLabel?.text = RefreshInterval.everyHour.description() - if userRefreshInterval == RefreshInterval.everyHour { - cell.accessoryType = .checkmark - } else { - cell.accessoryType = .none - } - case 4: - cell.textLabel?.text = RefreshInterval.every2Hours.description() - if userRefreshInterval == RefreshInterval.every2Hours { - cell.accessoryType = .checkmark - } else { - cell.accessoryType = .none - } - case 5: - cell.textLabel?.text = RefreshInterval.every4Hours.description() - if userRefreshInterval == RefreshInterval.every4Hours { - cell.accessoryType = .checkmark - } else { - cell.accessoryType = .none - } - default: - cell.textLabel?.text = RefreshInterval.every8Hours.description() - if userRefreshInterval == RefreshInterval.every8Hours { - cell.accessoryType = .checkmark - } else { - cell.accessoryType = .none - } - } - - return cell - - } - - override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - - let refreshInterval: RefreshInterval - - switch indexPath.row { - case 0: - refreshInterval = RefreshInterval.manually - case 1: - refreshInterval = RefreshInterval.every10Minutes - case 2: - refreshInterval = RefreshInterval.every30Minutes - case 3: - refreshInterval = RefreshInterval.everyHour - case 4: - refreshInterval = RefreshInterval.every2Hours - case 5: - refreshInterval = RefreshInterval.every4Hours - default: - refreshInterval = RefreshInterval.every8Hours - } - - AppDefaults.refreshInterval = refreshInterval - self.navigationController?.popViewController(animated: true) - - } - -} diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index ed9e460df..bcb9ff294 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -60,32 +60,8 @@ - - - - - - - - - - - - - + @@ -102,7 +78,7 @@ - + @@ -119,7 +95,7 @@ - + @@ -140,7 +116,7 @@ - + @@ -171,7 +147,7 @@ - + @@ -202,7 +178,7 @@ - + @@ -223,7 +199,7 @@ - + @@ -240,7 +216,7 @@ - + @@ -257,7 +233,7 @@ - + @@ -274,7 +250,7 @@ - + @@ -291,7 +267,7 @@ - + @@ -308,7 +284,7 @@ - + @@ -474,35 +450,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -680,7 +627,7 @@ - + @@ -783,7 +730,7 @@ - + @@ -839,7 +786,7 @@ - + diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 2a36606c8..ec690552a 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -104,16 +104,6 @@ class SettingsViewController: UITableViewController { cell = acctCell } - case 2: - - if indexPath.row == 0 { - cell = tableView.dequeueReusableCell(withIdentifier: "SettingsTableViewCell", for: indexPath) - cell.textLabel?.text = NSLocalizedString("Refresh Interval", comment: "Refresh Interval") - cell.detailTextLabel?.text = AppDefaults.refreshInterval.description() - } else { - cell = super.tableView(tableView, cellForRowAt: indexPath) - } - default: cell = super.tableView(tableView, cellForRowAt: indexPath) @@ -141,21 +131,18 @@ class SettingsViewController: UITableViewController { case 2: switch indexPath.row { case 0: - let timeline = UIStoryboard.settings.instantiateController(ofType: RefreshIntervalViewController.self) - self.navigationController?.pushViewController(timeline, animated: true) - case 1: tableView.selectRow(at: nil, animated: true, scrollPosition: .none) if let sourceView = tableView.cellForRow(at: indexPath) { let sourceRect = tableView.rectForRow(at: indexPath) importOPML(sourceView: sourceView, sourceRect: sourceRect) } - case 2: + case 1: tableView.selectRow(at: nil, animated: true, scrollPosition: .none) if let sourceView = tableView.cellForRow(at: indexPath) { let sourceRect = tableView.rectForRow(at: indexPath) exportOPML(sourceView: sourceView, sourceRect: sourceRect) } - case 3: + case 2: addFeed() tableView.selectRow(at: nil, animated: true, scrollPosition: .none) default: