From 71275813da8f8dccc7777eac0de2796bd199a22c Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Sat, 1 Oct 2022 14:20:21 +0100 Subject: [PATCH 01/15] add custom notification sound Added a blip sound file to the Resources and the iOS target. Changed the notification code to use the sound. --- NetNewsWire.xcodeproj/project.pbxproj | 4 ++++ .../UserNotificationManager.swift | 3 ++- iOS/Resources/notificationSoundBlip.caf | Bin 0 -> 7224 bytes 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 iOS/Resources/notificationSoundBlip.caf diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index adef6cf2a..3b5ab6fd8 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -853,6 +853,7 @@ D5F4EDB720074D6500B9E363 /* WebFeed+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB620074D6500B9E363 /* WebFeed+Scriptability.swift */; }; D5F4EDB920074D7C00B9E363 /* Folder+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB820074D7C00B9E363 /* Folder+Scriptability.swift */; }; DD82AB0A231003F6002269DF /* SharingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD82AB09231003F6002269DF /* SharingTests.swift */; }; + DDE6A35128E8741F00612823 /* notificationSoundBlip.caf in Resources */ = {isa = PBXBuildFile; fileRef = DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */; }; DF5AD10128D6922200CA3BF7 /* SmartFeedSummaryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */; }; DFD6AACF27ADE86E00463FAD /* NewsFax.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = DFD6AACD27ADE86E00463FAD /* NewsFax.nnwtheme */; }; DFFB8FC2279B75E300AC21D7 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; @@ -1595,6 +1596,7 @@ D5F4EDB620074D6500B9E363 /* WebFeed+Scriptability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WebFeed+Scriptability.swift"; sourceTree = ""; }; D5F4EDB820074D7C00B9E363 /* Folder+Scriptability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Folder+Scriptability.swift"; sourceTree = ""; }; DD82AB09231003F6002269DF /* SharingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharingTests.swift; sourceTree = ""; }; + DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = notificationSoundBlip.caf; sourceTree = ""; }; DFD6AACB27ADE80900463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = ""; }; DFD6AACD27ADE86E00463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = ""; }; DFFC199727A0D0D7004B7AEF /* NotificationsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsViewController.swift; sourceTree = ""; }; @@ -2740,6 +2742,7 @@ 514219572353C28900E07E2C /* main_ios.js */, 17D7586C2679C21700B17787 /* NetNewsWire-iOS-Bridging-Header.h */, 84C9FC9B2262A1A900D921D6 /* Assets.xcassets */, + DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */, 84C9FC9C2262A1A900D921D6 /* Info.plist */, 84BB0F812333426400DED65E /* NetNewsWire.entitlements */, 51F805ED24284C1C0022C792 /* NetNewsWire-dev.entitlements */, @@ -3447,6 +3450,7 @@ 516A09422361248000EAE89B /* Inspector.storyboard in Resources */, 51DEE81A26FBFF84006DAA56 /* Promenade.nnwtheme in Resources */, 1768140B2564BB8300D98635 /* NetNewsWire_iOSwidgetextension_target.xcconfig in Resources */, + DDE6A35128E8741F00612823 /* notificationSoundBlip.caf in Resources */, 5103A9B424216A4200410853 /* blank.html in Resources */, 51D0214826ED617100FF2E0F /* core.css in Resources */, 84C9FCA42262A1B800D921D6 /* LaunchScreenPhone.storyboard in Resources */, diff --git a/Shared/UserNotifications/UserNotificationManager.swift b/Shared/UserNotifications/UserNotificationManager.swift index 35523f595..b44d6d40e 100644 --- a/Shared/UserNotifications/UserNotificationManager.swift +++ b/Shared/UserNotifications/UserNotificationManager.swift @@ -62,7 +62,8 @@ private extension UserNotificationManager { } content.body = ArticleStringFormatter.truncatedSummary(article) content.threadIdentifier = webFeed.webFeedID - content.sound = UNNotificationSound.default + // https://freesound.org/people/cabled_mess/sounds/350862/ + content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "notificationSoundBlip.caf")) content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo] content.categoryIdentifier = "NEW_ARTICLE_NOTIFICATION_CATEGORY" if let attachment = thumbnailAttachment(for: article, webFeed: webFeed) { diff --git a/iOS/Resources/notificationSoundBlip.caf b/iOS/Resources/notificationSoundBlip.caf new file mode 100644 index 0000000000000000000000000000000000000000..07c4a8a62b6f062cdaeffb2c7a7bd501b1879dce GIT binary patch literal 7224 zcmeI1PjB1E8ODc7+%?zTjYuyF1qE7(WD?gY(wH-HFFovfsChq;Ppa1LPeL-MBU_oF(U_oF(U_oF(U_oF(U_oF(U_oF(;D;gb z>GtQ_)suew8@%KD{GagBdc8eA$@3%*eZ4NdE*H|WjM4E~o-Oe#jiX>-$aY&u&TXTY zJe(G39;Lyc+4ZD&`wuR-WsZ(dvm(usG#nT-jJdASdsJrAe0DR9!(dR~@(`G-zyjo|ODY6KR=vVm8fi6r8#%+MWv-8jhD^iTL@AFzC1FfZVZHjXi>q#8DJ1 zH^rv#T<)w)OrxI^1rC@3M$_|za2(63v9Q47F!$N@eVn`PIS%LCV#jA?Rwj8E44HeI zPVMsd*3I4V6YL^SqiERJ0(;@uwz=!mx_Od>PuFSBijj-CXW)rpETIM+fP4Q)q03_| z0iK(4aBMFxN@5=dPuIYxO`GOcZ7)A1o^j&$TV7WP>4MOuYv5VrDb@%vOmlG(f`KJ6 zNTC1U!xkM-a@W>ICuezig3W=@P8T?ZwOZ@He~6M`cA}P`xnN%#Vcm3+hnQfQf6z{;qJWiB5p z_E>sATBf-JWBk=1}cT6EsKGW0tdwb#WxcSbEgs_&4n@`L~KpCmi7e*Elp_UG|)FX zz|4icS|iBmB+WyxN1wf#bfG!3)=$n#45N4YMzxO#0OD1sP zZ(N!*TxmHPP)Sf~2kgh$Da85emvIy-o)8A~$>uzhkQC=(YfCpUtoa!>4a*MS-BhvU&8Ng(?AdKBo; z9QvJXr=Qc7(d~Y}DU~|8KDKMU^f4p=6@`P=j;QR+93_v-bP5#D*C8&#jPjAVDj1}= zxt-Z7*UWpzr$rtEGsMMjDVMWN2$2ZIN$_lKE-vn@n!SIP;0cQg{rbnE!-a6|*2-ZI zhL)4P0300ABZ~q!IAR<}*xIuzjgMeaWPYo=M+Mm#BmnEXEtLsa+KS`DR>^h%&QiwZ zkoBdH3340^^=J3V<$&2WwNd(z%r6Gd7A)!tbdL^x_pflS`EV2c4)zdj<#OZ=edGC8 zqSNIPm4fD`(+POsT3jk&^gO?Ff{;_Iu?et;Av z^W*RrA5|?7QsI#7jHGq(YSqK=cEoM4Y_&;o4ir~8VxGLbUwNYHcZ9&>Sxk-{q7{c0{Cx0Zf(KKom6xTgRd*2P>r?&SgW2^L_aFw?z(I=C_c z%8ZK#g<#f9Cedx~_ZE7=zpFDn>|C&ewc zY$I25b@w1?wO%*iMx?n_icn=|(LSPCxg6xuKe^C2PgY$e0Zag?fgB)kxYM+{ul)+0 zYmoVomQ&~x?uk;9^@V4(19S;G4Vcl`aDngeL}N34>&*cjkaKevcLBgaS1QGMYA%GB zX+B+Fl5off+!aKL**hw$3s;CGHrsClDhbRF4M>iNdkS?W3DLH8F<7z#k~nFO%uhm} z8bveehxWtV4xcsXeg>W=sFb=6Uf#e}2SOxi!4XUL(}XZ1HE^FmYMAQM2FIA+Q+S&- zR5(}q%p+J786|bQZNLQ3BeTB{y5*Y?qB4QnDE(Jf;Hm@PYVAlInth=3nUE0CQe({4}ZI!OW>U)~U#V6WN_h7X#vVM>fX;cb9h zwU|#9h3AFuUd9lTOR|e5LMojm86s`08x{i5X_=;`kLl(6`mD$5b;B?;O=J3K#B}wA Yfc|T5gdcsx7-nc%{a*D&;d}r7A5W=Vk^lez literal 0 HcmV?d00001 From 1ed547d7221657f12010d71dbbeb27278c123fd2 Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Sat, 1 Oct 2022 15:17:22 +0100 Subject: [PATCH 02/15] Moves the sound resource into the Shared Resources folder. Moves the audio filename reference into the AppAssets struct to make it less stringly typed and centralise access. --- Mac/AppAssets.swift | 5 +++++ NetNewsWire.xcodeproj/project.pbxproj | 2 +- {iOS => Shared}/Resources/notificationSoundBlip.caf | Bin .../UserNotifications/UserNotificationManager.swift | 2 +- iOS/AppAssets.swift | 4 ++++ 5 files changed, 11 insertions(+), 2 deletions(-) rename {iOS => Shared}/Resources/notificationSoundBlip.caf (100%) diff --git a/Mac/AppAssets.swift b/Mac/AppAssets.swift index 2e6103762..84f6b6f2a 100644 --- a/Mac/AppAssets.swift +++ b/Mac/AppAssets.swift @@ -295,4 +295,9 @@ struct AppAssets { } } + static var notificationSoundBlipFileName: String = { + return "notificationSoundBlip.caf" + }() + + } diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 3b5ab6fd8..a8f4adbf3 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -1860,6 +1860,7 @@ 511D43CE231FA51100FB1562 /* Resources */ = { isa = PBXGroup; children = ( + DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */, DFD6AACB27ADE80900463FAD /* NewsFax.nnwtheme */, 51DEE81126FB9233006DAA56 /* Appanoose.nnwtheme */, 51077C5727A86D16000C71DB /* Hyperlegible.nnwtheme */, @@ -2742,7 +2743,6 @@ 514219572353C28900E07E2C /* main_ios.js */, 17D7586C2679C21700B17787 /* NetNewsWire-iOS-Bridging-Header.h */, 84C9FC9B2262A1A900D921D6 /* Assets.xcassets */, - DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */, 84C9FC9C2262A1A900D921D6 /* Info.plist */, 84BB0F812333426400DED65E /* NetNewsWire.entitlements */, 51F805ED24284C1C0022C792 /* NetNewsWire-dev.entitlements */, diff --git a/iOS/Resources/notificationSoundBlip.caf b/Shared/Resources/notificationSoundBlip.caf similarity index 100% rename from iOS/Resources/notificationSoundBlip.caf rename to Shared/Resources/notificationSoundBlip.caf diff --git a/Shared/UserNotifications/UserNotificationManager.swift b/Shared/UserNotifications/UserNotificationManager.swift index b44d6d40e..d2bbae1fe 100644 --- a/Shared/UserNotifications/UserNotificationManager.swift +++ b/Shared/UserNotifications/UserNotificationManager.swift @@ -63,7 +63,7 @@ private extension UserNotificationManager { content.body = ArticleStringFormatter.truncatedSummary(article) content.threadIdentifier = webFeed.webFeedID // https://freesound.org/people/cabled_mess/sounds/350862/ - content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "notificationSoundBlip.caf")) + content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: AppAssets.notificationSoundBlipFileName)) content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo] content.categoryIdentifier = "NEW_ARTICLE_NOTIFICATION_CATEGORY" if let attachment = thumbnailAttachment(for: article, webFeed: webFeed) { diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index 23e3a4d91..61889bce0 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -325,4 +325,8 @@ struct AppAssets { } } + static var notificationSoundBlipFileName: String = { + return "notificationSoundBlip.caf" + }() + } From 92a5b10223c770c3dea253379cb9bb04483ed7b6 Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Sat, 1 Oct 2022 15:20:53 +0100 Subject: [PATCH 03/15] Moves the comment about the source of the sound from the UserNotificationManager and into the AppAssets struct. --- Mac/AppAssets.swift | 1 + Shared/UserNotifications/UserNotificationManager.swift | 1 - iOS/AppAssets.swift | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Mac/AppAssets.swift b/Mac/AppAssets.swift index 84f6b6f2a..1c37e71fd 100644 --- a/Mac/AppAssets.swift +++ b/Mac/AppAssets.swift @@ -296,6 +296,7 @@ struct AppAssets { } static var notificationSoundBlipFileName: String = { + // https://freesound.org/people/cabled_mess/sounds/350862/ return "notificationSoundBlip.caf" }() diff --git a/Shared/UserNotifications/UserNotificationManager.swift b/Shared/UserNotifications/UserNotificationManager.swift index d2bbae1fe..2a20f693b 100644 --- a/Shared/UserNotifications/UserNotificationManager.swift +++ b/Shared/UserNotifications/UserNotificationManager.swift @@ -62,7 +62,6 @@ private extension UserNotificationManager { } content.body = ArticleStringFormatter.truncatedSummary(article) content.threadIdentifier = webFeed.webFeedID - // https://freesound.org/people/cabled_mess/sounds/350862/ content.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: AppAssets.notificationSoundBlipFileName)) content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo] content.categoryIdentifier = "NEW_ARTICLE_NOTIFICATION_CATEGORY" diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index 61889bce0..8a3f89746 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -326,6 +326,7 @@ struct AppAssets { } static var notificationSoundBlipFileName: String = { + // https://freesound.org/people/cabled_mess/sounds/350862/ return "notificationSoundBlip.caf" }() From be75bd28d09587055acdecc89964deff54c66442 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 3 Oct 2022 13:23:11 -0500 Subject: [PATCH 04/15] Refactor the ArticleThemeManager code to simplify it and try to avoid any issues with app warm up on the iPhone --- .../ArticleStyles/ArticleThemesManager.swift | 50 ++++--------------- .../ArticleThemesTableViewController.swift | 6 +-- 2 files changed, 13 insertions(+), 43 deletions(-) diff --git a/Shared/ArticleStyles/ArticleThemesManager.swift b/Shared/ArticleStyles/ArticleThemesManager.swift index ab66608a9..352d1a360 100644 --- a/Shared/ArticleStyles/ArticleThemesManager.swift +++ b/Shared/ArticleStyles/ArticleThemesManager.swift @@ -31,19 +31,18 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { set { if newValue != currentThemeName { AppDefaults.shared.currentThemeName = newValue - updateThemeNames() - updateCurrentTheme() + currentTheme = articleThemeWithThemeName(newValue) } } } - var currentTheme: ArticleTheme { + lazy var currentTheme = { articleThemeWithThemeName(currentThemeName) }() { didSet { NotificationCenter.default.post(name: .CurrentArticleThemeDidChangeNotification, object: self) } } - var themeNames = [AppDefaults.defaultThemeName] { + lazy var themeNames = { buildThemeNames() }() { didSet { NotificationCenter.default.post(name: .ArticleThemeNamesDidChangeNotification, object: self) } @@ -51,7 +50,6 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { init(folderPath: String) { self.folderPath = folderPath - self.currentTheme = ArticleTheme.defaultTheme super.init() @@ -63,15 +61,12 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { abort() } - updateThemeNames() - updateCurrentTheme() - NSFileCoordinator.addFilePresenter(self) } func presentedSubitemDidChange(at url: URL) { - updateThemeNames() - updateCurrentTheme() + themeNames = buildThemeNames() + currentTheme = articleThemeWithThemeName(currentThemeName) } // MARK: API @@ -93,7 +88,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { try FileManager.default.copyItem(atPath: filename, toPath: toFilename) } - func articleThemeWithThemeName(_ themeName: String) -> ArticleTheme? { + func articleThemeWithThemeName(_ themeName: String) -> ArticleTheme { if themeName == AppDefaults.defaultThemeName { return ArticleTheme.defaultTheme } @@ -107,7 +102,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { path = installedPath isAppTheme = false } else { - return nil + return ArticleTheme.defaultTheme } do { @@ -115,7 +110,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { } catch { NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) logger.error("Failed to import theme: \(error.localizedDescription, privacy: .public)") - return nil + return ArticleTheme.defaultTheme } } @@ -132,7 +127,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging { private extension ArticleThemesManager { - func updateThemeNames() { + func buildThemeNames() -> [String] { let appThemeFilenames = Bundle.main.paths(forResourcesOfType: ArticleTheme.nnwThemeSuffix, inDirectory: nil) let appThemeNames = Set(appThemeFilenames.map { ArticleTheme.themeNameForPath($0) }) @@ -140,32 +135,7 @@ private extension ArticleThemesManager { let allThemeNames = appThemeNames.union(installedThemeNames) - let sortedThemeNames = allThemeNames.sorted(by: { $0.compare($1, options: .caseInsensitive) == .orderedAscending }) - if sortedThemeNames != themeNames { - themeNames = sortedThemeNames - } - } - - func defaultArticleTheme() -> ArticleTheme { - return articleThemeWithThemeName(AppDefaults.defaultThemeName)! - } - - func updateCurrentTheme() { - var themeName = currentThemeName - if !themeNames.contains(themeName) { - themeName = AppDefaults.defaultThemeName - currentThemeName = AppDefaults.defaultThemeName - } - - var articleTheme = articleThemeWithThemeName(themeName) - if articleTheme == nil { - articleTheme = defaultArticleTheme() - currentThemeName = AppDefaults.defaultThemeName - } - - if let articleTheme = articleTheme, articleTheme != currentTheme { - currentTheme = articleTheme - } + return allThemeNames.sorted(by: { $0.compare($1, options: .caseInsensitive) == .orderedAscending }) } func allThemePaths(_ folder: String) -> [String] { diff --git a/iOS/Settings/ArticleThemesTableViewController.swift b/iOS/Settings/ArticleThemesTableViewController.swift index 66d118caf..cc2bcc465 100644 --- a/iOS/Settings/ArticleThemesTableViewController.swift +++ b/iOS/Settings/ArticleThemesTableViewController.swift @@ -72,9 +72,9 @@ class ArticleThemesTableViewController: UITableViewController, Logging { override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { guard let cell = tableView.cellForRow(at: indexPath), - let themeName = cell.textLabel?.text, - let theme = ArticleThemesManager.shared.articleThemeWithThemeName(themeName), - !theme.isAppTheme else { return nil } + let themeName = cell.textLabel?.text else { return nil } + + guard !ArticleThemesManager.shared.articleThemeWithThemeName(themeName).isAppTheme else { return nil } let deleteTitle = NSLocalizedString("Delete", comment: "Delete") let deleteAction = UIContextualAction(style: .normal, title: deleteTitle) { [weak self] (action, view, completion) in From 9219eea83400a62f4647356d0b87bc5d1fb8768d Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 3 Oct 2022 13:30:45 -0500 Subject: [PATCH 05/15] Add the Nav Controller configuration back in because the defaults don't look good with some Article Themes --- iOS/SceneCoordinator.swift | 42 ++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 79fe5be0f..1c5c8dec6 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -289,15 +289,24 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, Logging { self.masterFeedViewController = rootSplitViewController.viewController(for: .primary) as? MasterFeedViewController self.masterFeedViewController.coordinator = self - self.masterFeedViewController?.navigationController?.delegate = self - + if let navController = self.masterFeedViewController?.navigationController { + navController.delegate = self + configureNavigationController(navController) + } + self.masterTimelineViewController = rootSplitViewController.viewController(for: .supplementary) as? MasterTimelineViewController self.masterTimelineViewController?.coordinator = self - self.masterTimelineViewController?.navigationController?.delegate = self + if let navController = self.masterTimelineViewController?.navigationController { + navController.delegate = self + configureNavigationController(navController) + } self.articleViewController = rootSplitViewController.viewController(for: .secondary) as? ArticleViewController self.articleViewController?.coordinator = self - + if let navController = self.articleViewController?.navigationController { + configureNavigationController(navController) + } + for sectionNode in treeController.rootNode.childNodes { markExpanded(sectionNode) shadowTable.append((sectionID: "", feedNodes: [FeedNode]())) @@ -1370,6 +1379,31 @@ extension SceneCoordinator: UINavigationControllerDelegate { private extension SceneCoordinator { + func configureNavigationController(_ navController: UINavigationController) { + + let scrollEdge = UINavigationBarAppearance() + scrollEdge.configureWithOpaqueBackground() + scrollEdge.shadowColor = nil + scrollEdge.shadowImage = UIImage() + + let standard = UINavigationBarAppearance() + standard.shadowColor = .opaqueSeparator + standard.shadowImage = UIImage() + + navController.navigationBar.standardAppearance = standard + navController.navigationBar.compactAppearance = standard + navController.navigationBar.scrollEdgeAppearance = scrollEdge + navController.navigationBar.compactScrollEdgeAppearance = scrollEdge + + navController.navigationBar.tintColor = AppAssets.primaryAccentColor + + let toolbarAppearance = UIToolbarAppearance() + navController.toolbar.standardAppearance = toolbarAppearance + navController.toolbar.compactAppearance = toolbarAppearance + navController.toolbar.scrollEdgeAppearance = toolbarAppearance + navController.toolbar.tintColor = AppAssets.primaryAccentColor + } + func markArticlesWithUndo(_ articles: [Article], statusKey: ArticleStatus.Key, flag: Bool, completion: (() -> Void)? = nil) { guard let undoManager = undoManager, let markReadCommand = MarkStatusCommand(initialArticles: articles, statusKey: statusKey, flag: flag, undoManager: undoManager, completion: completion) else { From 7e238a0d070655f7c0400fec4bbaebe4f3536aa7 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 4 Oct 2022 19:48:39 -0500 Subject: [PATCH 06/15] Add the ability to use full screen on the iPad in landscape --- iOS/SceneDelegate.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index 402f822ef..0eb98e50a 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -28,6 +28,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, Logging { coordinator = SceneCoordinator(rootSplitViewController: rootViewController) rootViewController.coordinator = coordinator rootViewController.delegate = coordinator + rootViewController.showsSecondaryOnlyButton = true coordinator.restoreWindowState(session.stateRestorationActivity) From f38ab1ab5168295d10b0f2f88db2ab91df03a96f Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 4 Oct 2022 20:19:47 -0500 Subject: [PATCH 07/15] Fix how the Article Unread Count is updated --- iOS/Article/ArticleViewController.swift | 22 ++++++++-------------- iOS/SceneCoordinator.swift | 4 ++++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index 12ce2aa90..0615c8158 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -102,7 +102,6 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable { NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(reloadDueToThemeChange(_:)), name: .CurrentArticleThemeDidChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(configureAppearanceMenu(_:)), name: .ArticleThemeNamesDidChangeNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(updateUnreadCountIndicator(_:)), name: UIDevice.orientationDidChangeNotification, object: nil) articleExtractorButton.addTarget(self, action: #selector(toggleArticleExtractor(_:)), for: .touchUpInside) toolbarItems?.insert(UIBarButtonItem(customView: articleExtractorButton), at: 6) @@ -349,9 +348,8 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable { /// For iPad, this indicator is visible if it is in `portrait` or `unknown` /// orientation, **and** the unread count is > 0. /// - Parameter sender: `Any` (optional) - @objc - public func updateUnreadCountIndicator(_ sender: Any? = nil) { - if UIDevice.current.userInterfaceIdiom == .phone { + public func updateUnreadCountIndicator(forDisplayMode displayMode: UISplitViewController.DisplayMode? = nil) { + func changeUnreadCountIndicator() { if currentUnreadCount > 0 { let unreadCountView = MasterTimelineUnreadCountView(frame: .zero) unreadCountView.unreadCount = currentUnreadCount @@ -360,17 +358,13 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable { } else { navigationItem.leftBarButtonItem = nil } + } + + if UIDevice.current.userInterfaceIdiom == .phone { + changeUnreadCountIndicator() } else { - - if UIDevice.current.orientation.isPortrait || !UIDevice.current.orientation.isValidInterfaceOrientation { - if currentUnreadCount > 0 { - let unreadCountView = MasterTimelineUnreadCountView(frame: .zero) - unreadCountView.unreadCount = currentUnreadCount - unreadCountView.setFrameIfNotEqual(CGRect(x: 0, y: 0, width: unreadCountView.intrinsicContentSize.width, height: unreadCountView.intrinsicContentSize.height)) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: unreadCountView) - } else { - navigationItem.leftBarButtonItem = nil - } + if displayMode == nil || displayMode == .secondaryOnly { + changeUnreadCountIndicator() } else { navigationItem.leftBarButtonItem = nil } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 1c5c8dec6..8dd9e2e49 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1323,6 +1323,10 @@ extension SceneCoordinator: UISplitViewControllerDelegate { } } + func splitViewController(_ svc: UISplitViewController, willChangeTo displayMode: UISplitViewController.DisplayMode) { + articleViewController?.updateUnreadCountIndicator(forDisplayMode: displayMode) + } + } // MARK: UINavigationControllerDelegate From 1010d29be800ff5308f23070ae58d65037e41c5b Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Wed, 5 Oct 2022 18:21:33 +0100 Subject: [PATCH 08/15] Swaps .caf file for .mp3 for notification sound .caf files don't appear to work on macOS notifications, and mp3s appear to work on both iOS and macOS, so swapped file format. --- Mac/AppAssets.swift | 2 +- NetNewsWire.xcodeproj/project.pbxproj | 12 ++++++++---- Shared/Resources/notificationSoundBlip.caf | Bin 7224 -> 0 bytes Shared/Resources/notificationSoundBlip.mp3 | Bin 0 -> 1902 bytes iOS/AppAssets.swift | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 Shared/Resources/notificationSoundBlip.caf create mode 100644 Shared/Resources/notificationSoundBlip.mp3 diff --git a/Mac/AppAssets.swift b/Mac/AppAssets.swift index 1c37e71fd..21c22c35a 100644 --- a/Mac/AppAssets.swift +++ b/Mac/AppAssets.swift @@ -297,7 +297,7 @@ struct AppAssets { static var notificationSoundBlipFileName: String = { // https://freesound.org/people/cabled_mess/sounds/350862/ - return "notificationSoundBlip.caf" + return "notificationSoundBlip.mp3" }() diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index a8f4adbf3..02bb24a27 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -853,7 +853,9 @@ D5F4EDB720074D6500B9E363 /* WebFeed+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB620074D6500B9E363 /* WebFeed+Scriptability.swift */; }; D5F4EDB920074D7C00B9E363 /* Folder+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB820074D7C00B9E363 /* Folder+Scriptability.swift */; }; DD82AB0A231003F6002269DF /* SharingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD82AB09231003F6002269DF /* SharingTests.swift */; }; - DDE6A35128E8741F00612823 /* notificationSoundBlip.caf in Resources */ = {isa = PBXBuildFile; fileRef = DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */; }; + DDF9E1D728EDF2FC000BC355 /* notificationSoundBlip.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = DDF9E1D628EDF2FC000BC355 /* notificationSoundBlip.mp3 */; }; + DDF9E1D828EDF2FC000BC355 /* notificationSoundBlip.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = DDF9E1D628EDF2FC000BC355 /* notificationSoundBlip.mp3 */; }; + DDF9E1D928EDF2FC000BC355 /* notificationSoundBlip.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = DDF9E1D628EDF2FC000BC355 /* notificationSoundBlip.mp3 */; }; DF5AD10128D6922200CA3BF7 /* SmartFeedSummaryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */; }; DFD6AACF27ADE86E00463FAD /* NewsFax.nnwtheme in Resources */ = {isa = PBXBuildFile; fileRef = DFD6AACD27ADE86E00463FAD /* NewsFax.nnwtheme */; }; DFFB8FC2279B75E300AC21D7 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; @@ -1596,7 +1598,7 @@ D5F4EDB620074D6500B9E363 /* WebFeed+Scriptability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WebFeed+Scriptability.swift"; sourceTree = ""; }; D5F4EDB820074D7C00B9E363 /* Folder+Scriptability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Folder+Scriptability.swift"; sourceTree = ""; }; DD82AB09231003F6002269DF /* SharingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharingTests.swift; sourceTree = ""; }; - DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = notificationSoundBlip.caf; sourceTree = ""; }; + DDF9E1D628EDF2FC000BC355 /* notificationSoundBlip.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = notificationSoundBlip.mp3; sourceTree = ""; }; DFD6AACB27ADE80900463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = ""; }; DFD6AACD27ADE86E00463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = ""; }; DFFC199727A0D0D7004B7AEF /* NotificationsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsViewController.swift; sourceTree = ""; }; @@ -1860,7 +1862,7 @@ 511D43CE231FA51100FB1562 /* Resources */ = { isa = PBXGroup; children = ( - DDE6A35028E8741F00612823 /* notificationSoundBlip.caf */, + DDF9E1D628EDF2FC000BC355 /* notificationSoundBlip.mp3 */, DFD6AACB27ADE80900463FAD /* NewsFax.nnwtheme */, 51DEE81126FB9233006DAA56 /* Appanoose.nnwtheme */, 51077C5727A86D16000C71DB /* Hyperlegible.nnwtheme */, @@ -3392,6 +3394,7 @@ 65ED405D235DEF6C0081F399 /* SidebarKeyboardShortcuts.plist in Resources */, 514A89A3244FD63F0085E65D /* AddTwitterFeedSheet.xib in Resources */, 51D0214726ED617100FF2E0F /* core.css in Resources */, + DDF9E1D828EDF2FC000BC355 /* notificationSoundBlip.mp3 in Resources */, 5103A9F5242258C600410853 /* AccountsAddCloudKit.xib in Resources */, 65ED405E235DEF6C0081F399 /* DefaultFeeds.opml in Resources */, 51333D3C2468615D00EB5C91 /* AddRedditFeedSheet.xib in Resources */, @@ -3448,9 +3451,9 @@ 51F85BF32272531500C787DC /* Dedication.rtf in Resources */, 51077C5A27A86D16000C71DB /* Hyperlegible.nnwtheme in Resources */, 516A09422361248000EAE89B /* Inspector.storyboard in Resources */, + DDF9E1D928EDF2FC000BC355 /* notificationSoundBlip.mp3 in Resources */, 51DEE81A26FBFF84006DAA56 /* Promenade.nnwtheme in Resources */, 1768140B2564BB8300D98635 /* NetNewsWire_iOSwidgetextension_target.xcconfig in Resources */, - DDE6A35128E8741F00612823 /* notificationSoundBlip.caf in Resources */, 5103A9B424216A4200410853 /* blank.html in Resources */, 51D0214826ED617100FF2E0F /* core.css in Resources */, 84C9FCA42262A1B800D921D6 /* LaunchScreenPhone.storyboard in Resources */, @@ -3499,6 +3502,7 @@ B27EEBF9244D15F3000932E6 /* stylesheet.css in Resources */, 5144EA3B227A379E00D19003 /* ImportOPMLSheet.xib in Resources */, 844B5B691FEA20DF00C7C76A /* SidebarKeyboardShortcuts.plist in Resources */, + DDF9E1D728EDF2FC000BC355 /* notificationSoundBlip.mp3 in Resources */, 5103A9F4242258C600410853 /* AccountsAddCloudKit.xib in Resources */, 51077C5827A86D16000C71DB /* Hyperlegible.nnwtheme in Resources */, 84A3EE5F223B667F00557320 /* DefaultFeeds.opml in Resources */, diff --git a/Shared/Resources/notificationSoundBlip.caf b/Shared/Resources/notificationSoundBlip.caf deleted file mode 100644 index 07c4a8a62b6f062cdaeffb2c7a7bd501b1879dce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7224 zcmeI1PjB1E8ODc7+%?zTjYuyF1qE7(WD?gY(wH-HFFovfsChq;Ppa1LPeL-MBU_oF(U_oF(U_oF(U_oF(U_oF(U_oF(;D;gb z>GtQ_)suew8@%KD{GagBdc8eA$@3%*eZ4NdE*H|WjM4E~o-Oe#jiX>-$aY&u&TXTY zJe(G39;Lyc+4ZD&`wuR-WsZ(dvm(usG#nT-jJdASdsJrAe0DR9!(dR~@(`G-zyjo|ODY6KR=vVm8fi6r8#%+MWv-8jhD^iTL@AFzC1FfZVZHjXi>q#8DJ1 zH^rv#T<)w)OrxI^1rC@3M$_|za2(63v9Q47F!$N@eVn`PIS%LCV#jA?Rwj8E44HeI zPVMsd*3I4V6YL^SqiERJ0(;@uwz=!mx_Od>PuFSBijj-CXW)rpETIM+fP4Q)q03_| z0iK(4aBMFxN@5=dPuIYxO`GOcZ7)A1o^j&$TV7WP>4MOuYv5VrDb@%vOmlG(f`KJ6 zNTC1U!xkM-a@W>ICuezig3W=@P8T?ZwOZ@He~6M`cA}P`xnN%#Vcm3+hnQfQf6z{;qJWiB5p z_E>sATBf-JWBk=1}cT6EsKGW0tdwb#WxcSbEgs_&4n@`L~KpCmi7e*Elp_UG|)FX zz|4icS|iBmB+WyxN1wf#bfG!3)=$n#45N4YMzxO#0OD1sP zZ(N!*TxmHPP)Sf~2kgh$Da85emvIy-o)8A~$>uzhkQC=(YfCpUtoa!>4a*MS-BhvU&8Ng(?AdKBo; z9QvJXr=Qc7(d~Y}DU~|8KDKMU^f4p=6@`P=j;QR+93_v-bP5#D*C8&#jPjAVDj1}= zxt-Z7*UWpzr$rtEGsMMjDVMWN2$2ZIN$_lKE-vn@n!SIP;0cQg{rbnE!-a6|*2-ZI zhL)4P0300ABZ~q!IAR<}*xIuzjgMeaWPYo=M+Mm#BmnEXEtLsa+KS`DR>^h%&QiwZ zkoBdH3340^^=J3V<$&2WwNd(z%r6Gd7A)!tbdL^x_pflS`EV2c4)zdj<#OZ=edGC8 zqSNIPm4fD`(+POsT3jk&^gO?Ff{;_Iu?et;Av z^W*RrA5|?7QsI#7jHGq(YSqK=cEoM4Y_&;o4ir~8VxGLbUwNYHcZ9&>Sxk-{q7{c0{Cx0Zf(KKom6xTgRd*2P>r?&SgW2^L_aFw?z(I=C_c z%8ZK#g<#f9Cedx~_ZE7=zpFDn>|C&ewc zY$I25b@w1?wO%*iMx?n_icn=|(LSPCxg6xuKe^C2PgY$e0Zag?fgB)kxYM+{ul)+0 zYmoVomQ&~x?uk;9^@V4(19S;G4Vcl`aDngeL}N34>&*cjkaKevcLBgaS1QGMYA%GB zX+B+Fl5off+!aKL**hw$3s;CGHrsClDhbRF4M>iNdkS?W3DLH8F<7z#k~nFO%uhm} z8bveehxWtV4xcsXeg>W=sFb=6Uf#e}2SOxi!4XUL(}XZ1HE^FmYMAQM2FIA+Q+S&- zR5(}q%p+J786|bQZNLQ3BeTB{y5*Y?qB4QnDE(Jf;Hm@PYVAlInth=3nUE0CQe({4}ZI!OW>U)~U#V6WN_h7X#vVM>fX;cb9h zwU|#9h3AFuUd9lTOR|e5LMojm86s`08x{i5X_=;`kLl(6`mD$5b;B?;O=J3K#B}wA Yfc|T5gdcsx7-nc%{a*D&;d}r7A5W=Vk^lez diff --git a/Shared/Resources/notificationSoundBlip.mp3 b/Shared/Resources/notificationSoundBlip.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..f22ba4752ee2dc90386c9c2a62535024234cad33 GIT binary patch literal 1902 zcmezWd%_V0bP$o5mkt!;2V!<0%44WS0drBnW)yG=72H7q?@+*h6acg)hAB+wDF+XM#Ff*H|>CBwaV=#~X ziZVkd^HPT6+`ejE3U`zy2}C$JY`yR_v_r?)-K5y{!l~{l9oc;gi@9gaR9ZAqoU@>< zFaN~Ki4}XcL}py;fAaFsr!vj@e_d*tDsiqt@Bg@nvbs11@BbMn5F#qb>KMx0z#zlN z#K8Ff|CN0u(~Q?_>0vmKabOD<508_^VOxbBbH)V+ZCHDl95nR~?U7v+>2C--(V3H?qLr(dPvuE-Z3^tzLZB3($pCCCAcxR-mF`s7ra}F)Ba-6 z@sAd#>VJt!pK*|XzX539nUx+4iyk*fMC7^j)hTu<&ipoE<*tVu8Z|s@7Xphc3ORmG z-?XVty0pH2<-@`H@>z+>5o#oF!eS`3W#c1o6*Vac~xs za8q;B*EQ}+(o@3u{{OoXVHv{wjlqJCk%95!8`p+Cr-PQZiZK*6dYs=Qak${a1m^Vq zJ@y=nH`)LHyhKN~{;z_t-vTWL3*r1#?#xUq&DLzgX$gPbm^1eF-`L={!lS^1 zm)UXs29r>DF%e2FK#Ga~e=8jM)9Aqws=lUFYr&bWCx7{6o>0pnM41C}!B2)`SHjgF zlq_DbwCl+QzA2?d>7(^b literal 0 HcmV?d00001 diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index 8a3f89746..9c7faca3d 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -327,7 +327,7 @@ struct AppAssets { static var notificationSoundBlipFileName: String = { // https://freesound.org/people/cabled_mess/sounds/350862/ - return "notificationSoundBlip.caf" + return "notificationSoundBlip.mp3" }() } From 00f40787c7f110e74411da2f1427fb493c3dd565 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 5 Oct 2022 13:15:38 -0500 Subject: [PATCH 09/15] Add the alert and sound notification permissions so that they show on the System Preferences --- Mac/AppDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index 959c2c213..29a29dd47 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -243,7 +243,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, refreshTimer = AccountRefreshTimer() syncTimer = ArticleStatusSyncTimer() - UNUserNotificationCenter.current().requestAuthorization(options:[.badge]) { (granted, error) in } + UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .badge]) { (granted, error) in } UNUserNotificationCenter.current().getNotificationSettings { (settings) in if settings.authorizationStatus == .authorized { From af6ce4b61b4a8c78439a3178757c39fae9599f78 Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Wed, 5 Oct 2022 19:46:20 +0100 Subject: [PATCH 10/15] Added the name of the notification sound creator to the 'Thanks' section --- Mac/Resources/Credits.rtf | 6 ++++-- iOS/Resources/Thanks.md | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Mac/Resources/Credits.rtf b/Mac/Resources/Credits.rtf index 209671265..0743ec129 100644 --- a/Mac/Resources/Credits.rtf +++ b/Mac/Resources/Credits.rtf @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf2636 +{\rtf1\ansi\ansicpg1252\cocoartf2639 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 LucidaGrande-Bold;\f1\fnil\fcharset0 LucidaGrande;} {\colortbl;\red255\green255\blue255;\red0\green0\blue0;} {\*\expandedcolortbl;;\cssrgb\c0\c0\c0\cname textColor;} @@ -36,7 +36,9 @@ And featuring contributions from {\field{\*\fldinst{HYPERLINK "https://github.co {\field{\*\fldinst{HYPERLINK "https://github.com/ccgus/fmdb"}}{\fldrslt \cf2 FMDB}} (greatest SQLite wrapper ever in history) is by {\field{\*\fldinst{HYPERLINK "http://flyingmeat.com/"}}{\fldrslt Flying Meat Software}}.\ \pard\pardeftab720\li360\sa60\partightenfactor0 {\field{\*\fldinst{HYPERLINK "https://sparkle-project.org/"}}{\fldrslt \cf2 Sparkle}} is by Sparkle Project.\ -\ +\pard\pardeftab720\li360\sa60\partightenfactor0 +{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \cf2 cabled_mess}} for the notification sound.{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \ +}}\ \pard\pardeftab720\sa60\partightenfactor0 \f0\b \cf2 Thanks:\ diff --git a/iOS/Resources/Thanks.md b/iOS/Resources/Thanks.md index e22aeac28..407fb8fac 100644 --- a/iOS/Resources/Thanks.md +++ b/iOS/Resources/Thanks.md @@ -1,5 +1,5 @@ Thanks to Sheila and my family; thanks to my friends in Seattle and around the globe; thanks to the ever-patient and ever-awesome NetNewsWire beta testers. -Thanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Slack](https://slack.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com/) for all the extra help with syncing and article rendering — and for [hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/). +Thanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Slack](https://slack.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com/) for all the extra help with syncing and article rendering — and for [hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/). Thanks to [cabled_mess](https://freesound.org/people/cabled_mess/) for the notification sound. NetNewsWire 6 is dedicated to everyone working to save democracy around the world. From 860082a5674b72d6c633b3e077809bdbe391ef72 Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Wed, 5 Oct 2022 19:48:15 +0100 Subject: [PATCH 11/15] Adjusts the URL to a better location for the creator of the notification sound --- Mac/Resources/Credits.rtf | 5 +++-- iOS/Resources/Thanks.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Mac/Resources/Credits.rtf b/Mac/Resources/Credits.rtf index 0743ec129..b83213ba0 100644 --- a/Mac/Resources/Credits.rtf +++ b/Mac/Resources/Credits.rtf @@ -37,8 +37,9 @@ And featuring contributions from {\field{\*\fldinst{HYPERLINK "https://github.co \pard\pardeftab720\li360\sa60\partightenfactor0 {\field{\*\fldinst{HYPERLINK "https://sparkle-project.org/"}}{\fldrslt \cf2 Sparkle}} is by Sparkle Project.\ \pard\pardeftab720\li360\sa60\partightenfactor0 -{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \cf2 cabled_mess}} for the notification sound.{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \ -}}\ +{\field{\*\fldinst{HYPERLINK "https://computingsound.wixsite.com/cabledmess"}}{\fldrslt \cf2 cabled_mess}} for the notification sound.{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \ +}}\pard\pardeftab720\li360\sa60\partightenfactor0 +\cf2 \ \pard\pardeftab720\sa60\partightenfactor0 \f0\b \cf2 Thanks:\ diff --git a/iOS/Resources/Thanks.md b/iOS/Resources/Thanks.md index 407fb8fac..87e8b8c3a 100644 --- a/iOS/Resources/Thanks.md +++ b/iOS/Resources/Thanks.md @@ -1,5 +1,5 @@ Thanks to Sheila and my family; thanks to my friends in Seattle and around the globe; thanks to the ever-patient and ever-awesome NetNewsWire beta testers. -Thanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Slack](https://slack.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com/) for all the extra help with syncing and article rendering — and for [hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/). Thanks to [cabled_mess](https://freesound.org/people/cabled_mess/) for the notification sound. +Thanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Slack](https://slack.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com/) for all the extra help with syncing and article rendering — and for [hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/). Thanks to [cabled_mess](https://computingsound.wixsite.com/cabledmess) for the notification sound. NetNewsWire 6 is dedicated to everyone working to save democracy around the world. From 60b4bf110cf18654ab5930a8081db1f04ff4109b Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Wed, 5 Oct 2022 20:30:11 +0100 Subject: [PATCH 12/15] Revert "Adjusts the URL to a better location for the creator of the notification sound" This reverts commit 860082a5674b72d6c633b3e077809bdbe391ef72. --- Mac/Resources/Credits.rtf | 5 ++--- iOS/Resources/Thanks.md | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Mac/Resources/Credits.rtf b/Mac/Resources/Credits.rtf index b83213ba0..0743ec129 100644 --- a/Mac/Resources/Credits.rtf +++ b/Mac/Resources/Credits.rtf @@ -37,9 +37,8 @@ And featuring contributions from {\field{\*\fldinst{HYPERLINK "https://github.co \pard\pardeftab720\li360\sa60\partightenfactor0 {\field{\*\fldinst{HYPERLINK "https://sparkle-project.org/"}}{\fldrslt \cf2 Sparkle}} is by Sparkle Project.\ \pard\pardeftab720\li360\sa60\partightenfactor0 -{\field{\*\fldinst{HYPERLINK "https://computingsound.wixsite.com/cabledmess"}}{\fldrslt \cf2 cabled_mess}} for the notification sound.{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \ -}}\pard\pardeftab720\li360\sa60\partightenfactor0 -\cf2 \ +{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \cf2 cabled_mess}} for the notification sound.{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \ +}}\ \pard\pardeftab720\sa60\partightenfactor0 \f0\b \cf2 Thanks:\ diff --git a/iOS/Resources/Thanks.md b/iOS/Resources/Thanks.md index 87e8b8c3a..407fb8fac 100644 --- a/iOS/Resources/Thanks.md +++ b/iOS/Resources/Thanks.md @@ -1,5 +1,5 @@ Thanks to Sheila and my family; thanks to my friends in Seattle and around the globe; thanks to the ever-patient and ever-awesome NetNewsWire beta testers. -Thanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Slack](https://slack.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com/) for all the extra help with syncing and article rendering — and for [hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/). Thanks to [cabled_mess](https://computingsound.wixsite.com/cabledmess) for the notification sound. +Thanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Slack](https://slack.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com/) for all the extra help with syncing and article rendering — and for [hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/). Thanks to [cabled_mess](https://freesound.org/people/cabled_mess/) for the notification sound. NetNewsWire 6 is dedicated to everyone working to save democracy around the world. From 1e1ad2681682462590ba12ea1f4c7cbf534e411b Mon Sep 17 00:00:00 2001 From: Diggory Laycock Date: Wed, 5 Oct 2022 20:30:15 +0100 Subject: [PATCH 13/15] Revert "Added the name of the notification sound creator to the 'Thanks' section" This reverts commit af6ce4b61b4a8c78439a3178757c39fae9599f78. --- Mac/Resources/Credits.rtf | 6 ++---- iOS/Resources/Thanks.md | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Mac/Resources/Credits.rtf b/Mac/Resources/Credits.rtf index 0743ec129..209671265 100644 --- a/Mac/Resources/Credits.rtf +++ b/Mac/Resources/Credits.rtf @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf2639 +{\rtf1\ansi\ansicpg1252\cocoartf2636 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 LucidaGrande-Bold;\f1\fnil\fcharset0 LucidaGrande;} {\colortbl;\red255\green255\blue255;\red0\green0\blue0;} {\*\expandedcolortbl;;\cssrgb\c0\c0\c0\cname textColor;} @@ -36,9 +36,7 @@ And featuring contributions from {\field{\*\fldinst{HYPERLINK "https://github.co {\field{\*\fldinst{HYPERLINK "https://github.com/ccgus/fmdb"}}{\fldrslt \cf2 FMDB}} (greatest SQLite wrapper ever in history) is by {\field{\*\fldinst{HYPERLINK "http://flyingmeat.com/"}}{\fldrslt Flying Meat Software}}.\ \pard\pardeftab720\li360\sa60\partightenfactor0 {\field{\*\fldinst{HYPERLINK "https://sparkle-project.org/"}}{\fldrslt \cf2 Sparkle}} is by Sparkle Project.\ -\pard\pardeftab720\li360\sa60\partightenfactor0 -{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \cf2 cabled_mess}} for the notification sound.{\field{\*\fldinst{HYPERLINK "https://freesound.org/people/cabled_mess/"}}{\fldrslt \ -}}\ +\ \pard\pardeftab720\sa60\partightenfactor0 \f0\b \cf2 Thanks:\ diff --git a/iOS/Resources/Thanks.md b/iOS/Resources/Thanks.md index 407fb8fac..e22aeac28 100644 --- a/iOS/Resources/Thanks.md +++ b/iOS/Resources/Thanks.md @@ -1,5 +1,5 @@ Thanks to Sheila and my family; thanks to my friends in Seattle and around the globe; thanks to the ever-patient and ever-awesome NetNewsWire beta testers. -Thanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Slack](https://slack.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com/) for all the extra help with syncing and article rendering — and for [hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/). Thanks to [cabled_mess](https://freesound.org/people/cabled_mess/) for the notification sound. +Thanks to [Gus Mueller](https://shapeof.com/) for [FMDB](https://github.com/ccgus/fmdb) by [Flying Meat Software](http://flyingmeat.com/). Thanks to [GitHub](https://github.com) and [Slack](https://slack.com) for making open source collaboration easy and fun. Thanks to [Ben Ubois](https://benubois.com/) at [Feedbin](https://feedbin.com/) for all the extra help with syncing and article rendering — and for [hosting the server for the Reader view](https://feedbin.com/blog/2019/03/11/the-future-of-full-content/). NetNewsWire 6 is dedicated to everyone working to save democracy around the world. From 8497b7bdcdf4266832c35e431d373f0bc3f477ef Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 5 Oct 2022 16:43:31 -0500 Subject: [PATCH 14/15] Fix split view controller unread indicator launch visibility --- iOS/Article/ArticleViewController.swift | 50 ++++++++++--------------- iOS/SceneCoordinator.swift | 2 +- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index 0615c8158..a12370ba6 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -87,6 +87,8 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable { return keyboardManager.keyCommands } + private var lastKnownDisplayMode: UISplitViewController.DisplayMode? + var currentUnreadCount: Int = 0 { didSet { updateUnreadCountIndicator() @@ -342,37 +344,6 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable { configureAppearanceMenu() } - - /// Updates the indicator count in the navigation bar. - /// For iPhone, this indicator is visible if the unread count is > 0. - /// For iPad, this indicator is visible if it is in `portrait` or `unknown` - /// orientation, **and** the unread count is > 0. - /// - Parameter sender: `Any` (optional) - public func updateUnreadCountIndicator(forDisplayMode displayMode: UISplitViewController.DisplayMode? = nil) { - func changeUnreadCountIndicator() { - if currentUnreadCount > 0 { - let unreadCountView = MasterTimelineUnreadCountView(frame: .zero) - unreadCountView.unreadCount = currentUnreadCount - unreadCountView.setFrameIfNotEqual(CGRect(x: 0, y: 0, width: unreadCountView.intrinsicContentSize.width, height: unreadCountView.intrinsicContentSize.height)) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: unreadCountView) - } else { - navigationItem.leftBarButtonItem = nil - } - } - - if UIDevice.current.userInterfaceIdiom == .phone { - changeUnreadCountIndicator() - } else { - if displayMode == nil || displayMode == .secondaryOnly { - changeUnreadCountIndicator() - } else { - navigationItem.leftBarButtonItem = nil - } - } - } - - - // MARK: Notifications @objc dynamic func unreadCountDidChange(_ notification: Notification) { @@ -480,6 +451,12 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable { func setScrollPosition(isShowingExtractedArticle: Bool, articleWindowScrollY: Int) { currentWebViewController?.setScrollPosition(isShowingExtractedArticle: isShowingExtractedArticle, articleWindowScrollY: articleWindowScrollY) } + + public func splitViewControllerWillChangeTo(displayMode: UISplitViewController.DisplayMode) { + lastKnownDisplayMode = displayMode + updateUnreadCountIndicator() + } + } // MARK: Find in Article @@ -638,4 +615,15 @@ private extension ArticleViewController { return controller } + func updateUnreadCountIndicator() { + if currentUnreadCount > 0 && (traitCollection.userInterfaceIdiom == .phone || lastKnownDisplayMode == .secondaryOnly) { + let unreadCountView = MasterTimelineUnreadCountView(frame: .zero) + unreadCountView.unreadCount = currentUnreadCount + unreadCountView.setFrameIfNotEqual(CGRect(x: 0, y: 0, width: unreadCountView.intrinsicContentSize.width, height: unreadCountView.intrinsicContentSize.height)) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: unreadCountView) + } else { + navigationItem.leftBarButtonItem = nil + } + } + } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 8dd9e2e49..103200a22 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1324,7 +1324,7 @@ extension SceneCoordinator: UISplitViewControllerDelegate { } func splitViewController(_ svc: UISplitViewController, willChangeTo displayMode: UISplitViewController.DisplayMode) { - articleViewController?.updateUnreadCountIndicator(forDisplayMode: displayMode) + articleViewController?.splitViewControllerWillChangeTo(displayMode: displayMode) } } From d442a2ed0b15618edaa7a9582d086f2af8569d42 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 6 Oct 2022 05:36:00 -0500 Subject: [PATCH 15/15] Update to the latest RSCore. Fixes #3713 --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index d6f3f5287..2921a00c2 100644 --- a/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/NetNewsWire.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -60,8 +60,8 @@ "repositoryURL": "https://github.com/Ranchero-Software/RSCore.git", "state": { "branch": null, - "revision": "4425a29db97b97c44e9ebee16e6090b116b10055", - "version": "1.0.14" + "revision": "a2f711d64af8f1baefdf0092f57a7f0df7f0e5e8", + "version": "1.0.15" } }, {