Skip to content

Commit af8e48b

Browse files
committed
fix: address PR review comments for download count feature
1 parent 8a3e972 commit af8e48b

File tree

4 files changed

+55
-5
lines changed

4 files changed

+55
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Plugin download count display in Browse Plugins — fetched from GitHub Releases API and cached for 1 hour
1313

14+
### Fixed
15+
16+
- Plugin icon rendering now supports custom asset images (e.g., duckdb-icon) alongside SF Symbols in Installed and Browse tabs
17+
1418
## [0.17.0] - 2026-03-11
1519

1620
### Added

TablePro/Core/Plugins/Registry/DownloadCountService.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ final class DownloadCountService {
108108
guard let cacheDate = UserDefaults.standard.object(forKey: Self.cacheDateKey) as? Date else {
109109
return false
110110
}
111-
return Date().timeIntervalSince(cacheDate) < Self.cacheTTL && !counts.isEmpty
111+
return Date().timeIntervalSince(cacheDate) < Self.cacheTTL
112112
}
113113

114114
private func loadCache() {
115-
guard let data = UserDefaults.standard.data(forKey: Self.cacheKey),
115+
guard isCacheValid(),
116+
let data = UserDefaults.standard.data(forKey: Self.cacheKey),
116117
let cached = try? JSONDecoder().decode([String: Int].self, from: data) else {
118+
counts = [:]
117119
return
118120
}
119121
counts = cached

TablePro/Resources/Localizable.xcstrings

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,37 @@
305305
}
306306
}
307307
},
308+
"%@ download" : {
309+
"localizations" : {
310+
"vi" : {
311+
"stringUnit" : {
312+
"state" : "translated",
313+
"value" : "%@ lượt tải"
314+
}
315+
},
316+
"zh-Hans" : {
317+
"stringUnit" : {
318+
"state" : "translated",
319+
"value" : "%@ 次下载"
320+
}
321+
}
322+
}
323+
},
308324
"%@ downloads" : {
309-
325+
"localizations" : {
326+
"vi" : {
327+
"stringUnit" : {
328+
"state" : "translated",
329+
"value" : "%@ lượt tải"
330+
}
331+
},
332+
"zh-Hans" : {
333+
"stringUnit" : {
334+
"state" : "translated",
335+
"value" : "%@ 次下载"
336+
}
337+
}
338+
}
310339
},
311340
"%@ is already assigned to \"%@\". Reassigning will remove it from that action." : {
312341
"localizations" : {
@@ -5664,7 +5693,20 @@
56645693
}
56655694
},
56665695
"Downloads" : {
5667-
5696+
"localizations" : {
5697+
"vi" : {
5698+
"stringUnit" : {
5699+
"state" : "translated",
5700+
"value" : "Lượt tải"
5701+
}
5702+
},
5703+
"zh-Hans" : {
5704+
"stringUnit" : {
5705+
"state" : "translated",
5706+
"value" : "下载次数"
5707+
}
5708+
}
5709+
}
56685710
},
56695711
"Drop" : {
56705712
"extractionState" : "stale",

TablePro/Views/Settings/Plugins/RegistryPluginRow.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ struct RegistryPluginRow: View {
8585

8686
private func formattedCount(_ count: Int) -> String {
8787
let formatted = Self.decimalFormatter.string(from: NSNumber(value: count)) ?? "\(count)"
88-
return String(localized: "\(formatted) downloads")
88+
return count == 1
89+
? String(localized: "\(formatted) download")
90+
: String(localized: "\(formatted) downloads")
8991
}
9092

9193
@ViewBuilder

0 commit comments

Comments
 (0)