ласт воркинг билд с некоторыми патчами ибо могу
This commit is contained in:
parent
e2a4c5d8c0
commit
4c090d4295
@ -3,7 +3,17 @@ import Foundation
|
||||
class APIClient: ObservableObject {
|
||||
private let baseURL = "https://mkch.pooziqo.xyz"
|
||||
private let apiURL = "https://mkch.pooziqo.xyz/api"
|
||||
private let session = URLSession.shared
|
||||
private lazy var session: URLSession = {
|
||||
let config = URLSessionConfiguration.default
|
||||
config.timeoutIntervalForRequest = 20
|
||||
config.timeoutIntervalForResource = 40
|
||||
config.httpAdditionalHeaders = [
|
||||
"Accept": "application/json",
|
||||
"Accept-Language": Locale.preferredLanguages.first ?? "ru-RU",
|
||||
"User-Agent": self.userAgent
|
||||
]
|
||||
return URLSession(configuration: config)
|
||||
}()
|
||||
private var authKey: String = ""
|
||||
private var passcode: String = ""
|
||||
private let userAgent = "MobileMkch/2.1.0-ios-alpha"
|
||||
|
||||
@ -6,9 +6,12 @@ class BackgroundTaskManager {
|
||||
static let shared = BackgroundTaskManager()
|
||||
|
||||
private var backgroundTaskIdentifier: String {
|
||||
if let savedIdentifier = UserDefaults.standard.string(forKey: "BackgroundTaskIdentifier") {
|
||||
return savedIdentifier
|
||||
// Используем идентификатор из Info.plist (BGTaskSchedulerPermittedIdentifiers)
|
||||
if let identifiers = Bundle.main.object(forInfoDictionaryKey: "BGTaskSchedulerPermittedIdentifiers") as? [String],
|
||||
let first = identifiers.first {
|
||||
return first
|
||||
}
|
||||
// Фоллбек на значение по умолчанию
|
||||
return "com.mkch.MobileMkch.backgroundrefresh"
|
||||
}
|
||||
private let notificationManager = NotificationManager.shared
|
||||
|
||||
@ -44,6 +44,9 @@ struct BoardsView: View {
|
||||
}
|
||||
.navigationTitle("Доски mkch")
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
.refreshable {
|
||||
loadBoards()
|
||||
}
|
||||
.onAppear {
|
||||
if boards.isEmpty {
|
||||
loadBoards()
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
import Foundation
|
||||
|
||||
private enum DateFormatterCache {
|
||||
static let iso8601 = ISO8601DateFormatter()
|
||||
}
|
||||
|
||||
struct Board: Codable, Identifiable {
|
||||
let code: String
|
||||
let description: String
|
||||
@ -18,8 +22,7 @@ struct Thread: Codable, Identifiable {
|
||||
let files: [String]
|
||||
|
||||
var creationDate: Date {
|
||||
let formatter = ISO8601DateFormatter()
|
||||
return formatter.date(from: creation) ?? Date()
|
||||
return DateFormatterCache.iso8601.date(from: creation) ?? Date()
|
||||
}
|
||||
|
||||
var ratingValue: Int {
|
||||
@ -40,8 +43,7 @@ struct ThreadDetail: Codable, Identifiable {
|
||||
let files: [String]
|
||||
|
||||
var creationDate: Date {
|
||||
let formatter = ISO8601DateFormatter()
|
||||
return formatter.date(from: creation) ?? Date()
|
||||
return DateFormatterCache.iso8601.date(from: creation) ?? Date()
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,8 +54,7 @@ struct Comment: Codable, Identifiable {
|
||||
let files: [String]
|
||||
|
||||
var creationDate: Date {
|
||||
let formatter = ISO8601DateFormatter()
|
||||
return formatter.date(from: creation) ?? Date()
|
||||
return DateFormatterCache.iso8601.date(from: creation) ?? Date()
|
||||
}
|
||||
|
||||
var formattedText: String {
|
||||
|
||||
@ -71,6 +71,9 @@ struct ThreadDetailView: View {
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.refreshable {
|
||||
loadThreadDetail()
|
||||
}
|
||||
.navigationTitle("#\(thread.id)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
||||
@ -53,6 +53,9 @@ struct ThreadsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.refreshable {
|
||||
loadThreads()
|
||||
}
|
||||
|
||||
if settings.enablePagination && totalPages > 1 {
|
||||
HStack {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user