fix: sync Android default theme installs

This commit is contained in:
iamxvbaba 2026-07-30 20:13:22 +08:00
parent 80c36a8ab4
commit 0d917ef87e
8 changed files with 263 additions and 7 deletions

View file

@ -182,6 +182,31 @@ func DefaultThemeList() []tg.Theme {
return themes
}
// LookupDefaultTheme resolves an InputTheme against the exact identity emitted
// by DefaultThemeList. ID references must carry the matching access hash; slug
// references are public and match by their exact non-empty slug.
//
// These themes are an immutable server catalog rather than rows in the custom
// cloud-theme store. RPCs which accept a Theme returned by account.getThemes
// use this lookup before consulting that store.
func LookupDefaultTheme(input tg.InputThemeClass) (tg.Theme, bool) {
for _, theme := range DefaultThemeList() {
switch in := input.(type) {
case *tg.InputTheme:
if in.ID == theme.ID && in.AccessHash == theme.AccessHash {
return theme, true
}
case *tg.InputThemeSlug:
if in.Slug != "" && in.Slug == theme.Slug {
return theme, true
}
default:
return tg.Theme{}, false
}
}
return tg.Theme{}, false
}
func UniqueGiftChatThemes(hash int64) tg.AccountChatThemesClass {
if hash == uniqueGiftChatThemesHash {
return &tg.AccountChatThemesNotModified{}