feat: implement notification for multiple accounts handler

This commit is contained in:
CMK 2021-10-11 20:01:54 +08:00
parent eaa2ef4083
commit cafd4cc3f2
2 changed files with 19 additions and 7 deletions

View File

@ -7,12 +7,12 @@
<key>AppShared.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>42</integer>
<integer>36</integer>
</dict>
<key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>41</integer>
<integer>35</integer>
</dict>
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
<dict>
@ -97,7 +97,7 @@
<key>MastodonIntent.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>43</integer>
<integer>38</integer>
</dict>
<key>MastodonIntents.xcscheme_^#shared#^_</key>
<dict>
@ -117,7 +117,7 @@
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>44</integer>
<integer>37</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>

View File

@ -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 }