From 1fb350b89d5e77241076a7625f41dca99614fde0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 26 Feb 2026 08:58:31 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Remove=20legacy=20otherClicks=20?= =?UTF-8?q?field=20and=20migration=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've removed the `otherClicks` field from the `AppStats` and `DailyStats` data models. This field was originally used for backward compatibility with older builds where side clicks were stored together. Since this migration is no longer needed, removing it cleans up the data model and improves maintainability. - Removed `otherClicks` case from `CodingKeys` in `KeyStats/AppStats.swift` and `KeyStats/StatsManager.swift`. - Removed backward compatibility decoding logic in `init(from:)` for both structures. - Verified that all references have been successfully removed from the codebase. Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: debugtheworldbot <62830430+debugtheworldbot@users.noreply.github.com> --- KeyStats/AppStats.swift | 6 ------ KeyStats/StatsManager.swift | 6 ------ 2 files changed, 12 deletions(-) diff --git a/KeyStats/AppStats.swift b/KeyStats/AppStats.swift index a0f8415..3b3d091 100644 --- a/KeyStats/AppStats.swift +++ b/KeyStats/AppStats.swift @@ -29,8 +29,6 @@ struct AppStats: Codable { case rightClicks case sideBackClicks case sideForwardClicks - // legacy field - case otherClicks case scrollDistance } @@ -43,10 +41,6 @@ struct AppStats: Codable { rightClicks = try container.decodeIfPresent(Int.self, forKey: .rightClicks) ?? 0 sideBackClicks = try container.decodeIfPresent(Int.self, forKey: .sideBackClicks) ?? 0 sideForwardClicks = try container.decodeIfPresent(Int.self, forKey: .sideForwardClicks) ?? 0 - // Backward compatibility: old builds stored all side clicks in `otherClicks`. - if !container.contains(.sideBackClicks) && !container.contains(.sideForwardClicks) { - sideBackClicks = try container.decodeIfPresent(Int.self, forKey: .otherClicks) ?? 0 - } scrollDistance = try container.decodeIfPresent(Double.self, forKey: .scrollDistance) ?? 0 } diff --git a/KeyStats/StatsManager.swift b/KeyStats/StatsManager.swift index f13e83b..c02c432 100644 --- a/KeyStats/StatsManager.swift +++ b/KeyStats/StatsManager.swift @@ -60,8 +60,6 @@ struct DailyStats: Codable { case rightClicks case sideBackClicks case sideForwardClicks - // legacy field - case otherClicks case mouseDistance case scrollDistance case appStats @@ -76,10 +74,6 @@ struct DailyStats: Codable { rightClicks = try container.decodeIfPresent(Int.self, forKey: .rightClicks) ?? 0 sideBackClicks = try container.decodeIfPresent(Int.self, forKey: .sideBackClicks) ?? 0 sideForwardClicks = try container.decodeIfPresent(Int.self, forKey: .sideForwardClicks) ?? 0 - // Backward compatibility: old builds stored all side clicks in `otherClicks`. - if !container.contains(.sideBackClicks) && !container.contains(.sideForwardClicks) { - sideBackClicks = try container.decodeIfPresent(Int.self, forKey: .otherClicks) ?? 0 - } mouseDistance = try container.decodeIfPresent(Double.self, forKey: .mouseDistance) ?? 0 scrollDistance = try container.decodeIfPresent(Double.self, forKey: .scrollDistance) ?? 0 appStats = try container.decodeIfPresent([String: AppStats].self, forKey: .appStats) ?? [:]