misc: proxy uuid

This commit is contained in:
mrFq1
2023-05-25 23:52:41 +08:00
parent e9e700362e
commit 33a4eab579
5 changed files with 6 additions and 10 deletions

View File

@@ -30,7 +30,6 @@ class ClashProviderResp: Codable {
}
class ClashProvider: Codable {
let id = UUID().uuidString
enum ProviderType: String, Codable {
case Proxy
case String

View File

@@ -97,7 +97,7 @@ class ClashProxySpeedHistory: Codable {
}
class ClashProxy: Codable {
let id = UUID().uuidString
let id: String?
let name: ClashProxyName
let type: ClashProxyType
let all: [ClashProxyName]?
@@ -145,7 +145,7 @@ class ClashProxy: Codable {
}()
private enum CodingKeys: String, CodingKey {
case type, all, history, now, name, udp, xudp, tfo
case type, all, history, now, name, udp, xudp, tfo, id
}
lazy var maxProxyNameLength: CGFloat = {

View File

@@ -16,7 +16,7 @@ class DBProviderStorage: ObservableObject {
}
class DBProxyProvider: ObservableObject, Identifiable {
let id: String
let id = UUID().uuidString
@Published var name: ClashProviderName
@Published var proxies: [DBProxy]
@@ -29,8 +29,6 @@ class DBProxyProvider: ObservableObject, Identifiable {
@Published var updatedAt: String
init(provider: ClashProvider) {
id = provider.id
name = provider.name
proxies = provider.proxies.map(DBProxy.init)
type = provider.type

View File

@@ -22,7 +22,7 @@ class DBProxyStorage: ObservableObject {
}
class DBProxyGroup: ObservableObject, Identifiable {
let id: String
let id = UUID().uuidString
@Published var name: ClashProxyName
@Published var type: ClashProxyType
@Published var now: ClashProxyName? {
@@ -38,7 +38,6 @@ class DBProxyGroup: ObservableObject, Identifiable {
@Published var currentProxy: DBProxy?
init(_ group: ClashProxy, resp: ClashProxyResp) {
id = group.id
name = group.name
type = group.type
now = group.now
@@ -71,7 +70,7 @@ class DBProxy: ObservableObject {
@Published var delayColor: Color
init(_ proxy: ClashProxy) {
id = proxy.id
id = proxy.id ?? UUID().uuidString
name = proxy.name
type = proxy.type
tfo = proxy.tfo

View File

@@ -10,7 +10,7 @@ import SwiftUI
typealias SavedServersAppStorage = [ClashServerAppStorage]
struct ClashServerAppStorage: Codable, Identifiable {
let id = UUID().uuidString
var id = UUID().uuidString
let apiURL: String
let secret: String
}