feat(ui): 接入 vendor 真实图标库 + 图标选择器
- assets/icons/ 共 80+ 张真实品牌图标嵌入 UI 包 - entry 新增 IconKey 字段,持久化到 config.Entry.IconName - iconPickerDialog 网格布局图标选择器 - Add 完成后自动弹出图标选择器,Skip 则用 vendor 占位图 - ⋯ 菜单新增 "Change icon..." 项 - vendorIconFor 解析顺序:catalog → vendor 占位 → qr 兜底
This commit is contained in:
@@ -26,11 +26,16 @@ func entryProgressRing(gtx layout.Context, en *entry) layout.Dimensions {
|
||||
}
|
||||
|
||||
vendor := en.Auth.Name()
|
||||
// Prefer the user-chosen brand icon over the vendor placeholder.
|
||||
iconKey := vendor
|
||||
if en.IconKey != "" {
|
||||
iconKey = en.IconKey
|
||||
}
|
||||
|
||||
if vendor == "hotp" {
|
||||
// HOTP has no period to visualise — just show the icon scaled
|
||||
// to the full slot so rows still align.
|
||||
return drawCenteredIcon(gtx, vendor, ringDp, ringDp)
|
||||
return drawCenteredIcon(gtx, iconKey, ringDp, ringDp)
|
||||
}
|
||||
|
||||
period := totpPeriod(en.Auth)
|
||||
@@ -64,7 +69,7 @@ func entryProgressRing(gtx layout.Context, en *entry) layout.Dimensions {
|
||||
iconGtx.Constraints.Min = image.Pt(iconPx, iconPx)
|
||||
iconGtx.Constraints.Max = image.Pt(iconPx, iconPx)
|
||||
macro := op.Record(gtx.Ops)
|
||||
paintIcon(iconGtx, vendor)
|
||||
paintIcon(iconGtx, iconKey)
|
||||
call := macro.Stop()
|
||||
offset := image.Pt(
|
||||
(ringDims.Size.X-iconPx)/2,
|
||||
|
||||
Reference in New Issue
Block a user