Merge remote-tracking branch 'upstream/main' into merge-gramsrv-9106877

This commit is contained in:
onysd 2026-08-03 23:29:20 +03:00
commit ac6a50c5ff
697 changed files with 100880 additions and 8052 deletions

View file

@ -57,7 +57,7 @@ func GlobalPrivacySettings() *tg.GlobalPrivacySettings {
return &tg.GlobalPrivacySettings{}
}
const chatThemesHash int64 = 2026062501
const chatThemesHash int64 = 2026080101
const uniqueGiftChatThemesHash int64 = 2026061201
const wallPapersHash int64 = 2026062502
const peerColorsHash = 2026061202
@ -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{}
@ -208,9 +233,14 @@ func WallPapers(hash int64) tg.AccountWallPapersClass {
}
// chatThemeBaseThemes enumerates the base themes every emoji chat theme ships
// settings for. The client matches a chat theme's settings to whichever base
// theme the user currently runs, and DrKLO's theme picker only surfaces a chat
// theme whose settings cover at least four base themes
// settings for. The order is part of the DrKLO client contract: the basic Chat
// Settings picker selects index 0 for day and index 2 for night, matching its
// built-in Blue, Day, Night, Dark Blue ordering. Arctic is an additional base
// and therefore follows those four stable slots.
//
// The client matches a chat theme's settings to whichever base theme the user
// currently runs, and DrKLO's theme picker only surfaces a chat theme whose
// settings cover at least four base themes
// (MediaDataController.generateEmojiPreviewThemes drops anything whose
// items.size() < 4, one item per ThemeSettings). dark selects the bubble/accent
// palette used for that base theme.
@ -220,9 +250,9 @@ var chatThemeBaseThemes = []struct {
}{
{func() tg.BaseThemeClass { return &tg.BaseThemeClassic{} }, false},
{func() tg.BaseThemeClass { return &tg.BaseThemeDay{} }, false},
{func() tg.BaseThemeClass { return &tg.BaseThemeArctic{} }, false},
{func() tg.BaseThemeClass { return &tg.BaseThemeTinted{} }, true},
{func() tg.BaseThemeClass { return &tg.BaseThemeNight{} }, true},
{func() tg.BaseThemeClass { return &tg.BaseThemeTinted{} }, true},
{func() tg.BaseThemeClass { return &tg.BaseThemeArctic{} }, false},
}
func AutoDownloadSettings() *tg.AccountAutoDownloadSettings {