From cafd4cc3f2ebc9a9a15a201ec3ee785375f94040 Mon Sep 17 00:00:00 2001 From: CMK Date: Mon, 11 Oct 2021 20:01:54 +0800 Subject: [PATCH] feat: implement notification for multiple accounts handler --- .../xcschemes/xcschememanagement.plist | 8 ++++---- Mastodon/Coordinator/SceneCoordinator.swift | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 915ce8a0f..21e265788 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,12 +7,12 @@ AppShared.xcscheme_^#shared#^_ orderHint - 42 + 36 CoreDataStack.xcscheme_^#shared#^_ orderHint - 41 + 35 Mastodon - ASDK.xcscheme_^#shared#^_ @@ -97,7 +97,7 @@ MastodonIntent.xcscheme_^#shared#^_ orderHint - 43 + 38 MastodonIntents.xcscheme_^#shared#^_ @@ -117,7 +117,7 @@ ShareActionExtension.xcscheme_^#shared#^_ orderHint - 44 + 37 SuppressBuildableAutocreation diff --git a/Mastodon/Coordinator/SceneCoordinator.swift b/Mastodon/Coordinator/SceneCoordinator.swift index 87e97a536..5df6f7e98 100644 --- a/Mastodon/Coordinator/SceneCoordinator.swift +++ b/Mastodon/Coordinator/SceneCoordinator.swift @@ -94,9 +94,21 @@ final public class SceneCoordinator { guard let self = self else { return } // Note: - // show (push) on phone - // showDetail in .secondary in UISplitViewController on pad - let from = self.splitViewController?.topMost ?? self.tabBarController.topMost + // show (push) on phone or pad (compact) + // showDetail in .secondary in UISplitViewController on pad (expand) + let from: UIViewController? = { + if let splitViewController = self.splitViewController { + if splitViewController.mainTabBarController.topMost?.view.window != nil { + // compact + return splitViewController.mainTabBarController.topMost + } else { + // expand + return splitViewController.viewController(for: .supplementary) + } + } else { + return self.tabBarController.topMost + } + }() // show notification related content guard let type = Mastodon.Entity.Notification.NotificationType(rawValue: pushNotification.notificationType) else { return }