2
2
mirror of https://github.com/mastodon/mastodon-ios synced 2025-04-11 22:58:02 +02:00

Quick fix for missing instance configuration

For further work, see IOS-363

Fixes #1394 [BUG] Max. character limit server not honored
Fixes #1396 [REGRESSION] Cannot translate posts
This commit is contained in:
shannon 2025-01-27 10:19:25 -05:00
parent 6e10bca2fe
commit 54861dcf6f
2 changed files with 7 additions and 11 deletions

View File

@ -87,6 +87,9 @@ public struct MastodonAuthentication: Codable, Hashable, UserIdentifier {
accountCreatedAt: Date
) -> Self {
let now = Date()
Task {
await InstanceService.shared.updateInstance(domain: domain)
}
return MastodonAuthentication(
identifier: .init(),
domain: domain,

View File

@ -14,20 +14,13 @@ import MastodonSDK
@MainActor
public final class InstanceService {
static let shared = InstanceService()
var disposeBag = Set<AnyCancellable>()
// input
let backgroundManagedObjectContext: NSManagedObjectContext
weak var apiService: APIService?
// output
init(
apiService: APIService
) {
self.backgroundManagedObjectContext = apiService.backgroundManagedObjectContext
self.apiService = apiService
init() {
AuthenticationServiceProvider.shared.currentActiveUser
.receive(on: DispatchQueue.main)
.asyncMap { [weak self] in
@ -45,7 +38,7 @@ extension InstanceService {
@MainActor
func updateInstance(domain: String) async {
guard let apiService else { return }
let apiService = APIService.shared
guard let authBox = AuthenticationServiceProvider.shared.currentActiveUser.value, authBox.domain == domain else { return }
let response = try? await apiService.instance(domain: domain, authenticationBox: authBox)