Open strike in browser (IOS-264)

This commit is contained in:
Nathan Mattes 2024-05-08 19:37:46 +02:00
parent 5371ad54bf
commit 2d97d67657
4 changed files with 21 additions and 2 deletions

View File

@ -143,7 +143,7 @@ extension DataSourceFacade {
else {
return
}
let mentions = status.entity.mentions ?? []
let mentions = status.entity.mentions
guard let mention = mentions.first(where: { $0.url == href }) else {
_ = provider.coordinator.present(

View File

@ -44,7 +44,13 @@ extension UITableViewDelegate where Self: DataSourceProvider & AuthContextProvid
status: status
)
} else if let accountWarning = notification.entity.accountWarning {
print("// show account warning \(accountWarning.id) in safari")
let url = Mastodon.API.disputesEndpoint(domain: authContext.mastodonAuthenticationBox.domain, strikeId: accountWarning.id)
_ = coordinator.present(
scene: .safari(url: url),
from: self,
transition: .safariPresent(animated: true, completion: nil)
)
} else {
await DataSourceFacade.coordinateToProfileScene(
provider: self,

View File

@ -0,0 +1,9 @@
// Copyright © 2024 Mastodon gGmbH. All rights reserved.
import Foundation
extension Mastodon.API {
public static func disputesEndpoint(domain: String, strikeId: String) -> URL {
return Mastodon.API.webURL(domain: domain).appendingPathComponent("disputes/strikes/\(strikeId)")
}
}

View File

@ -99,6 +99,10 @@ extension Mastodon.API {
public static func profileSettingsURL(domain: String) -> URL {
return URL(string: "\(URL.httpScheme(domain: domain))://" + domain + "/auth/edit")!
}
public static func webURL(domain: String) -> URL {
return URL(string: "\(URL.httpScheme(domain: domain))://" + domain + "/")!
}
}
extension Mastodon.API {