This commit is contained in:
anlicheng 2025-06-16 12:55:51 +08:00
parent 276ab30a07
commit c9bc301604
3 changed files with 16 additions and 9 deletions

View File

@ -5,6 +5,7 @@
// Created by on 2025/2/19.
//
import Foundation
import SwiftUI
struct API {
@ -44,9 +45,14 @@ struct API {
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
// Convert parameters to JSON data
let parameters: [String:String] = [
let parameters: [String:Any] = [
"user_id": userId,
"token": token
"token": token,
"info": [
"version": await UIDevice.current.systemVersion,
"lang": NSLocale.preferredLanguages.first ?? "",
"vendorId": await UIDevice.current.identifierForVendor?.uuidString ?? ""
]
]
let jsonData = try! JSONSerialization.data(withJSONObject: parameters, options: [])
request.httpBody = jsonData

View File

@ -65,9 +65,6 @@ final class IndexModel {
// , 便
var dramaGroupElements: [GroupElement] = []
// GroupLabel
var showFloatGroupLabel: Bool = false
var follow_num: String = "0"
// group_name
@ -130,7 +127,7 @@ final class IndexModel {
func offsetChanged(offset: Double) {
// offset
var rangeGroupId: String? = nil
let (spacing, labelHeight, elementHeight) = self.elementHeight
let (_, labelHeight, elementHeight) = self.elementHeight
self.dramaGroupElements.forEach { element in
switch element {
@ -166,9 +163,9 @@ final class IndexModel {
await MainActor.run {
self.updateDramaGroups = result.update_dramas
self.dramaGroupElements = transformUpdateDramaGroups(groups: result.update_dramas)
self.fixedDramaGroup = result.update_dramas.first
self.dramaGroupElements = transformUpdateDramaGroups(groups: result.update_dramas)
self.follow_num = result.follow_num >= 100 ? "99+" : "\(result.follow_num)"
}
}
@ -217,6 +214,8 @@ final class IndexModel {
displayDramaGroups(self.updateDramaGroups, label: "before")
await MainActor.run {
self.updateDramaGroups = preappendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
self.fixedDramaGroup = self.updateDramaGroups.first
self.dramaGroupElements = transformUpdateDramaGroups(groups: self.updateDramaGroups)
}
displayDramaGroups(self.updateDramaGroups, label: "after")
@ -235,6 +234,8 @@ final class IndexModel {
displayDramaGroups(self.updateDramaGroups, label: "before")
await MainActor.run {
self.updateDramaGroups = appendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
self.fixedDramaGroup = self.updateDramaGroups.first
self.dramaGroupElements = transformUpdateDramaGroups(groups: self.updateDramaGroups)
}

View File

@ -44,7 +44,6 @@ struct dimensionhubApp: App {
WindowGroup {
NavigationStack(path: $appNav.path) {
IndexView()
//TestView()
.navigationDestination(for: AppNavigation.Destination.self) { dest in
switch dest {
case .detail(id: let id):
@ -59,6 +58,7 @@ struct dimensionhubApp: App {
.navigationViewStyle(.stack)
.tint(.black)
.environmentObject(appNav)
.preferredColorScheme(.light)
}
.modelContainer(sharedModelContainer)
}