From bcceca83ce966598e00e0319d85ec11d6df9d272 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Tue, 30 Jun 2026 03:44:54 +0800
Subject: [PATCH] Freeze TagLauncher 8.2.8 build 20260630.0128

---
 src/Apptag/ContentView.swift |   55 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/src/Apptag/ContentView.swift b/src/Apptag/ContentView.swift
index 743ec5f..4a9cd47 100644
--- a/src/Apptag/ContentView.swift
+++ b/src/Apptag/ContentView.swift
@@ -19,6 +19,7 @@
     static let theme = "theme"
     static let tags = "tags"
     static let data = "data"
+    static let pro = "pro"
     static let about = "about"
 }
 
@@ -214,19 +215,21 @@
 struct TagPill: View {
     let name: String
     let colorIndex: Int
+    var customColor: TagCustomColor? = nil
     var dragModeActive: Bool = false
     var isDragging: Bool = false
     let action: () -> Void
 
+    private var resolvedNSColor: NSColor {
+        TagColor.nsColor(for: colorIndex, customColor: customColor)
+    }
+
     private var bgColor: Color {
-        Color(nsColor: TagColor.nsColor(for: colorIndex))
+        Color(nsColor: resolvedNSColor)
     }
 
     private var textColor: Color {
-        if colorIndex == 0 || colorIndex == 5 {
-            return .primary
-        }
-        return .white
+        TagColor.prefersDarkText(for: resolvedNSColor) ? .primary : .white
     }
 
     var body: some View {
@@ -253,15 +256,21 @@
 struct SideTagPill: View {
     let name: String
     let colorIndex: Int
+    var customColor: TagCustomColor? = nil
     var dragModeActive: Bool = false
     var isDragging: Bool = false
     let action: () -> Void
 
-    private var bgColor: Color {
-        Color(nsColor: TagColor.nsColor(for: colorIndex))
+    private var resolvedNSColor: NSColor {
+        TagColor.nsColor(for: colorIndex, customColor: customColor)
     }
+
+    private var bgColor: Color {
+        Color(nsColor: resolvedNSColor)
+    }
+
     private var textColor: Color {
-        colorIndex == 0 || colorIndex == 5 ? .primary : .white
+        TagColor.prefersDarkText(for: resolvedNSColor) ? .primary : .white
     }
 
     var body: some View {
@@ -376,6 +385,7 @@
     @State private var allApps: [AppInfo] = []
     @State private var displayGroups: [TagGroup] = []
     @State private var tagColors: [String: Int] = [:]
+    @State private var tagCustomColors: [String: TagCustomColor] = [:]
     @State private var tagDefinitions: [String: TagDatabase.TagDef] = [:]
     @State private var containerAppOrder: [String: [String]] = [:]
     @State private var groupLayoutVersion = 0
@@ -499,6 +509,10 @@
         )
     }
 
+    private var renderedDisplayMode: String {
+        ProEntitlementPolicy.effectiveDisplayMode(for: displayMode)
+    }
+
     private func storedThemeTuning(for theme: AppGridTheme) -> Double? {
         switch theme {
         case .deepBlue:
@@ -519,7 +533,7 @@
     }
 
     private var isColorlessContainerMode: Bool {
-        displayMode == "container" || displayMode == "gridContainer"
+        renderedDisplayMode == "container" || renderedDisplayMode == "gridContainer"
     }
 
     private var shouldShowUsageTips: Bool {
@@ -740,6 +754,8 @@
             // Always sync tag list from database when entering edit mode
             let store = TagDatabase.load()
             tagColors = store.tags.mapValues { $0.color }
+            tagCustomColors = store.tags.compactMapValues { $0.customColor }
+            tagDefinitions = store.tags
             draggedTagNames = TagEditor.orderedTagNames()
         }
         editPhase = phase
@@ -1185,6 +1201,7 @@
             HStack(spacing: 8) {
                 ForEach(tagLabels) { tag in
                     TagPill(name: tag.name, colorIndex: tag.colorIndex,
+                            customColor: tag.customColor,
                             dragModeActive: tagNavDragModeActive && canReorderTag(tag.name),
                             isDragging: tagNavDragItem == tag.name,
                             action: {
@@ -1212,6 +1229,7 @@
             VStack(spacing: 6) {
                 ForEach(tagLabels) { tag in
                     SideTagPill(name: tag.name, colorIndex: tag.colorIndex,
+                                customColor: tag.customColor,
                                 dragModeActive: tagNavDragModeActive && canReorderTag(tag.name),
                                 isDragging: tagNavDragItem == tag.name,
                                 action: {
@@ -1249,7 +1267,8 @@
                 AppGridCollectionView(
                     groups: displayGroups,
                     tagColors: tagColors,
-                    displayMode: displayMode,
+                    tagCustomColors: tagCustomColors,
+                    displayMode: renderedDisplayMode,
                     iconSize: iconSize,
                     showNames: !hideAppNames,
                     appGridTheme: renderedAppGridTheme,
@@ -1376,7 +1395,10 @@
 
             TagEditorView(
                 tagColors: $tagColors,
+                tagCustomColors: $tagCustomColors,
                 excludedTagNames: ["Mac自带", defaultGroupName],
+                isCustomColorUnlocked: proEntitlement.isUnlocked,
+                onLockedCustomColor: { presentProPrompt(for: .customTagColors) },
                 onRefresh: { refreshApps() }
             )
         }
@@ -2009,7 +2031,13 @@
     }
 
     private var tagLabels: [TagNavigationItem] {
-        displayGroups.map { TagNavigationItem(name: $0.name, colorIndex: tagColors[$0.name] ?? 0) }
+        displayGroups.map {
+            TagNavigationItem(
+                name: $0.name,
+                colorIndex: tagColors[$0.name] ?? 0,
+                customColor: tagCustomColors[$0.name]
+            )
+        }
     }
 
     private var editGroups: [TagGroup] {
@@ -2229,6 +2257,10 @@
         if let preview = proEntitlement.themePreviewState {
             appGridThemeID = preview.theme.rawValue
             proEntitlement.stopThemePreview()
+        }
+        if let preview = proEntitlement.displayModePreviewState {
+            displayMode = preview.displayMode
+            proEntitlement.stopDisplayModePreview()
         }
 
         let hadPrompt = appGridInteraction.proPrompt != nil
@@ -2946,6 +2978,7 @@
         quickSearchDocuments = snapshot.quickSearchDocuments
         tagColors = snapshot.tagColors
         tagDefinitions = snapshot.tagDefinitions
+        tagCustomColors = snapshot.tagDefinitions.compactMapValues { $0.customColor }
         containerAppOrder = snapshot.containerAppOrder
         draggedTagNames = snapshot.tagOrder
         rebuildDisplayGroups(apps: snapshot.apps, tagOrder: snapshot.tagOrder)

--
Gitblit v1.9.3