From 0ae3a9359e4cdf6ae5b669c4affd91662463f370 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Wed, 01 Jul 2026 23:17:36 +0800
Subject: [PATCH] Prepare TagLauncher 8.3.1 candidate
---
src/Apptag/TagEditorView.swift | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/Apptag/TagEditorView.swift b/src/Apptag/TagEditorView.swift
index 1d2963b..701e532 100644
--- a/src/Apptag/TagEditorView.swift
+++ b/src/Apptag/TagEditorView.swift
@@ -11,6 +11,8 @@
let excludedTagNames: Set<String>
let isCustomColorUnlocked: Bool
let onLockedCustomColor: () -> Void
+ let onCustomContainerQuotaExceeded: (ProCustomContainerQuotaStatus) -> Void
+ let onCustomContainerQuotaStatusChanged: (ProCustomContainerQuotaStatus) -> Void
var topLeadingAccessory: AnyView? = nil
var onRefresh: (() -> Void)?
@@ -101,7 +103,8 @@
HStack(spacing: 4) {
ForEach(TagColor.allIndices, id: \.self) { idx in
ColorSwatch(index: idx, isSelected: !hasCustomColor && idx == colorIndex) {
- TagEditor.setColor(idx, for: tagName)
+ let result = TagEditor.setColor(idx, for: tagName)
+ guard handleMutationResult(result) else { return }
tagColors[tagName] = idx
tagCustomColors.removeValue(forKey: tagName)
onRefresh?()
@@ -179,7 +182,8 @@
private func commitTagRename(_ oldName: String) {
let newName = editingTagText.trimmingCharacters(in: .whitespaces)
guard !newName.isEmpty, newName != oldName else { editingTagName = nil; return }
- TagEditor.renameTag(from: oldName, to: newName)
+ let result = TagEditor.renameTag(from: oldName, to: newName)
+ guard handleMutationResult(result) else { return }
tagColors[newName] = tagColors[oldName]
tagColors.removeValue(forKey: oldName)
tagCustomColors[newName] = tagCustomColors[oldName]
@@ -192,16 +196,19 @@
private func addNewTag() {
let name = newTagNameText.trimmingCharacters(in: .whitespaces)
guard !name.isEmpty else { return }
+ let result = TagEditor.createTag(name, color: newTagColorIndex)
+ guard handleMutationResult(result) else { return }
tagColors[name] = newTagColorIndex
- TagEditor.createTag(name, color: newTagColorIndex)
addingNewTag = false
newTagNameText = ""
+ onRefresh?()
}
private func deleteTag(_ name: String) {
TagEditor.deleteTagCompletely(name)
tagColors.removeValue(forKey: name)
tagCustomColors.removeValue(forKey: name)
+ onCustomContainerQuotaStatusChanged(ProEntitlementPolicy.customContainerQuotaStatus())
onRefresh?()
}
@@ -275,8 +282,24 @@
return
}
tagCustomColors[tagName] = customColor
+ onCustomContainerQuotaStatusChanged(ProEntitlementPolicy.customContainerQuotaStatus())
onRefresh?()
}
)
}
+
+ @discardableResult
+ private func handleMutationResult(_ result: TagEditorMutationResult) -> Bool {
+ switch result {
+ case .saved:
+ onCustomContainerQuotaStatusChanged(ProEntitlementPolicy.customContainerQuotaStatus())
+ return true
+ case .noChange:
+ return false
+ case .blockedCustomContainerQuota(let status):
+ onCustomContainerQuotaStatusChanged(status)
+ onCustomContainerQuotaExceeded(status)
+ return false
+ }
+ }
}
--
Gitblit v1.9.3