From d79ed55b0cefca998b1e0851c6f127eccc9cc35b Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 27 Jul 2021 14:03:22 +0800 Subject: [PATCH] fix: "New Post" quick action not check precondition issue --- Mastodon/Supporting Files/SceneDelegate.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Mastodon/Supporting Files/SceneDelegate.swift b/Mastodon/Supporting Files/SceneDelegate.swift index 05ff8850..d0067129 100644 --- a/Mastodon/Supporting Files/SceneDelegate.swift +++ b/Mastodon/Supporting Files/SceneDelegate.swift @@ -132,9 +132,13 @@ extension SceneDelegate { if coordinator?.tabBarController.topMost is ComposeViewController { logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): composing…") } else { - let composeViewModel = ComposeViewModel(context: AppContext.shared, composeKind: .post) - coordinator?.present(scene: .compose(viewModel: composeViewModel), from: nil, transition: .modal(animated: true, completion: nil)) - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): present compose scene") + if AppContext.shared.authenticationService.activeMastodonAuthenticationBox.value == nil { + logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): not authenticated") + } else { + let composeViewModel = ComposeViewModel(context: AppContext.shared, composeKind: .post) + coordinator?.present(scene: .compose(viewModel: composeViewModel), from: nil, transition: .modal(animated: true, completion: nil)) + logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): present compose scene") + } } case "org.joinmastodon.app.search": coordinator?.switchToTabBar(tab: .search)