Fix some warnings
This commit is contained in:
parent
9947335b20
commit
a2aa9b70d2
|
@ -203,7 +203,7 @@ extension MastodonPickServerViewModel {
|
|||
|
||||
func chooseRandomServer() -> Mastodon.Entity.Server? {
|
||||
|
||||
let language = Locale.autoupdatingCurrent.languageCode?.lowercased() ?? "en"
|
||||
let language = Locale.autoupdatingCurrent.language.languageCode?.identifier.lowercased() ?? "en"
|
||||
|
||||
let servers = indexedServers.value
|
||||
guard servers.isNotEmpty else { return nil }
|
||||
|
|
|
@ -65,7 +65,7 @@ extension ThreadViewModel.LoadThreadState {
|
|||
authenticationBox: viewModel.authContext.mastodonAuthenticationBox
|
||||
)
|
||||
|
||||
await enter(state: NoMore.self)
|
||||
enter(state: NoMore.self)
|
||||
|
||||
// assert(!Thread.isMainThread)
|
||||
// await Task.sleep(1_000_000_000) // 1s delay to prevent UI render issue
|
||||
|
@ -88,7 +88,7 @@ extension ThreadViewModel.LoadThreadState {
|
|||
}
|
||||
)
|
||||
} catch {
|
||||
await enter(state: Fail.self)
|
||||
enter(state: Fail.self)
|
||||
}
|
||||
} // end Task
|
||||
}
|
||||
|
|
|
@ -94,18 +94,6 @@ public final class CoreDataStack {
|
|||
container.viewContext.automaticallyMergesChangesFromParent = true
|
||||
|
||||
callback()
|
||||
|
||||
#if DEBUG
|
||||
do {
|
||||
let storeURL = URL.storeURL(for: AppName.groupID, databaseName: "shared")
|
||||
let data = try Data(contentsOf: storeURL)
|
||||
let formatter = ByteCountFormatter()
|
||||
formatter.allowedUnits = [.useMB]
|
||||
formatter.countStyle = .file
|
||||
let size = formatter.string(fromByteCount: Int64(data.count))
|
||||
} catch {
|
||||
}
|
||||
#endif
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
//
|
||||
// Mastodon+Entity+Field.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by MainasuK Cirno on 2021-5-25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MastodonSDK
|
||||
|
||||
extension Mastodon.Entity.Field: Equatable {
|
||||
public static func == (lhs: Mastodon.Entity.Field, rhs: Mastodon.Entity.Field) -> Bool {
|
||||
return lhs.name == rhs.name &&
|
||||
lhs.value == rhs.value &&
|
||||
lhs.verifiedAt == rhs.verifiedAt
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -50,7 +50,7 @@ extension APIService {
|
|||
domain: domain,
|
||||
authorization: authorization).singleOutput()
|
||||
|
||||
let responseHistory = try await Mastodon.API.Statuses.editHistory(
|
||||
_ = try await Mastodon.API.Statuses.editHistory(
|
||||
forStatusID: statusID,
|
||||
session: session,
|
||||
domain: domain,
|
||||
|
|
|
@ -238,7 +238,7 @@ extension NotificationService {
|
|||
}
|
||||
|
||||
private func authenticationBox(for pushNotification: MastodonPushNotification) async throws -> MastodonAuthenticationBox? {
|
||||
guard let authenticationService = self.authenticationService else { return nil }
|
||||
guard self.authenticationService != nil else { return nil }
|
||||
let results = AuthenticationServiceProvider.shared.authentications.filter { $0.userAccessToken == pushNotification.accessToken }
|
||||
guard let authentication = results.first else { return nil }
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ extension ComposeContentViewModel: UITextViewDelegate {
|
|||
switch textView {
|
||||
case contentMetaText?.textView:
|
||||
// update model
|
||||
guard let metaText = self.contentMetaText else {
|
||||
guard self.contentMetaText != nil else {
|
||||
assertionFailure()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ public final class ComposeContentViewModel: NSObject, ObservableObject {
|
|||
|
||||
let recentLanguages = context.settingService.currentSetting.value?.recentLanguages ?? []
|
||||
self.recentLanguages = recentLanguages
|
||||
self.language = recentLanguages.first ?? Locale.current.languageCode ?? "en"
|
||||
self.language = recentLanguages.first ?? Locale.current.language.languageCode?.identifier ?? "en"
|
||||
super.init()
|
||||
// end init
|
||||
|
||||
|
@ -490,7 +490,7 @@ extension ComposeContentViewModel {
|
|||
.flatMap { settings in
|
||||
if let settings {
|
||||
return settings.publisher(for: \.recentLanguages, options: .initial).eraseToAnyPublisher()
|
||||
} else if let code = Locale.current.languageCode {
|
||||
} else if let code = Locale.current.language.languageCode?.identifier {
|
||||
return Just([code]).eraseToAnyPublisher()
|
||||
}
|
||||
return Just([]).eraseToAnyPublisher()
|
||||
|
|
|
@ -32,7 +32,7 @@ extension ComposeContentToolbarView {
|
|||
@Published var isAttachmentButtonEnabled = false
|
||||
@Published var isPollButtonEnabled = false
|
||||
|
||||
@Published var language = Locale.current.languageCode ?? "en"
|
||||
@Published var language = Locale.current.language.languageCode?.identifier ?? "en"
|
||||
@Published var recentLanguages: [String] = []
|
||||
|
||||
@Published public var maxTextInputLimit = 500
|
||||
|
|
|
@ -14,7 +14,7 @@ struct LanguagePicker: View {
|
|||
let locales = Locale.availableIdentifiers.map(Locale.init(identifier:))
|
||||
var languages: [String: Language] = [:]
|
||||
for locale in locales {
|
||||
if let code = locale.languageCode,
|
||||
if let code = locale.language.languageCode?.identifier,
|
||||
let endonym = locale.localizedString(forLanguageCode: code),
|
||||
let exonym = Locale.current.localizedString(forLanguageCode: code) {
|
||||
// don’t overwrite the “base” language
|
||||
|
|
Loading…
Reference in New Issue