Able to clear status on watchOS

🐛 Fix some bugs in status on watchOS
This commit is contained in:
2025-10-30 01:15:42 +08:00
parent dbcd1b6d36
commit b57caf56db
2 changed files with 49 additions and 8 deletions

View File

@@ -148,9 +148,9 @@ class NetworkService {
}
func createOrUpdateStatus(attitude: Int, isInvisible: Bool, isNotDisturb: Bool, label: String?, token: String, serverUrl: String) async throws -> SnAccountStatus {
// First check if status exists
// Check if there's already a customized status
let existingStatus = try? await fetchAccountStatus(token: token, serverUrl: serverUrl)
let method = existingStatus == nil ? "POST" : "PATCH"
let method = (existingStatus?.isCustomized == true) ? "PATCH" : "POST"
guard let baseURL = URL(string: serverUrl) else {
throw URLError(.badURL)