Skip to content

Commit

Permalink
proof icon full darkmode assets (keybase#22282)
Browse files Browse the repository at this point in the history
* proof icon full darkmode assets

* remove dead
  • Loading branch information
mlsteele authored Jan 31, 2020
1 parent 48e0eb0 commit d9f57d1
Show file tree
Hide file tree
Showing 28 changed files with 214 additions and 178 deletions.
10 changes: 8 additions & 2 deletions go/externals/icon.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ func normalizeIconKey(key string) string {
}
}

func MakeIcons(mctx libkb.MetaContext, serviceKey, imgName string, size int) (res []keybase1.SizedImage) {
const IconTypeSmall = "logo_black"
const IconTypeSmallDarkmode = "logo_white"
const IconTypeFull = "logo_full"
const IconTypeFullDarkmode = "logo_full_darkmode"

func MakeIcons(mctx libkb.MetaContext, serviceKey, iconType string, size int) (res []keybase1.SizedImage) {
for _, factor := range []int{1, 2} {
factorix := ""
if factor > 1 {
Expand All @@ -37,7 +42,8 @@ func MakeIcons(mctx libkb.MetaContext, serviceKey, imgName string, size int) (re
Path: strings.Join([]string{site,
"images/paramproofs/services",
normalizeIconKey(serviceKey),
fmt.Sprintf("%v_%v%v.png", imgName, size, factorix),
// The 'c' query parameter is just for cache busting. It's ignored by the server.
fmt.Sprintf("%v_%v%v.png?c=3", iconType, size, factorix),
}, "/"),
Width: size * factor,
})
Expand Down
68 changes: 36 additions & 32 deletions go/identify3/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,10 @@ func (i *UIAdapter) rowPartial(mctx libkb.MetaContext, proof keybase1.RemoteProo
default:
row.SiteURL = humanURLOrSigchainURL
}
row.SiteIcon = externals.MakeIcons(mctx, iconKey, "logo_black", 16)
row.SiteIconFull = externals.MakeIcons(mctx, iconKey, "logo_full", 64)
row.SiteIconWhite = externals.MakeIcons(mctx, iconKey, "logo_white", 16)
row.SiteIcon = externals.MakeIcons(mctx, iconKey, externals.IconTypeSmall, 16)
row.SiteIconDarkmode = externals.MakeIcons(mctx, iconKey, externals.IconTypeSmallDarkmode, 16)
row.SiteIconFull = externals.MakeIcons(mctx, iconKey, externals.IconTypeFull, 64)
row.SiteIconFullDarkmode = externals.MakeIcons(mctx, iconKey, externals.IconTypeFullDarkmode, 64)
return row
}

Expand Down Expand Up @@ -357,11 +358,12 @@ func (i *UIAdapter) displayKey(mctx libkb.MetaContext, key keybase1.IdentifyKey)
Priority: i.priority("pgp"),
SiteURL: i.makeKeybaseProfileURL(mctx),
// key.SigID is blank if the PGP key was there pre-sigchain
ProofURL: i.makeSigchainViewURL(mctx, key.SigID),
SiteIcon: externals.MakeIcons(mctx, "pgp", "logo_black", 16),
SiteIconFull: externals.MakeIcons(mctx, "pgp", "logo_full", 64),
SiteIconWhite: externals.MakeIcons(mctx, "pgp", "logo_white", 16),
Kid: &key.KID,
ProofURL: i.makeSigchainViewURL(mctx, key.SigID),
SiteIcon: externals.MakeIcons(mctx, "pgp", externals.IconTypeSmall, 16),
SiteIconDarkmode: externals.MakeIcons(mctx, "pgp", externals.IconTypeSmallDarkmode, 16),
SiteIconFull: externals.MakeIcons(mctx, "pgp", externals.IconTypeFull, 64),
SiteIconFullDarkmode: externals.MakeIcons(mctx, "pgp", externals.IconTypeFullDarkmode, 64),
Kid: &key.KID,
}

switch {
Expand Down Expand Up @@ -486,18 +488,19 @@ func (i *UIAdapter) plumbCryptocurrency(mctx libkb.MetaContext, crypto keybase1.
mctx.Debug("unrecgonized crypto family: %v, %v", crypto.Type, crypto.Family)
}
i.updateRow(mctx, keybase1.Identify3Row{
Key: key,
Value: crypto.Address,
Priority: i.priority(key),
State: keybase1.Identify3RowState_VALID,
Color: i.getColorForValid(i.iFollowThem),
SigID: crypto.SigID,
Ctime: 0,
SiteURL: i.makeSigchainViewURL(mctx, crypto.SigID),
SiteIcon: externals.MakeIcons(mctx, key, "logo_black", 16),
SiteIconFull: externals.MakeIcons(mctx, key, "logo_full", 64),
SiteIconWhite: externals.MakeIcons(mctx, key, "logo_white", 16),
ProofURL: i.makeSigchainViewURL(mctx, crypto.SigID),
Key: key,
Value: crypto.Address,
Priority: i.priority(key),
State: keybase1.Identify3RowState_VALID,
Color: i.getColorForValid(i.iFollowThem),
SigID: crypto.SigID,
Ctime: 0,
SiteURL: i.makeSigchainViewURL(mctx, crypto.SigID),
SiteIcon: externals.MakeIcons(mctx, key, externals.IconTypeSmall, 16),
SiteIconDarkmode: externals.MakeIcons(mctx, key, externals.IconTypeSmallDarkmode, 16),
SiteIconFull: externals.MakeIcons(mctx, key, externals.IconTypeFull, 64),
SiteIconFullDarkmode: externals.MakeIcons(mctx, key, externals.IconTypeFullDarkmode, 64),
ProofURL: i.makeSigchainViewURL(mctx, crypto.SigID),
})
}

Expand All @@ -507,18 +510,19 @@ func (i *UIAdapter) plumbStellarAccount(mctx libkb.MetaContext, str keybase1.Ste
color = keybase1.Identify3RowColor_GRAY
}
i.updateRow(mctx, keybase1.Identify3Row{
Key: "stellar",
Value: str.FederationAddress,
Priority: i.priority("stellar"),
State: keybase1.Identify3RowState_VALID,
Color: color,
SigID: str.SigID,
Ctime: 0,
SiteURL: i.makeSigchainViewURL(mctx, str.SigID),
SiteIcon: externals.MakeIcons(mctx, "stellar", "logo_black", 16),
SiteIconFull: externals.MakeIcons(mctx, "stellar", "logo_full", 64),
SiteIconWhite: externals.MakeIcons(mctx, "stellar", "logo_white", 16),
ProofURL: i.makeSigchainViewURL(mctx, str.SigID),
Key: "stellar",
Value: str.FederationAddress,
Priority: i.priority("stellar"),
State: keybase1.Identify3RowState_VALID,
Color: color,
SigID: str.SigID,
Ctime: 0,
SiteURL: i.makeSigchainViewURL(mctx, str.SigID),
SiteIcon: externals.MakeIcons(mctx, "stellar", externals.IconTypeSmall, 16),
SiteIconDarkmode: externals.MakeIcons(mctx, "stellar", externals.IconTypeSmallDarkmode, 16),
SiteIconFull: externals.MakeIcons(mctx, "stellar", externals.IconTypeFull, 64),
SiteIconFullDarkmode: externals.MakeIcons(mctx, "stellar", externals.IconTypeFullDarkmode, 64),
ProofURL: i.makeSigchainViewURL(mctx, str.SigID),
})
}

