1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-25 08:21:40 +01:00

feat: add status coordinator support for current active user domain

This commit is contained in:
CMK 2021-05-27 15:55:37 +08:00
parent 680f8509dd
commit 71214a1280

View File

@ -129,7 +129,17 @@ extension StatusProviderFacade {
coordinateToStatusMentionProfileScene(for: .primary, provider: provider, cell: cell, mention: text)
case .url(_, _, let url, _):
guard let url = URL(string: url) else { return }
provider.coordinator.present(scene: .safari(url: url), from: nil, transition: .safariPresent(animated: true, completion: nil))
if let domain = provider.context.authenticationService.activeMastodonAuthenticationBox.value?.domain, url.host == domain,
url.pathComponents.count >= 4,
url.pathComponents[0] == "/",
url.pathComponents[1] == "web",
url.pathComponents[2] == "statuses" {
let statusID = url.pathComponents[3]
let threadViewModel = RemoteThreadViewModel(context: provider.context, statusID: statusID)
provider.coordinator.present(scene: .thread(viewModel: threadViewModel), from: nil, transition: .show)
} else {
provider.coordinator.present(scene: .safari(url: url), from: nil, transition: .safariPresent(animated: true, completion: nil))
}
default:
break
}