Expand Down
3 changes: 2 additions & 1 deletion go/identify3/identify3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@ func runID3(t *testing.T, mctx libkb.MetaContext, user string, follow bool) id3r
res := fakeUI3.results()
for _, row := range res.rows {
checkIcon(t, row.Key, row.SiteIcon)
checkIcon(t, row.Key, row.SiteIconDarkmode)
checkIcon(t, row.Key, row.SiteIconFull)
checkIcon(t, row.Key, row.SiteIconWhite)
checkIcon(t, row.Key, row.SiteIconFullDarkmode)
if row.Priority == 0 || row.Priority == 9999999 {
t.Fatalf("unexpected priority %v %v", row.Key, row.Priority)
}
Expand Down
46 changes: 29 additions & 17 deletions go/protocol/keybase1/identify3_ui.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 3 additions & 25 deletions go/protocol/keybase1/prove_common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 23 additions & 11 deletions go/protocol/keybase1/user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 23 additions & 11 deletions go/protocol/keybase1/usersearch.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions go/service/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,10 @@ func (h *UserHandler) proofSuggestionsHelper(mctx libkb.MetaContext, tracer prof
tracer.Stage("icons")
for i := range suggestions {
suggestion := &suggestions[i]
suggestion.ProfileIcon = externals.MakeIcons(mctx, suggestion.LogoKey, "logo_black", 16)
suggestion.ProfileIconWhite = externals.MakeIcons(mctx, suggestion.LogoKey, "logo_white", 16)
suggestion.PickerIcon = externals.MakeIcons(mctx, suggestion.LogoKey, "logo_full", 32)
suggestion.ProfileIcon = externals.MakeIcons(mctx, suggestion.LogoKey, externals.IconTypeSmall, 16)
suggestion.ProfileIconDarkmode = externals.MakeIcons(mctx, suggestion.LogoKey, externals.IconTypeSmallDarkmode, 16)
suggestion.PickerIcon = externals.MakeIcons(mctx, suggestion.LogoKey, externals.IconTypeFull, 32)
suggestion.PickerIconDarkmode = externals.MakeIcons(mctx, suggestion.LogoKey, externals.IconTypeFullDarkmode, 32)
}

// Alphabetize so that ties later on in SliceStable are deterministic.
Expand Down
Loading

0 comments on commit d9f57d1

Please sign in to comment.