Merge commit 'c85d0b21c7616e3057c15690f2c1896e8592037e'

This commit is contained in:
Peter 2019-07-09 12:18:27 +04:00
commit 321bedf047
21 changed files with 1692 additions and 1466 deletions

View File

@ -4464,3 +4464,7 @@ Any member of this group will be able to see messages in the channel.";
"CreateGroup.ChannelsTooMuch" = "Sorry, you are a member of too many groups and channels. Please leave some before creating a new one."; "CreateGroup.ChannelsTooMuch" = "Sorry, you are a member of too many groups and channels. Please leave some before creating a new one.";
"Join.ChannelsTooMuch" = "Sorry, you are a member of too many groups and channels. Please leave some before joining one."; "Join.ChannelsTooMuch" = "Sorry, you are a member of too many groups and channels. Please leave some before joining one.";
"Invite.ChannelsTooMuch" = "Sorry, the target user is a member of too many groups and channels. Please ask them to leave some first."; "Invite.ChannelsTooMuch" = "Sorry, the target user is a member of too many groups and channels. Please ask them to leave some first.";
"Appearance.TintAllColors" = "Tint All Colors";
"Contacts.DeselectAll" = "Deselect All";

View File

@ -4,6 +4,34 @@ set -e
BUILD_TELEGRAM_VERSION="1" BUILD_TELEGRAM_VERSION="1"
MACOS_VERSION="10.14"
XCODE_VERSION="10.1"
VM_BASE_NAME="macos$(echo $MACOS_VERSION | sed -e 's/\.'/_/g)_Xcode$(echo $XCODE_VERSION | sed -e 's/\.'/_/g)"
case "$(uname -s)" in
Linux*) BUILD_MACHINE=linux;;
Darwin*) BUILD_MACHINE=macOS;;
*) BUILD_MACHINE=""
esac
if [ "$BUILD_MACHINE" == "linux" ]; then
for MACHINE in $(virsh list --all --name); do
if [ "$MACHINE" == "$VM_BASE_NAME" ]; then
FOUND_BASE_MACHINE="1"
break
fi
done
if [ -z "$FOUND_BASE_MACHINE" ]; then
echo "Virtual machine $VM_BASE_NAME not found"
exit 1
fi
elif [ "$BUILD_MACHINE" == "macOS" ]; then
echo "Building on macOS"
else
echo "Unknown build machine $(uname -s)"
fi
if [ `which cleanup-telegram-build-vms.sh` ]; then if [ `which cleanup-telegram-build-vms.sh` ]; then
cleanup-telegram-build-vms.sh cleanup-telegram-build-vms.sh
fi fi
@ -71,22 +99,39 @@ rm -f "$SOURCE_DIR/$BUILDBOX_DIR/transient-data/source.tar"
tar cf "$SOURCE_DIR/$BUILDBOX_DIR/transient-data/source.tar" --exclude "$SOURCE_DIR/$BUILDBOX_DIR" "$SOURCE_DIR" tar cf "$SOURCE_DIR/$BUILDBOX_DIR/transient-data/source.tar" --exclude "$SOURCE_DIR/$BUILDBOX_DIR" "$SOURCE_DIR"
cd "$BASE_DIR" cd "$BASE_DIR"
VM_BASE_NAME="macos10_14_3_Xcode10_1"
SNAPSHOT_ID=$(prlctl snapshot-list "$VM_BASE_NAME" | grep -Eo '\{(\d|[a-f]|-)*\}' | tr '\n' '\0')
if [ -z "$SNAPSHOT_ID" ]; then
echo "$VM_BASE_NAME is required to have one snapshot"
exit 1
fi
PROCESS_ID="$$" PROCESS_ID="$$"
VM_NAME="$VM_BASE_NAME-$(openssl rand -hex 10)-build-telegram-$PROCESS_ID" VM_NAME="$VM_BASE_NAME-$(openssl rand -hex 10)-build-telegram-$PROCESS_ID"
prlctl clone "$VM_BASE_NAME" --name "$VM_NAME" if [ "$BUILD_MACHINE" == "linux" ]; then
prlctl snapshot-switch "$VM_NAME" -i "$SNAPSHOT_ID" virt-clone --original "$VM_BASE_NAME" --name "$VM_NAME" --auto-clone
virsh start "$VM_NAME"
while 1; do
VM_IP=virsh domifaddr "$VM_NAME"
done
VM_IP=$(prlctl exec "$VM_NAME" "ifconfig | grep inet | grep broadcast | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -1 | tr '\n' '\0'") echo "Getting VM IP"
while [ 1 ]; do
TEST_IP=$(virsh domifaddr "$VM_NAME" 2>/dev/null | egrep -o 'ipv4.*' | sed -e 's/ipv4\s*//g' | sed -e 's|/.*||g')
if [ ! -z "$TEST_IP" ]; then
RESPONSE=$(ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null telegram@"$TEST_IP" -o ServerAliveInterval=60 -t "echo -n 1")
if [ "$RESPONSE" == "1" ]; then
VM_IP="$TEST_IP"
break
fi
fi
sleep 1
done
elif [ "$BUILD_MACHINE" == "macOS" ]; then
SNAPSHOT_ID=$(prlctl snapshot-list "$VM_BASE_NAME" | grep -Eo '\{(\d|[a-f]|-)*\}' | tr '\n' '\0')
if [ -z "$SNAPSHOT_ID" ]; then
echo "$VM_BASE_NAME is required to have one snapshot"
exit 1
fi
prlctl clone "$VM_BASE_NAME" --name "$VM_NAME"
prlctl snapshot-switch "$VM_NAME" -i "$SNAPSHOT_ID"
VM_IP=$(prlctl exec "$VM_NAME" "ifconfig | grep inet | grep broadcast | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -1 | tr '\n' '\0'")
fi
scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -pr "$BUILDBOX_DIR/$CODESIGNING_SUBPATH" telegram@"$VM_IP":codesigning_data scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -pr "$BUILDBOX_DIR/$CODESIGNING_SUBPATH" telegram@"$VM_IP":codesigning_data
@ -118,5 +163,10 @@ elif [ "$BUILD_CONFIGURATION" == "verify" ]; then
scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -pr telegram@"$VM_IP":telegram-ios/Telegram-iOS-AppStoreLLC.ipa "./$VERIFY_IPA" scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -pr telegram@"$VM_IP":telegram-ios/Telegram-iOS-AppStoreLLC.ipa "./$VERIFY_IPA"
fi fi
prlctl stop "$VM_NAME" --kill if [ "$BUILD_MACHINE" == "linux" ]; then
prlctl delete "$VM_NAME" virsh destroy "$VM_NAME"
virsh undefine "$VM_NAME" --remove-all-storage --nvram
elif [ "$BUILD_MACHINE" == "macOS" ]; then
prlctl stop "$VM_NAME" --kill
prlctl delete "$VM_NAME"
fi

View File

@ -115,6 +115,16 @@ public extension UIColor {
return UIColor(hue: hue, saturation: saturation, brightness: max(0.0, min(1.0, brightness * factor)), alpha: alpha) return UIColor(hue: hue, saturation: saturation, brightness: max(0.0, min(1.0, brightness * factor)), alpha: alpha)
} }
func withMultiplied(hue: CGFloat, saturation: CGFloat, brightness: CGFloat) -> UIColor {
var hueValue: CGFloat = 0.0
var saturationValue: CGFloat = 0.0
var brightnessValue: CGFloat = 0.0
var alphaValue: CGFloat = 0.0
self.getHue(&hueValue, saturation: &saturationValue, brightness: &brightnessValue, alpha: &alphaValue)
return UIColor(hue: max(0.0, min(1.0, hueValue * hue)), saturation: max(0.0, min(1.0, saturationValue * saturation)), brightness: max(0.0, min(1.0, brightnessValue * brightness)), alpha: alphaValue)
}
func mixedWith(_ other: UIColor, alpha: CGFloat) -> UIColor { func mixedWith(_ other: UIColor, alpha: CGFloat) -> UIColor {
let alpha = min(1.0, max(0.0, alpha)) let alpha = min(1.0, max(0.0, alpha))
let oneMinusAlpha = 1.0 - alpha let oneMinusAlpha = 1.0 - alpha

View File

@ -1,350 +1,379 @@
import Foundation import Foundation
import UIKit import UIKit
private let accentColor: UIColor = UIColor(rgb: 0x2EA6FF) private func makeDarkPresentationTheme(accentColor: UIColor) -> PresentationTheme {
private let destructiveColor: UIColor = UIColor(rgb: 0xFF6767) let destructiveColor: UIColor = UIColor(rgb: 0xFF6767)
private let constructiveColor: UIColor = UIColor(rgb: 0x08a723) let constructiveColor: UIColor = UIColor(rgb: 0x08a723)
private let secretColor: UIColor = UIColor(rgb: 0x89DF9E) let secretColor: UIColor = UIColor(rgb: 0x89DF9E)
let mainBackgroundColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.585, brightness: 0.25)
let mainSelectionColor = accentColor.withMultiplied(hue: 1.03, saturation: 0.585, brightness: 0.12)
let additionalBackgroundColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18)
let mainSeparatorColor = accentColor.withMultiplied(hue: 1.039, saturation: 0.560, brightness: 0.14)
let mainForegroundColor = accentColor.withMultiplied(hue: 0.99, saturation: 0.256, brightness: 0.62)
let mainSecondaryColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.109, brightness: 0.59)
let mainSecondaryTextColor = accentColor.withMultiplied(hue: 0.956, saturation: 0.17, brightness: 1.0)
let mainFreeTextColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.097, brightness: 0.56)
let outgoingBubbleColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.731, brightness: 0.59)
let highlightedIncomingBubbleColor = accentColor.withMultiplied(hue: 1.03, saturation: 0.463, brightness: 0.29)
let highlightedOutgoingBubbleColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.609, brightness: 0.63)
let mainInputColor = accentColor.withMultiplied(hue: 1.029, saturation: 0.609, brightness: 0.19)
let inputBackgroundColor = accentColor.withMultiplied(hue: 1.02, saturation: 0.609, brightness: 0.15)
let rootStatusBar = PresentationThemeRootNavigationStatusBar(
style: .white
)
private let rootStatusBar = PresentationThemeRootNavigationStatusBar( let rootTabBar = PresentationThemeRootTabBar(
style: .white backgroundColor: mainBackgroundColor,
) separatorColor: mainSeparatorColor,
iconColor: mainForegroundColor,
selectedIconColor: accentColor,
textColor: mainForegroundColor,
selectedTextColor: accentColor,
badgeBackgroundColor: UIColor(rgb: 0xEF5B5B),
badgeStrokeColor: UIColor(rgb: 0xEF5B5B),
badgeTextColor: UIColor(rgb: 0xffffff)
)
private let rootTabBar = PresentationThemeRootTabBar( let rootNavigationBar = PresentationThemeRootNavigationBar(
backgroundColor: UIColor(rgb: 0x213040), buttonColor: accentColor,
separatorColor: UIColor(rgb: 0x131A23), disabledButtonColor: accentColor.withMultiplied(hue: 1.033, saturation: 0.219, brightness: 0.44),
iconColor: UIColor(rgb: 0x7e929f), primaryTextColor: UIColor(rgb: 0xffffff),
selectedIconColor: accentColor, secondaryTextColor: mainSecondaryColor,
textColor: UIColor(rgb: 0x7e929f), controlColor: mainSecondaryColor,
selectedTextColor: accentColor, accentTextColor: accentColor,
badgeBackgroundColor: UIColor(rgb: 0xEF5B5B), backgroundColor: mainBackgroundColor,
badgeStrokeColor: UIColor(rgb: 0xEF5B5B), separatorColor: mainSeparatorColor,
badgeTextColor: UIColor(rgb: 0xffffff) badgeBackgroundColor: UIColor(rgb: 0xEF5B5B),
) badgeStrokeColor: UIColor(rgb: 0xEF5B5B),
badgeTextColor: UIColor(rgb: 0xffffff)
)
private let rootNavigationBar = PresentationThemeRootNavigationBar( let activeNavigationSearchBar = PresentationThemeActiveNavigationSearchBar(
buttonColor: accentColor, backgroundColor: mainBackgroundColor,
disabledButtonColor: UIColor(rgb: 0x5b646f), accentColor: accentColor,
primaryTextColor: UIColor(rgb: 0xffffff), inputFillColor: mainInputColor,
secondaryTextColor: UIColor(rgb: 0x8B9197), inputTextColor: UIColor(rgb: 0xffffff),
controlColor: UIColor(rgb: 0x8B9197), inputPlaceholderTextColor: mainSecondaryColor,
accentTextColor: accentColor, inputIconColor: mainSecondaryColor,
backgroundColor: UIColor(rgb: 0x213040), inputClearButtonColor: mainSecondaryColor,
separatorColor: UIColor(rgb: 0x131A23), separatorColor: additionalBackgroundColor
badgeBackgroundColor: UIColor(rgb: 0xEF5B5B), )
badgeStrokeColor: UIColor(rgb: 0xEF5B5B),
badgeTextColor: UIColor(rgb: 0xffffff)
)
private let activeNavigationSearchBar = PresentationThemeActiveNavigationSearchBar( let auth = PresentationThemeAuth(
backgroundColor: UIColor(rgb: 0x213040), introStartButton: accentColor,
accentColor: accentColor, introDotColor: mainSecondaryColor
inputFillColor: UIColor(rgb: 0x182330), )
inputTextColor: UIColor(rgb: 0xffffff),
inputPlaceholderTextColor: UIColor(rgb: 0x8B9197),
inputIconColor: UIColor(rgb: 0x8B9197),
inputClearButtonColor: UIColor(rgb: 0x8B9197),
separatorColor: UIColor(rgb: 0x18222C)
)
private let auth = PresentationThemeAuth( let passcode = PresentationThemePasscode(
introStartButton: accentColor, backgroundColors: (accentColor.withMultiplied(hue: 1.049, saturation: 0.573, brightness: 0.47), additionalBackgroundColor),
introDotColor: UIColor(rgb: 0x8B9197) buttonColor: mainBackgroundColor
) )
private let passcode = PresentationThemePasscode( let rootController = PresentationThemeRootController(
backgroundColors: (UIColor(rgb: 0x1d2937), UIColor(rgb: 0x18222d)), statusBar: rootStatusBar,
buttonColor: UIColor(rgb: 0x213040) tabBar: rootTabBar,
//backgroundColors: (UIColor(rgb: 0x263646), UIColor(rgb: 0x213040)), navigationBar: rootNavigationBar,
//buttonColor: UIColor(rgb: 0x7e93a0) activeNavigationSearchBar: activeNavigationSearchBar
) )
private let rootController = PresentationThemeRootController( let switchColors = PresentationThemeSwitch(
statusBar: rootStatusBar, frameColor: mainSecondaryTextColor.withAlphaComponent(0.5),
tabBar: rootTabBar, handleColor: UIColor(rgb: 0x121212),
navigationBar: rootNavigationBar, contentColor: accentColor,
activeNavigationSearchBar: activeNavigationSearchBar positiveColor: accentColor,
) negativeColor: destructiveColor
)
private let switchColors = PresentationThemeSwitch( let list = PresentationThemeList(
frameColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), blocksBackgroundColor: additionalBackgroundColor,
handleColor: UIColor(rgb: 0x121212), plainBackgroundColor: additionalBackgroundColor,
contentColor: accentColor, itemPrimaryTextColor: UIColor(rgb: 0xffffff),
positiveColor: accentColor, itemSecondaryTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
negativeColor: destructiveColor itemDisabledTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
) itemAccentColor: accentColor,
itemHighlightedColor: UIColor(rgb: 0x28b772),
itemDestructiveColor: destructiveColor,
itemPlaceholderTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
itemBlocksBackgroundColor: mainBackgroundColor,
itemHighlightedBackgroundColor: mainSelectionColor,
itemBlocksSeparatorColor: mainSeparatorColor,
itemPlainSeparatorColor: mainSeparatorColor,
disclosureArrowColor: mainSecondaryTextColor.withAlphaComponent(0.5),
sectionHeaderTextColor: mainFreeTextColor,
freeTextColor: mainFreeTextColor,
freeTextErrorColor: destructiveColor,
freeTextSuccessColor: UIColor(rgb: 0x30cf30),
freeMonoIcon: mainFreeTextColor,
itemSwitchColors: switchColors,
itemDisclosureActions: PresentationThemeItemDisclosureActions(
neutral1: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x007cd6), foregroundColor: .white),
neutral2: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xcd7800), foregroundColor: .white),
destructive: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xc70c0c), foregroundColor: .white),
constructive: PresentationThemeItemDisclosureAction(fillColor: constructiveColor, foregroundColor: .white),
accent: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x007cd6), foregroundColor: .white),
warning: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xcd7800), foregroundColor: .white),
inactive: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x26384c), foregroundColor: .white)
),
itemCheckColors: PresentationThemeCheck(
strokeColor: mainSecondaryTextColor.withAlphaComponent(0.5),
fillColor: accentColor,
foregroundColor: .white
),
controlSecondaryColor: mainSecondaryTextColor.withAlphaComponent(0.5),
freeInputField: PresentationInputFieldTheme(
backgroundColor: mainSecondaryTextColor.withAlphaComponent(0.5),
placeholderColor: UIColor(rgb: 0x4d4d4d),
primaryColor: .white,
controlColor: UIColor(rgb: 0x4d4d4d)
),
mediaPlaceholderColor: UIColor(rgb: 0x1e2c3a),
scrollIndicatorColor: UIColor(white: 1.0, alpha: 0.3),
pageIndicatorInactiveColor: mainSecondaryTextColor.withAlphaComponent(0.4),
inputClearButtonColor: mainSecondaryColor
)
private let list = PresentationThemeList( let chatList = PresentationThemeChatList(
blocksBackgroundColor: UIColor(rgb: 0x18222D), backgroundColor: additionalBackgroundColor,
plainBackgroundColor: UIColor(rgb: 0x18222D), itemSeparatorColor: mainSeparatorColor,
itemPrimaryTextColor: UIColor(rgb: 0xffffff), itemBackgroundColor: additionalBackgroundColor,
itemSecondaryTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), pinnedItemBackgroundColor: mainBackgroundColor,
itemDisabledTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), //!!! itemHighlightedBackgroundColor: mainSelectionColor,
itemAccentColor: accentColor, itemSelectedBackgroundColor: mainSelectionColor,
itemHighlightedColor: UIColor(rgb: 0x28b772), titleColor: UIColor(rgb: 0xffffff),
itemDestructiveColor: destructiveColor, secretTitleColor: secretColor,
itemPlaceholderTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), //!!! dateTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
itemBlocksBackgroundColor: UIColor(rgb: 0x213040), authorNameColor: UIColor(rgb: 0xffffff),
itemHighlightedBackgroundColor: UIColor(rgb: 0x10171F), messageTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
itemBlocksSeparatorColor: UIColor(rgb: 0x131A23), messageDraftTextColor: UIColor(rgb: 0xdd4b39),
itemPlainSeparatorColor: UIColor(rgb: 0x131A23), checkmarkColor: accentColor,
disclosureArrowColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), //!!! pendingIndicatorColor: mainSecondaryTextColor.withAlphaComponent(0.4),
sectionHeaderTextColor: UIColor(rgb: 0x82888E), failedFillColor: destructiveColor,
freeTextColor: UIColor(rgb: 0x82888E), failedForegroundColor: .white,
freeTextErrorColor: destructiveColor, //!!! muteIconColor: mainSecondaryTextColor.withAlphaComponent(0.4),
freeTextSuccessColor: UIColor(rgb: 0x30cf30), //!!! unreadBadgeActiveBackgroundColor: accentColor,
freeMonoIcon: UIColor(rgb: 0x82888E), unreadBadgeActiveTextColor: UIColor(rgb: 0xffffff),
itemSwitchColors: switchColors, unreadBadgeInactiveBackgroundColor: mainSecondaryTextColor.withAlphaComponent(0.4),
itemDisclosureActions: PresentationThemeItemDisclosureActions( unreadBadgeInactiveTextColor: additionalBackgroundColor,
neutral1: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x007cd6), foregroundColor: .white), pinnedBadgeColor: mainSecondaryTextColor.withAlphaComponent(0.5),
neutral2: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xcd7800), foregroundColor: .white), pinnedSearchBarColor: mainInputColor,
destructive: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xc70c0c), foregroundColor: .white), regularSearchBarColor: accentColor.withMultiplied(hue: 1.029, saturation: 0.609, brightness: 0.12),
constructive: PresentationThemeItemDisclosureAction(fillColor: constructiveColor, foregroundColor: .white), sectionHeaderFillColor: mainBackgroundColor,
accent: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x007cd6), foregroundColor: .white), sectionHeaderTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
warning: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xcd7800), foregroundColor: .white), searchBarKeyboardColor: .dark,
inactive: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x26384c), foregroundColor: .white) verifiedIconFillColor: accentColor,
), verifiedIconForegroundColor: .white,
itemCheckColors: PresentationThemeCheck( secretIconColor: secretColor,
strokeColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x72d5fd), UIColor(rgb: 0x2a9ef1)), foregroundColor: .white),
fillColor: accentColor, unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x5d6d77), UIColor(rgb: 0x4e5c64)), foregroundColor: additionalBackgroundColor),
foregroundColor: .white onlineDotColor: UIColor(rgb: 0x4cc91f)
), )
controlSecondaryColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
freeInputField: PresentationInputFieldTheme(
backgroundColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
placeholderColor: UIColor(rgb: 0x4d4d4d),
primaryColor: .white,
controlColor: UIColor(rgb: 0x4d4d4d)
),
mediaPlaceholderColor: UIColor(rgb: 0x1e2c3a),
scrollIndicatorColor: UIColor(white: 1.0, alpha: 0.3),
pageIndicatorInactiveColor: UIColor(rgb: 0xDBF5FF, alpha: 0.4),
inputClearButtonColor: UIColor(rgb: 0x8B9197)
)
private let chatList = PresentationThemeChatList( let bubble = PresentationThemeChatBubble(
backgroundColor: UIColor(rgb: 0x18222D), incoming: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: mainBackgroundColor, highlightedFill: highlightedIncomingBubbleColor, stroke: mainBackgroundColor), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: mainBackgroundColor, highlightedFill: highlightedIncomingBubbleColor, stroke: mainBackgroundColor)),
itemSeparatorColor: UIColor(rgb: 0x131A23), outgoing: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: outgoingBubbleColor, highlightedFill: highlightedOutgoingBubbleColor, stroke: outgoingBubbleColor), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: outgoingBubbleColor, highlightedFill: highlightedOutgoingBubbleColor, stroke: outgoingBubbleColor)),
itemBackgroundColor: UIColor(rgb: 0x18222D), freeform: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: mainBackgroundColor, highlightedFill: highlightedIncomingBubbleColor, stroke: mainBackgroundColor), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: mainBackgroundColor, highlightedFill: highlightedIncomingBubbleColor, stroke: mainBackgroundColor)),
pinnedItemBackgroundColor: UIColor(rgb: 0x213040), incomingPrimaryTextColor: UIColor(rgb: 0xffffff),
itemHighlightedBackgroundColor: UIColor(rgb: 0x10171F), incomingSecondaryTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
itemSelectedBackgroundColor: UIColor(rgb: 0x10171F), incomingLinkTextColor: accentColor,
titleColor: UIColor(rgb: 0xffffff), incomingLinkHighlightColor: accentColor.withAlphaComponent(0.5),
secretTitleColor: secretColor, incomingScamColor: destructiveColor,
dateTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), outgoingPrimaryTextColor: UIColor(rgb: 0xffffff),
authorNameColor: UIColor(rgb: 0xffffff), outgoingSecondaryTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
messageTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), outgoingLinkTextColor: accentColor,
messageDraftTextColor: UIColor(rgb: 0xdd4b39), //!!! outgoingLinkHighlightColor: accentColor.withAlphaComponent(0.5),
checkmarkColor: accentColor, outgoingScamColor: destructiveColor,
pendingIndicatorColor: UIColor(rgb: 0x8E8E93), infoPrimaryTextColor: UIColor(rgb: 0xffffff),
failedFillColor: destructiveColor, infoLinkTextColor: accentColor,
failedForegroundColor: .white, incomingTextHighlightColor: UIColor(rgb: 0xffe438),
muteIconColor: UIColor(rgb: 0x8E8E93), outgoingTextHighlightColor: UIColor(rgb: 0xffe438),
unreadBadgeActiveBackgroundColor: accentColor, incomingAccentTextColor: UIColor(rgb: 0xffffff),
unreadBadgeActiveTextColor: UIColor(rgb: 0xffffff), outgoingAccentTextColor: UIColor(rgb: 0xffffff),
unreadBadgeInactiveBackgroundColor: UIColor(rgb: 0xDBF5FF, alpha: 0.4), incomingAccentControlColor: UIColor(rgb: 0xffffff),
unreadBadgeInactiveTextColor: UIColor(rgb: 0x000000), outgoingAccentControlColor: UIColor(rgb: 0xffffff),
pinnedBadgeColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), incomingMediaActiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.6),
pinnedSearchBarColor: UIColor(rgb: 0x182330), outgoingMediaActiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.6),
regularSearchBarColor: UIColor(rgb: 0x0F161E), incomingMediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.3),
sectionHeaderFillColor: UIColor(rgb: 0x213040), outgoingMediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.3),
sectionHeaderTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), outgoingCheckColor: accentColor.withMultiplied(hue: 0.99, saturation: 0.743, brightness: 1.0),
searchBarKeyboardColor: .dark, incomingPendingActivityColor: mainSecondaryTextColor.withAlphaComponent(0.5),
verifiedIconFillColor: accentColor, outgoingPendingActivityColor: mainSecondaryTextColor.withAlphaComponent(0.5),
verifiedIconForegroundColor: .white, mediaDateAndStatusFillColor: UIColor(white: 0.0, alpha: 0.5),
secretIconColor: secretColor, mediaDateAndStatusTextColor: .white,
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x72d5fd), UIColor(rgb: 0x2a9ef1)), foregroundColor: .white), incomingFileTitleColor: UIColor(rgb: 0xffffff),
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x5d6d77), UIColor(rgb: 0x4e5c64)), foregroundColor: UIColor(rgb: 0x18222d)), outgoingFileTitleColor: UIColor(rgb: 0xffffff),
onlineDotColor: UIColor(rgb: 0x4cc91f) incomingFileDescriptionColor: mainSecondaryTextColor.withAlphaComponent(0.5),
) outgoingFileDescriptionColor: mainSecondaryTextColor.withAlphaComponent(0.5),
incomingFileDurationColor: mainSecondaryTextColor.withAlphaComponent(0.5),
outgoingFileDurationColor: mainSecondaryTextColor.withAlphaComponent(0.5),
shareButtonFillColor: PresentationThemeVariableColor(color: additionalBackgroundColor.withAlphaComponent(0.5)),
shareButtonStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
shareButtonForegroundColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2)),
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6),
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0),
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: additionalBackgroundColor.withAlphaComponent(0.5), withoutWallpaper: additionalBackgroundColor.withAlphaComponent(0.5)),
actionButtonsIncomingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
actionButtonsIncomingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: additionalBackgroundColor.withAlphaComponent(0.5), withoutWallpaper: additionalBackgroundColor.withAlphaComponent(0.5)),
actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
actionButtonsOutgoingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
selectionControlBorderColor: .white,
selectionControlFillColor: accentColor,
selectionControlForegroundColor: .white,
mediaHighlightOverlayColor: UIColor(white: 1.0, alpha: 0.6),
deliveryFailedFillColor: destructiveColor,
deliveryFailedForegroundColor: .white,
incomingMediaPlaceholderColor: UIColor(rgb: 0x1e2c3a),
outgoingMediaPlaceholderColor: UIColor(rgb: 0x2d5883),
incomingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x617583), radioProgress: accentColor, highlight: accentColor.withAlphaComponent(0.12), separator: mainSeparatorColor, bar: accentColor),
outgoingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x8eaac0), radioProgress: UIColor(rgb: 0x89d0ff), highlight: UIColor(rgb: 0x89d0ff).withAlphaComponent(0.12), separator: UIColor(rgb: 0x264b70), bar: UIColor(rgb: 0x89d0ff))
)
private let bubble = PresentationThemeChatBubble( let serviceMessage = PresentationThemeServiceMessage(
incoming: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x213040), highlightedFill: UIColor(rgb: 0x2D3A49), stroke: UIColor(rgb: 0x213040)), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x213040), highlightedFill: UIColor(rgb: 0x2D3A49), stroke: UIColor(rgb: 0x213040))), components: PresentationThemeServiceMessageColor(withDefaultWallpaper: PresentationThemeServiceMessageColorComponents(fill: additionalBackgroundColor, primaryText: .white, linkHighlight: UIColor(rgb: 0xffffff, alpha: 0.12), scam: destructiveColor, dateFillStatic: additionalBackgroundColor, dateFillFloating: additionalBackgroundColor.withAlphaComponent(0.2)), withCustomWallpaper: PresentationThemeServiceMessageColorComponents(fill: additionalBackgroundColor, primaryText: .white, linkHighlight: UIColor(rgb: 0xffffff, alpha: 0.12), scam: destructiveColor, dateFillStatic: additionalBackgroundColor, dateFillFloating: additionalBackgroundColor.withAlphaComponent(0.2))),
outgoing: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x3D6A97), highlightedFill: UIColor(rgb: 0x5079A1), stroke: UIColor(rgb: 0x3D6A97)), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x3D6A97), highlightedFill: UIColor(rgb: 0x5079A1), stroke: UIColor(rgb: 0x3D6A97))), unreadBarFillColor: mainBackgroundColor,
freeform: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x213040), highlightedFill: UIColor(rgb: 0x2D3A49), stroke: UIColor(rgb: 0x213040)), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x213040), highlightedFill: UIColor(rgb: 0x2D3A49), stroke: UIColor(rgb: 0x213040))), unreadBarStrokeColor: mainBackgroundColor,
incomingPrimaryTextColor: UIColor(rgb: 0xffffff), unreadBarTextColor: UIColor(rgb: 0xffffff),
incomingSecondaryTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff))
incomingLinkTextColor: accentColor, )
incomingLinkHighlightColor: accentColor.withAlphaComponent(0.5),
incomingScamColor: destructiveColor,
outgoingPrimaryTextColor: UIColor(rgb: 0xffffff),
outgoingSecondaryTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
outgoingLinkTextColor: accentColor,
outgoingLinkHighlightColor: accentColor.withAlphaComponent(0.5),
outgoingScamColor: destructiveColor,
infoPrimaryTextColor: UIColor(rgb: 0xffffff),
infoLinkTextColor: accentColor,
incomingTextHighlightColor: UIColor(rgb: 0xffe438),
outgoingTextHighlightColor: UIColor(rgb: 0xffe438),
incomingAccentTextColor: UIColor(rgb: 0xffffff),
outgoingAccentTextColor: UIColor(rgb: 0xffffff),
incomingAccentControlColor: UIColor(rgb: 0xffffff),
outgoingAccentControlColor: UIColor(rgb: 0xffffff),
incomingMediaActiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.6),
outgoingMediaActiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.6),
incomingMediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.3),
outgoingMediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.3),
outgoingCheckColor: UIColor(rgb: 0x64c0ff),
incomingPendingActivityColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
outgoingPendingActivityColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
mediaDateAndStatusFillColor: UIColor(white: 0.0, alpha: 0.5),
mediaDateAndStatusTextColor: .white,
incomingFileTitleColor: UIColor(rgb: 0xffffff),
outgoingFileTitleColor: UIColor(rgb: 0xffffff),
incomingFileDescriptionColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
outgoingFileDescriptionColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
incomingFileDurationColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
outgoingFileDurationColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
shareButtonFillColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x18222d, alpha: 0.5)),
shareButtonStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
shareButtonForegroundColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2)),
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6), //!!!
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0), //!!!
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5)),
actionButtonsIncomingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
actionButtonsIncomingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5)),
actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
actionButtonsOutgoingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
selectionControlBorderColor: .white,
selectionControlFillColor: accentColor,
selectionControlForegroundColor: .white,
mediaHighlightOverlayColor: UIColor(white: 1.0, alpha: 0.6),
deliveryFailedFillColor: destructiveColor,
deliveryFailedForegroundColor: .white,
incomingMediaPlaceholderColor: UIColor(rgb: 0x1e2c3a),
outgoingMediaPlaceholderColor: UIColor(rgb: 0x2d5883),
incomingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x617583), radioProgress: accentColor, highlight: accentColor.withAlphaComponent(0.12), separator: UIColor(rgb: 0x131a23), bar: accentColor),
outgoingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x8eaac0), radioProgress: UIColor(rgb: 0x89d0ff), highlight: UIColor(rgb: 0x89d0ff).withAlphaComponent(0.12), separator: UIColor(rgb: 0x264b70), bar: UIColor(rgb: 0x89d0ff))
)
private let serviceMessage = PresentationThemeServiceMessage( let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
components: PresentationThemeServiceMessageColor(withDefaultWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0x18222D, alpha: 1.0), primaryText: .white, linkHighlight: UIColor(rgb: 0xffffff, alpha: 0.12), scam: destructiveColor, dateFillStatic: UIColor(rgb: 0x18222D, alpha: 1.0), dateFillFloating: UIColor(rgb: 0x18222D, alpha: 0.2)), withCustomWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0x18222D, alpha: 1.0), primaryText: .white, linkHighlight: UIColor(rgb: 0xffffff, alpha: 0.12), scam: destructiveColor, dateFillStatic: UIColor(rgb: 0x18222D, alpha: 1.0), dateFillFloating: UIColor(rgb: 0x18222D, alpha: 0.2))), buttonColor: accentColor,
unreadBarFillColor: UIColor(rgb: 0x213040), micLevelColor: accentColor.withAlphaComponent(0.2),
unreadBarStrokeColor: UIColor(rgb: 0x213040), activeIconColor: .white,
unreadBarTextColor: UIColor(rgb: 0xffffff), panelControlFillColor: mainBackgroundColor,
dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)) panelControlStrokeColor: mainBackgroundColor,
) panelControlContentPrimaryColor: mainSecondaryTextColor.withAlphaComponent(0.5),
panelControlContentAccentColor: accentColor
)
private let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl( let inputPanel = PresentationThemeChatInputPanel(
buttonColor: accentColor, panelBackgroundColor: mainBackgroundColor,
micLevelColor: accentColor.withAlphaComponent(0.2), panelStrokeColor: mainSeparatorColor,
activeIconColor: .white, panelControlAccentColor: accentColor,
panelControlFillColor: UIColor(rgb: 0x213040), panelControlColor: mainSecondaryTextColor.withAlphaComponent(0.5),
panelControlStrokeColor: UIColor(rgb: 0x213040), panelControlDisabledColor: UIColor(rgb: 0x90979F, alpha: 0.5),
panelControlContentPrimaryColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), //!!! panelControlDestructiveColor: destructiveColor,
panelControlContentAccentColor: accentColor inputBackgroundColor: inputBackgroundColor,
) inputStrokeColor: inputBackgroundColor,
inputPlaceholderColor: mainSecondaryTextColor.withAlphaComponent(0.4),
inputTextColor: UIColor(rgb: 0xffffff),
inputControlColor: mainSecondaryTextColor.withAlphaComponent(0.4),
actionControlFillColor: accentColor,
actionControlForegroundColor: .white,
primaryTextColor: UIColor(rgb: 0xffffff),
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
mediaRecordingDotColor: accentColor,
keyboardColor: .dark,
mediaRecordingControl: inputPanelMediaRecordingControl
)
private let inputPanel = PresentationThemeChatInputPanel( let inputMediaPanel = PresentationThemeInputMediaPanel(
panelBackgroundColor: UIColor(rgb: 0x213040), panelSeparatorColor: mainBackgroundColor,
panelStrokeColor: UIColor(rgb: 0x131A23), panelIconColor: mainSecondaryTextColor.withAlphaComponent(0.5),
panelControlAccentColor: accentColor, panelHighlightedIconBackgroundColor: inputBackgroundColor,
panelControlColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), stickersBackgroundColor: additionalBackgroundColor,
panelControlDisabledColor: UIColor(rgb: 0x90979F, alpha: 0.5), //!!! stickersSectionTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
panelControlDestructiveColor: destructiveColor, stickersSearchBackgroundColor: UIColor(rgb: 0x121c25),
inputBackgroundColor: UIColor(rgb: 0x131C26), stickersSearchPlaceholderColor: UIColor(rgb: 0x788a96),
inputStrokeColor: UIColor(rgb: 0x131C26), stickersSearchPrimaryColor: .white,
inputPlaceholderColor: UIColor(rgb: 0xDBF5FF, alpha: 0.4), stickersSearchControlColor: UIColor(rgb: 0x788a96),
inputTextColor: UIColor(rgb: 0xffffff), gifsBackgroundColor: additionalBackgroundColor
inputControlColor: UIColor(rgb: 0xDBF5FF, alpha: 0.4), )
actionControlFillColor: accentColor,
actionControlForegroundColor: .white,
primaryTextColor: UIColor(rgb: 0xffffff),
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
mediaRecordingDotColor: accentColor,
keyboardColor: .dark,
mediaRecordingControl: inputPanelMediaRecordingControl
)
private let inputMediaPanel = PresentationThemeInputMediaPanel( let inputButtonPanel = PresentationThemeInputButtonPanel(
panelSeparatorColor: UIColor(rgb: 0x213040), panelSeparatorColor: mainBackgroundColor,
panelIconColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), panelBackgroundColor: UIColor(rgb: 0x161A20),
panelHighlightedIconBackgroundColor: UIColor(rgb: 0x131C26), //!!! buttonFillColor: UIColor(rgb: 0x5B5F62),
stickersBackgroundColor: UIColor(rgb: 0x18222d), buttonStrokeColor: UIColor(rgb: 0x0D1013),
stickersSectionTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), buttonHighlightedFillColor: UIColor(rgb: 0x5B5F62, alpha: 0.7),
stickersSearchBackgroundColor: UIColor(rgb: 0x121c25), buttonHighlightedStrokeColor: UIColor(rgb: 0x0D1013),
stickersSearchPlaceholderColor: UIColor(rgb: 0x788a96), buttonTextColor: UIColor(rgb: 0xffffff)
stickersSearchPrimaryColor: .white, )
stickersSearchControlColor: UIColor(rgb: 0x788a96),
gifsBackgroundColor: UIColor(rgb: 0x18222d)
)
private let inputButtonPanel = PresentationThemeInputButtonPanel( let historyNavigation = PresentationThemeChatHistoryNavigation(
panelSeparatorColor: UIColor(rgb: 0x213040), fillColor: mainBackgroundColor,
panelBackgroundColor: UIColor(rgb: 0x161A20), strokeColor: mainSeparatorColor,
buttonFillColor: UIColor(rgb: 0x5B5F62), foregroundColor: mainSecondaryTextColor.withAlphaComponent(0.5),
buttonStrokeColor: UIColor(rgb: 0x0D1013), badgeBackgroundColor: accentColor,
buttonHighlightedFillColor: UIColor(rgb: 0x5B5F62, alpha: 0.7), badgeStrokeColor: accentColor,
buttonHighlightedStrokeColor: UIColor(rgb: 0x0D1013), badgeTextColor: .white
buttonTextColor: UIColor(rgb: 0xffffff) )
)
private let historyNavigation = PresentationThemeChatHistoryNavigation( let chat = PresentationThemeChat(
fillColor: UIColor(rgb: 0x213040), bubble: bubble,
strokeColor: UIColor(rgb: 0x131A23), serviceMessage: serviceMessage,
foregroundColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), inputPanel: inputPanel,
badgeBackgroundColor: accentColor, inputMediaPanel: inputMediaPanel,
badgeStrokeColor: accentColor, inputButtonPanel: inputButtonPanel,
badgeTextColor: .white historyNavigation: historyNavigation
) )
private let chat = PresentationThemeChat( let actionSheet = PresentationThemeActionSheet(
bubble: bubble, dimColor: UIColor(white: 0.0, alpha: 0.5),
serviceMessage: serviceMessage,
inputPanel: inputPanel,
inputMediaPanel: inputMediaPanel,
inputButtonPanel: inputButtonPanel,
historyNavigation: historyNavigation
)
private let actionSheet = PresentationThemeActionSheet(
dimColor: UIColor(white: 0.0, alpha: 0.5),
backgroundType: .dark,
opaqueItemBackgroundColor: UIColor(rgb: 0x213040),
itemBackgroundColor: UIColor(rgb: 0x213040, alpha: 0.8),
opaqueItemHighlightedBackgroundColor: UIColor(rgb: 0x10171F),
itemHighlightedBackgroundColor: UIColor(rgb: 0x10171F, alpha: 0.2), //!!!
standardActionTextColor: accentColor,
opaqueItemSeparatorColor: UIColor(rgb: 0x18222D),
destructiveActionTextColor: destructiveColor,
disabledActionTextColor: UIColor(white: 1.0, alpha: 0.5), //!!!
primaryTextColor: .white,
secondaryTextColor: UIColor(white: 1.0, alpha: 0.5), //!!!
controlAccentColor: accentColor,
inputBackgroundColor: UIColor(rgb: 0x182330), //!!!
inputHollowBackgroundColor: UIColor(rgb: 0x182330),
inputBorderColor: UIColor(rgb: 0x182330),
inputPlaceholderColor: UIColor(rgb: 0x8B9197), //!!!
inputTextColor: .white,
inputClearButtonColor: UIColor(rgb: 0x8B9197),
checkContentColor: .white
)
private let inAppNotification = PresentationThemeInAppNotification(
fillColor: UIColor(rgb: 0x213040),
primaryTextColor: .white,
expandedNotification: PresentationThemeExpandedNotification(
backgroundType: .dark, backgroundType: .dark,
navigationBar: PresentationThemeExpandedNotificationNavigationBar( opaqueItemBackgroundColor: mainBackgroundColor,
backgroundColor: UIColor(rgb: 0x213040), itemBackgroundColor: mainBackgroundColor.withAlphaComponent(0.8),
primaryTextColor: UIColor(rgb: 0xffffff), opaqueItemHighlightedBackgroundColor: mainSelectionColor,
controlColor: accentColor, itemHighlightedBackgroundColor: mainSelectionColor.withAlphaComponent(0.2),
separatorColor: UIColor(rgb: 0x131A23) standardActionTextColor: accentColor,
opaqueItemSeparatorColor: additionalBackgroundColor,
destructiveActionTextColor: destructiveColor,
disabledActionTextColor: UIColor(white: 1.0, alpha: 0.5),
primaryTextColor: .white,
secondaryTextColor: UIColor(white: 1.0, alpha: 0.5),
controlAccentColor: accentColor,
inputBackgroundColor: mainInputColor,
inputHollowBackgroundColor: mainInputColor,
inputBorderColor: mainInputColor,
inputPlaceholderColor: mainSecondaryColor,
inputTextColor: .white,
inputClearButtonColor: mainSecondaryColor,
checkContentColor: .white
)
let inAppNotification = PresentationThemeInAppNotification(
fillColor: mainBackgroundColor,
primaryTextColor: .white,
expandedNotification: PresentationThemeExpandedNotification(
backgroundType: .dark,
navigationBar: PresentationThemeExpandedNotificationNavigationBar(
backgroundColor: mainBackgroundColor,
primaryTextColor: UIColor(rgb: 0xffffff),
controlColor: accentColor,
separatorColor: mainSeparatorColor
)
) )
) )
)
public let defaultDarkAccentPresentationTheme = PresentationTheme( return PresentationTheme(
name: .builtin(.nightAccent), name: .builtin(.nightAccent),
overallDarkAppearance: true, overallDarkAppearance: true,
allowsCustomWallpapers: false, auth: auth,
auth: auth, passcode: passcode,
passcode: passcode, rootController: rootController,
rootController: rootController, list: list,
list: list, chatList: chatList,
chatList: chatList, chat: chat,
chat: chat, actionSheet: actionSheet,
actionSheet: actionSheet, inAppNotification: inAppNotification
inAppNotification: inAppNotification )
) }
public let defaultDarkAccentPresentationTheme = makeDarkAccentPresentationTheme(accentColor: 0x2EA6FF)
public func makeDarkAccentPresentationTheme(accentColor: Int32?) -> PresentationTheme {
let color: UIColor
if let accentColor = accentColor {
color = UIColor(rgb: UInt32(bitPattern: accentColor))
} else {
color = UIColor(rgb: UInt32(bitPattern: defaultDayAccentColor))
}
return makeDarkPresentationTheme(accentColor: color)
}

View File

@ -1,348 +1,363 @@
import Foundation import Foundation
import UIKit import UIKit
private let accentColor: UIColor = UIColor(rgb: 0xffffff) //private let accentColor: UIColor = UIColor(rgb: 0xffffff)
private let destructiveColor: UIColor = UIColor(rgb: 0xFF736B)
private let constructiveColor: UIColor = UIColor(rgb: 0x08a723)
private let secretColor: UIColor = UIColor(rgb: 0x00B12C)
private let rootStatusBar = PresentationThemeRootNavigationStatusBar( private func makeDarkPresentationTheme(accentColor: UIColor) -> PresentationTheme {
style: .white let destructiveColor: UIColor = UIColor(rgb: 0xeb5545)
) let constructiveColor: UIColor = UIColor(rgb: 0x08a723)
let secretColor: UIColor = UIColor(rgb: 0x00B12C)
private let rootTabBar = PresentationThemeRootTabBar( let rootStatusBar = PresentationThemeRootNavigationStatusBar(
backgroundColor: UIColor(rgb: 0x1c1c1d), style: .white
separatorColor: UIColor(rgb: 0x000000), )
iconColor: UIColor(rgb: 0x808080),
selectedIconColor: accentColor,
textColor: UIColor(rgb: 0x929292),
selectedTextColor: accentColor,
badgeBackgroundColor: UIColor(rgb: 0xffffff),
badgeStrokeColor: UIColor(rgb: 0x1c1c1d),
badgeTextColor: UIColor(rgb: 0x000000)
)
private let rootNavigationBar = PresentationThemeRootNavigationBar( let rootTabBar = PresentationThemeRootTabBar(
buttonColor: accentColor, backgroundColor: UIColor(rgb: 0x1c1c1d),
disabledButtonColor: UIColor(rgb: 0x525252), separatorColor: UIColor(rgb: 0x3d3d40),
primaryTextColor: accentColor, iconColor: UIColor(rgb: 0x828282),
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5), selectedIconColor: accentColor,
controlColor: UIColor(rgb: 0x767677), textColor: UIColor(rgb: 0x828282),
accentTextColor: accentColor, selectedTextColor: accentColor,
backgroundColor: UIColor(rgb: 0x1c1c1d), badgeBackgroundColor: UIColor(rgb: 0xeb5545),
separatorColor: UIColor(rgb: 0x000000), badgeStrokeColor: UIColor(rgb: 0x1c1c1d),
badgeBackgroundColor: UIColor(rgb: 0xffffff), badgeTextColor: UIColor(rgb: 0xffffff)
badgeStrokeColor: UIColor(rgb: 0x1c1c1d), )
badgeTextColor: UIColor(rgb: 0x1c1c1d)
)
private let activeNavigationSearchBar = PresentationThemeActiveNavigationSearchBar( let rootNavigationBar = PresentationThemeRootNavigationBar(
backgroundColor: UIColor(rgb: 0x1c1c1d), buttonColor: accentColor,
accentColor: accentColor, disabledButtonColor: UIColor(rgb: 0x525252),
inputFillColor: UIColor(rgb: 0x272728), primaryTextColor: .white,
inputTextColor: accentColor, secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
inputPlaceholderTextColor: UIColor(rgb: 0x5e5e5e), controlColor: UIColor(rgb: 0x767676),
inputIconColor: UIColor(rgb: 0x5e5e5e), accentTextColor: accentColor,
inputClearButtonColor: UIColor(rgb: 0x5e5e5e), backgroundColor: UIColor(rgb: 0x1c1c1d),
separatorColor: UIColor(rgb: 0x000000) separatorColor: UIColor(rgb: 0x3d3d40),
) badgeBackgroundColor: UIColor(rgb: 0xeb5545),
badgeStrokeColor: UIColor(rgb: 0x1c1c1d),
badgeTextColor: UIColor(rgb: 0xffffff)
)
private let auth = PresentationThemeAuth( let activeNavigationSearchBar = PresentationThemeActiveNavigationSearchBar(
introStartButton: accentColor, backgroundColor: UIColor(rgb: 0x1c1c1d),
introDotColor: UIColor(rgb: 0x5e5e5e) accentColor: accentColor,
) inputFillColor: UIColor(rgb: 0x272728),
inputTextColor: accentColor,
inputPlaceholderTextColor: UIColor(rgb: 0x5e5e5e),
inputIconColor: UIColor(rgb: 0x5e5e5e),
inputClearButtonColor: UIColor(rgb: 0x5e5e5e),
separatorColor: UIColor(rgb: 0x3d3d40)
)
private let passcode = PresentationThemePasscode( let auth = PresentationThemeAuth(
backgroundColors: (UIColor(rgb: 0x000000), UIColor(rgb: 0x000000)), introStartButton: accentColor,
buttonColor: UIColor(rgb: 0x1c1c1d) introDotColor: UIColor(rgb: 0x5e5e5e)
) )
private let rootController = PresentationThemeRootController( let passcode = PresentationThemePasscode(
statusBar: rootStatusBar, backgroundColors: (UIColor(rgb: 0x000000), UIColor(rgb: 0x000000)),
tabBar: rootTabBar, buttonColor: UIColor(rgb: 0x1c1c1d)
navigationBar: rootNavigationBar, )
activeNavigationSearchBar: activeNavigationSearchBar
)
private let switchColors = PresentationThemeSwitch( let rootController = PresentationThemeRootController(
frameColor: UIColor(rgb: 0x545454), statusBar: rootStatusBar,
handleColor: UIColor(rgb: 0x121212), tabBar: rootTabBar,
contentColor: UIColor(rgb: 0xb2b2b2), navigationBar: rootNavigationBar,
positiveColor: UIColor(rgb: 0x000000), activeNavigationSearchBar: activeNavigationSearchBar
negativeColor: destructiveColor )
)
private let list = PresentationThemeList( let switchColors = PresentationThemeSwitch(
blocksBackgroundColor: UIColor(rgb: 0x000000), frameColor: UIColor(rgb: 0x5a5a5e),
plainBackgroundColor: UIColor(rgb: 0x000000), handleColor: UIColor(rgb: 0x121212),
itemPrimaryTextColor: UIColor(rgb: 0xffffff), contentColor: UIColor(rgb: 0xb2b2b2),
itemSecondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5), positiveColor: UIColor(rgb: 0x000000),
itemDisabledTextColor: UIColor(rgb: 0x4d4d4d), //!!! negativeColor: destructiveColor
itemAccentColor: accentColor, )
itemHighlightedColor: UIColor(rgb: 0x28b772),
itemDestructiveColor: destructiveColor,
itemPlaceholderTextColor: UIColor(rgb: 0x4d4d4d), //!!!
itemBlocksBackgroundColor: UIColor(rgb: 0x1c1c1d),
itemHighlightedBackgroundColor: UIColor(rgb: 0x191919),
itemBlocksSeparatorColor: UIColor(rgb: 0x000000),
itemPlainSeparatorColor: UIColor(rgb: 0x252525),
disclosureArrowColor: UIColor(rgb: 0x545454), //!!!
sectionHeaderTextColor: UIColor(rgb: 0xffffff),
freeTextColor: UIColor(rgb: 0x8d8e93),
freeTextErrorColor: UIColor(rgb: 0xcf3030), //!!!
freeTextSuccessColor: UIColor(rgb: 0x30cf30), //!!!
freeMonoIcon: UIColor(rgb: 0x8d8e93),
itemSwitchColors: switchColors,
itemDisclosureActions: PresentationThemeItemDisclosureActions(
neutral1: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x666666), foregroundColor: .white),
neutral2: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xcd7800), foregroundColor: .white),
destructive: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xc70c0c), foregroundColor: .white),
constructive: PresentationThemeItemDisclosureAction(fillColor: constructiveColor, foregroundColor: .white),
accent: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x666666), foregroundColor: .white),
warning: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xcd7800), foregroundColor: .white),
inactive: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x666666), foregroundColor: .white)
),
itemCheckColors: PresentationThemeCheck(
strokeColor: UIColor(rgb: 0xffffff, alpha: 0.5),
fillColor: accentColor,
foregroundColor: UIColor(rgb: 0x000000)
),
controlSecondaryColor: UIColor(rgb: 0xffffff, alpha: 0.5),
freeInputField: PresentationInputFieldTheme(
backgroundColor: UIColor(rgb: 0xffffff, alpha: 0.5),
placeholderColor: UIColor(rgb: 0x4d4d4d),
primaryColor: .white,
controlColor: UIColor(rgb: 0x4d4d4d)
),
mediaPlaceholderColor: UIColor(rgb: 0x1c1c1d),
scrollIndicatorColor: UIColor(white: 1.0, alpha: 0.3),
pageIndicatorInactiveColor: UIColor(white: 1.0, alpha: 0.3),
inputClearButtonColor: UIColor(rgb: 0x8B9197)
)
private let chatList = PresentationThemeChatList( let list = PresentationThemeList(
backgroundColor: UIColor(rgb: 0x000000), blocksBackgroundColor: UIColor(rgb: 0x000000),
itemSeparatorColor: UIColor(rgb: 0x252525), plainBackgroundColor: UIColor(rgb: 0x000000),
itemBackgroundColor: UIColor(rgb: 0x000000), itemPrimaryTextColor: UIColor(rgb: 0xffffff),
pinnedItemBackgroundColor: UIColor(rgb: 0x1c1c1d), itemSecondaryTextColor: UIColor(rgb: 0x8f8f8f),
itemHighlightedBackgroundColor: UIColor(rgb: 0x191919), itemDisabledTextColor: UIColor(rgb: 0x4d4d4d),
itemSelectedBackgroundColor: UIColor(rgb: 0x191919), itemAccentColor: accentColor,
titleColor: UIColor(rgb: 0xffffff), itemHighlightedColor: UIColor(rgb: 0x28b772),
secretTitleColor: secretColor, //!!! itemDestructiveColor: destructiveColor,
dateTextColor: UIColor(rgb: 0x8e8e93), itemPlaceholderTextColor: UIColor(rgb: 0x4d4d4d),
authorNameColor: UIColor(rgb: 0xffffff), itemBlocksBackgroundColor: UIColor(rgb: 0x1c1c1d),
messageTextColor: UIColor(rgb: 0x8e8e93), itemHighlightedBackgroundColor: UIColor(rgb: 0x313135),
messageDraftTextColor: UIColor(rgb: 0xdd4b39), //!!! itemBlocksSeparatorColor: UIColor(rgb: 0x3d3d40),
checkmarkColor: UIColor(rgb: 0xffffff), itemPlainSeparatorColor: UIColor(rgb: 0x3d3d40),
pendingIndicatorColor: UIColor(rgb: 0xffffff), //!!! disclosureArrowColor: UIColor(rgb: 0x5a5a5e),
failedFillColor: destructiveColor, sectionHeaderTextColor: UIColor(rgb: 0xffffff),
failedForegroundColor: .white, freeTextColor: UIColor(rgb: 0x8d8e93),
muteIconColor: UIColor(rgb: 0x8e8e93), //!!! freeTextErrorColor: UIColor(rgb: 0xcf3030),
unreadBadgeActiveBackgroundColor: UIColor(rgb: 0xffffff), freeTextSuccessColor: UIColor(rgb: 0x30cf30),
unreadBadgeActiveTextColor: UIColor(rgb: 0x000000), freeMonoIcon: UIColor(rgb: 0x8d8e93),
unreadBadgeInactiveBackgroundColor: UIColor(rgb: 0x666666), itemSwitchColors: switchColors,
unreadBadgeInactiveTextColor:UIColor(rgb: 0x000000), itemDisclosureActions: PresentationThemeItemDisclosureActions(
pinnedBadgeColor: UIColor(rgb: 0x767677), neutral1: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x666666), foregroundColor: .white),
pinnedSearchBarColor: UIColor(rgb: 0x272728), neutral2: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xcd7800), foregroundColor: .white),
regularSearchBarColor: UIColor(rgb: 0x272728), //!!! destructive: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xc70c0c), foregroundColor: .white),
sectionHeaderFillColor: UIColor(rgb: 0x1C1C1D), constructive: PresentationThemeItemDisclosureAction(fillColor: constructiveColor, foregroundColor: .white),
sectionHeaderTextColor: UIColor(rgb: 0xffffff), accent: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x666666), foregroundColor: .white),
searchBarKeyboardColor: .dark, warning: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0xcd7800), foregroundColor: .white),
verifiedIconFillColor: accentColor, inactive: PresentationThemeItemDisclosureAction(fillColor: UIColor(rgb: 0x666666), foregroundColor: .white)
verifiedIconForegroundColor: .white, ),
secretIconColor: secretColor, itemCheckColors: PresentationThemeCheck(
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x72d5fd), UIColor(rgb: 0x2a9ef1)), foregroundColor: .white), strokeColor: UIColor(rgb: 0xffffff, alpha: 0.5),
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x666666), UIColor(rgb: 0x666666)), foregroundColor: .black), fillColor: accentColor,
onlineDotColor: UIColor(rgb: 0x4cc91f) foregroundColor: UIColor(rgb: 0x000000)
) ),
controlSecondaryColor: UIColor(rgb: 0xffffff, alpha: 0.5),
freeInputField: PresentationInputFieldTheme(
backgroundColor: UIColor(rgb: 0xffffff, alpha: 0.5),
placeholderColor: UIColor(rgb: 0x4d4d4d),
primaryColor: .white,
controlColor: UIColor(rgb: 0x4d4d4d)
),
mediaPlaceholderColor: UIColor(rgb: 0x1c1c1d),
scrollIndicatorColor: UIColor(white: 1.0, alpha: 0.3),
pageIndicatorInactiveColor: UIColor(white: 1.0, alpha: 0.3),
inputClearButtonColor: UIColor(rgb: 0x8B9197)
)
private let bubble = PresentationThemeChatBubble( let chatList = PresentationThemeChatList(
incoming: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x1f1f1f), highlightedFill: UIColor(rgb: 0x2A2A2A), stroke: UIColor(rgb: 0x1f1f1f)), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x1f1f1f), highlightedFill: UIColor(rgb: 0x2A2A2A), stroke: UIColor(rgb: 0x1f1f1f))), backgroundColor: UIColor(rgb: 0x000000),
outgoing: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x313131), highlightedFill: UIColor(rgb: 0x464646), stroke: UIColor(rgb: 0x313131)), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x313131), highlightedFill: UIColor(rgb: 0x464646), stroke: UIColor(rgb: 0x313131))), itemSeparatorColor: UIColor(rgb: 0x3d3d40),
freeform: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x1f1f1f), highlightedFill: UIColor(rgb: 0x2A2A2A), stroke: UIColor(rgb: 0x1f1f1f)), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x1f1f1f), highlightedFill: UIColor(rgb: 0x2A2A2A), stroke: UIColor(rgb: 0x1f1f1f))), itemBackgroundColor: UIColor(rgb: 0x000000),
incomingPrimaryTextColor: UIColor(rgb: 0xffffff), pinnedItemBackgroundColor: UIColor(rgb: 0x1c1c1d),
incomingSecondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5), itemHighlightedBackgroundColor: UIColor(rgb: 0x191919),
incomingLinkTextColor: accentColor, itemSelectedBackgroundColor: UIColor(rgb: 0x191919),
incomingLinkHighlightColor: accentColor.withAlphaComponent(0.5), titleColor: UIColor(rgb: 0xffffff),
incomingScamColor: destructiveColor, secretTitleColor: secretColor,
outgoingPrimaryTextColor: UIColor(rgb: 0xffffff), dateTextColor: UIColor(rgb: 0x8e8e92),
outgoingSecondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5), authorNameColor: UIColor(rgb: 0xffffff),
outgoingLinkTextColor: accentColor, messageTextColor: UIColor(rgb: 0x8e8e92),
outgoingLinkHighlightColor: accentColor.withAlphaComponent(0.5), messageDraftTextColor: UIColor(rgb: 0xdd4b39),
outgoingScamColor: destructiveColor, checkmarkColor: UIColor(rgb: 0xffffff),
infoPrimaryTextColor: UIColor(rgb: 0xffffff), pendingIndicatorColor: UIColor(rgb: 0xffffff),
infoLinkTextColor: accentColor, failedFillColor: destructiveColor,
incomingTextHighlightColor: UIColor(rgb: 0xffe438), failedForegroundColor: .white,
outgoingTextHighlightColor: UIColor(rgb: 0xffe438), muteIconColor: UIColor(rgb: 0x8e8e92),
incomingAccentTextColor: UIColor(rgb: 0xffffff), unreadBadgeActiveBackgroundColor: UIColor(rgb: 0xffffff),
outgoingAccentTextColor: UIColor(rgb: 0xffffff), unreadBadgeActiveTextColor: UIColor(rgb: 0x000000),
incomingAccentControlColor: UIColor(rgb: 0xffffff), unreadBadgeInactiveBackgroundColor: UIColor(rgb: 0x666666),
outgoingAccentControlColor: UIColor(rgb: 0xffffff), unreadBadgeInactiveTextColor:UIColor(rgb: 0x000000),
incomingMediaActiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.6), pinnedBadgeColor: UIColor(rgb: 0x767677),
outgoingMediaActiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.6), pinnedSearchBarColor: UIColor(rgb: 0x272728),
incomingMediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.3), regularSearchBarColor: UIColor(rgb: 0x272728),
outgoingMediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.3), sectionHeaderFillColor: UIColor(rgb: 0x1C1C1D),
outgoingCheckColor: UIColor(rgb: 0xffffff, alpha: 0.5), sectionHeaderTextColor: UIColor(rgb: 0xffffff),
incomingPendingActivityColor: UIColor(rgb: 0xffffff, alpha: 0.5), searchBarKeyboardColor: .dark,
outgoingPendingActivityColor: UIColor(rgb: 0xffffff, alpha: 0.5), verifiedIconFillColor: accentColor,
mediaDateAndStatusFillColor: UIColor(white: 0.0, alpha: 0.5), verifiedIconForegroundColor: .white,
mediaDateAndStatusTextColor: .white, secretIconColor: secretColor,
incomingFileTitleColor: UIColor(rgb: 0xffffff), pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x72d5fd), UIColor(rgb: 0x2a9ef1)), foregroundColor: .white),
outgoingFileTitleColor: UIColor(rgb: 0xffffff), unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x666666), UIColor(rgb: 0x666666)), foregroundColor: .black),
incomingFileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.5), onlineDotColor: UIColor(rgb: 0x4cc91f)
outgoingFileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.5), )
incomingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5),
outgoingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5),
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
shareButtonStrokeColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xb2b2b2, alpha: 0.18), withoutWallpaper: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
shareButtonForegroundColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xb2b2b2), withoutWallpaper: UIColor(rgb: 0xb2b2b2)), //!!!
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6), //!!!
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0), //!!!
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
actionButtonsIncomingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
actionButtonsIncomingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
actionButtonsOutgoingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
selectionControlBorderColor: .white,
selectionControlFillColor: accentColor,
selectionControlForegroundColor: .black,
mediaHighlightOverlayColor: UIColor(white: 1.0, alpha: 0.6),
deliveryFailedFillColor: destructiveColor,
deliveryFailedForegroundColor: .white,
incomingMediaPlaceholderColor: UIColor(rgb: 0x1f1f1f).mixedWith(.white, alpha: 0.05),
outgoingMediaPlaceholderColor: UIColor(rgb: 0x313131).mixedWith(.white, alpha: 0.05),
incomingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x737373), radioProgress: accentColor, highlight: accentColor.withAlphaComponent(0.12), separator: UIColor(rgb: 0x000000), bar: accentColor),
outgoingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x838383), radioProgress: accentColor, highlight: accentColor.withAlphaComponent(0.12), separator: UIColor(white: 0.3, alpha: 1.0), bar: accentColor)
)
private let serviceMessage = PresentationThemeServiceMessage( let bubble = PresentationThemeChatBubble(
components: PresentationThemeServiceMessageColor(withDefaultWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0x1f1f1f, alpha: 1.0), primaryText: UIColor(rgb: 0xffffff), linkHighlight: UIColor(rgb: 0xffffff, alpha: 0.12), scam: destructiveColor, dateFillStatic: UIColor(rgb: 0x1f1f1f, alpha: 1.0), dateFillFloating: UIColor(rgb: 0xffffff, alpha: 0.2)), withCustomWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0x1f1f1f, alpha: 1.0), primaryText: .white, linkHighlight: UIColor(rgb: 0xffffff, alpha: 0.12), scam: destructiveColor, dateFillStatic: UIColor(rgb: 0x1f1f1f, alpha: 1.0), dateFillFloating: UIColor(rgb: 0xffffff, alpha: 0.2))), incoming: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x262628), highlightedFill: UIColor(rgb: 0x353539), stroke: UIColor(rgb: 0x262628)), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x262628), highlightedFill: UIColor(rgb: 0x353539), stroke: UIColor(rgb: 0x262628))),
unreadBarFillColor: UIColor(rgb: 0x1b1b1b), //!!! outgoing: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: accentColor, highlightedFill: accentColor.withMultipliedBrightnessBy(1.421), stroke: accentColor), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: accentColor, highlightedFill: accentColor.withMultipliedBrightnessBy(1.421), stroke: accentColor)),
unreadBarStrokeColor: UIColor(rgb: 0x000000), freeform: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x1f1f1f), highlightedFill: UIColor(rgb: 0x2A2A2A), stroke: UIColor(rgb: 0x1f1f1f)), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: UIColor(rgb: 0x1f1f1f), highlightedFill: UIColor(rgb: 0x2A2A2A), stroke: UIColor(rgb: 0x1f1f1f))),
unreadBarTextColor: UIColor(rgb: 0xb2b2b2), //!!! incomingPrimaryTextColor: UIColor(rgb: 0xffffff),
dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2)) incomingSecondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
) incomingLinkTextColor: accentColor,
incomingLinkHighlightColor: accentColor.withAlphaComponent(0.5),
incomingScamColor: destructiveColor,
outgoingPrimaryTextColor: UIColor(rgb: 0xffffff),
outgoingSecondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
outgoingLinkTextColor: accentColor,
outgoingLinkHighlightColor: accentColor.withAlphaComponent(0.5),
outgoingScamColor: destructiveColor,
infoPrimaryTextColor: UIColor(rgb: 0xffffff),
infoLinkTextColor: accentColor,
incomingTextHighlightColor: UIColor(rgb: 0xffe438),
outgoingTextHighlightColor: UIColor(rgb: 0xffe438),
incomingAccentTextColor: UIColor(rgb: 0xffffff),
outgoingAccentTextColor: UIColor(rgb: 0xffffff),
incomingAccentControlColor: UIColor(rgb: 0xffffff),
outgoingAccentControlColor: UIColor(rgb: 0xffffff),
incomingMediaActiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.6),
outgoingMediaActiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.6),
incomingMediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.3),
outgoingMediaInactiveControlColor: UIColor(rgb: 0xffffff, alpha: 0.3),
outgoingCheckColor: UIColor(rgb: 0xffffff, alpha: 0.5),
incomingPendingActivityColor: UIColor(rgb: 0xffffff, alpha: 0.5),
outgoingPendingActivityColor: UIColor(rgb: 0xffffff, alpha: 0.5),
mediaDateAndStatusFillColor: UIColor(white: 0.0, alpha: 0.5),
mediaDateAndStatusTextColor: .white,
incomingFileTitleColor: UIColor(rgb: 0xffffff),
outgoingFileTitleColor: UIColor(rgb: 0xffffff),
incomingFileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.5),
outgoingFileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.5),
incomingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5),
outgoingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5),
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
shareButtonStrokeColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xb2b2b2, alpha: 0.18), withoutWallpaper: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
shareButtonForegroundColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xb2b2b2), withoutWallpaper: UIColor(rgb: 0xb2b2b2)),
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6),
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0),
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
actionButtonsIncomingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
actionButtonsIncomingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
actionButtonsOutgoingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
selectionControlBorderColor: .white,
selectionControlFillColor: accentColor,
selectionControlForegroundColor: .black,
mediaHighlightOverlayColor: UIColor(white: 1.0, alpha: 0.6),
deliveryFailedFillColor: destructiveColor,
deliveryFailedForegroundColor: .white,
incomingMediaPlaceholderColor: UIColor(rgb: 0x1f1f1f).mixedWith(.white, alpha: 0.05),
outgoingMediaPlaceholderColor: UIColor(rgb: 0x313131).mixedWith(.white, alpha: 0.05),
incomingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x737373), radioProgress: accentColor, highlight: accentColor.withAlphaComponent(0.12), separator: UIColor(rgb: 0x000000), bar: accentColor),
outgoingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x838383), radioProgress: accentColor, highlight: accentColor.withAlphaComponent(0.12), separator: UIColor(white: 0.3, alpha: 1.0), bar: accentColor)
)
private let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl( let serviceMessage = PresentationThemeServiceMessage(
buttonColor: accentColor, components: PresentationThemeServiceMessageColor(withDefaultWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0x1f1f1f, alpha: 1.0), primaryText: UIColor(rgb: 0xffffff), linkHighlight: UIColor(rgb: 0xffffff, alpha: 0.12), scam: destructiveColor, dateFillStatic: UIColor(rgb: 0x1f1f1f, alpha: 1.0), dateFillFloating: UIColor(rgb: 0xffffff, alpha: 0.2)), withCustomWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0x1f1f1f, alpha: 1.0), primaryText: .white, linkHighlight: UIColor(rgb: 0xffffff, alpha: 0.12), scam: destructiveColor, dateFillStatic: UIColor(rgb: 0x1f1f1f, alpha: 1.0), dateFillFloating: UIColor(rgb: 0xffffff, alpha: 0.2))),
micLevelColor: accentColor.withAlphaComponent(0.2), unreadBarFillColor: UIColor(rgb: 0x1b1b1b),
activeIconColor: .black, unreadBarStrokeColor: UIColor(rgb: 0x000000),
panelControlFillColor: UIColor(rgb: 0x1C1C1D), unreadBarTextColor: UIColor(rgb: 0xb2b2b2),
panelControlStrokeColor: UIColor(rgb: 0x1C1C1D), dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff))
panelControlContentPrimaryColor: UIColor(rgb: 0x9597a0), //!!! )
panelControlContentAccentColor: accentColor
)
private let inputPanel = PresentationThemeChatInputPanel( let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
panelBackgroundColor: UIColor(rgb: 0x1c1c1d), buttonColor: accentColor,
panelStrokeColor: UIColor(rgb: 0x000000), micLevelColor: accentColor.withAlphaComponent(0.2),
panelControlAccentColor: accentColor, activeIconColor: .black,
panelControlColor: UIColor(rgb: 0x808080), panelControlFillColor: UIColor(rgb: 0x1C1C1D),
panelControlDisabledColor: UIColor(rgb: 0x808080, alpha: 0.5), //!!! panelControlStrokeColor: UIColor(rgb: 0x1C1C1D),
panelControlDestructiveColor: UIColor(rgb: 0xff3b30), //!!! panelControlContentPrimaryColor: UIColor(rgb: 0x9597a0),
inputBackgroundColor: UIColor(rgb: 0x060606), panelControlContentAccentColor: accentColor
inputStrokeColor: UIColor(rgb: 0x060606), )
inputPlaceholderColor: UIColor(rgb: 0x7b7b7b),
inputTextColor: UIColor(rgb: 0xffffff),
inputControlColor: UIColor(rgb: 0x7b7b7b),
actionControlFillColor: accentColor,
actionControlForegroundColor: .black,
primaryTextColor: UIColor(rgb: 0xffffff),
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
mediaRecordingDotColor: .white,
keyboardColor: .dark,
mediaRecordingControl: inputPanelMediaRecordingControl
)
private let inputMediaPanel = PresentationThemeInputMediaPanel( let inputPanel = PresentationThemeChatInputPanel(
panelSeparatorColor: UIColor(rgb: 0x000000), panelBackgroundColor: UIColor(rgb: 0x1c1c1d),
panelIconColor: UIColor(rgb: 0x808080), panelStrokeColor: UIColor(rgb: 0x000000),
panelHighlightedIconBackgroundColor: UIColor(rgb: 0x000000), //!!! panelControlAccentColor: accentColor,
stickersBackgroundColor: UIColor(rgb: 0x000000), panelControlColor: UIColor(rgb: 0x808080),
stickersSectionTextColor: UIColor(rgb: 0x7b7b7b), panelControlDisabledColor: UIColor(rgb: 0x808080, alpha: 0.5),
stickersSearchBackgroundColor: UIColor(rgb: 0x1c1c1d), panelControlDestructiveColor: UIColor(rgb: 0xff3b30),
stickersSearchPlaceholderColor: UIColor(rgb: 0x8e8e93), inputBackgroundColor: UIColor(rgb: 0x060606),
stickersSearchPrimaryColor: .white, inputStrokeColor: UIColor(rgb: 0x060606),
stickersSearchControlColor: UIColor(rgb: 0x8e8e93), inputPlaceholderColor: UIColor(rgb: 0x7b7b7b),
gifsBackgroundColor: UIColor(rgb: 0x000000) inputTextColor: UIColor(rgb: 0xffffff),
) inputControlColor: UIColor(rgb: 0x7b7b7b),
actionControlFillColor: accentColor,
actionControlForegroundColor: .black,
primaryTextColor: UIColor(rgb: 0xffffff),
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
mediaRecordingDotColor: .white,
keyboardColor: .dark,
mediaRecordingControl: inputPanelMediaRecordingControl
)
private let inputButtonPanel = PresentationThemeInputButtonPanel( let inputMediaPanel = PresentationThemeInputMediaPanel(
panelSeparatorColor: UIColor(rgb: 0x000000), panelSeparatorColor: UIColor(rgb: 0x3d3d40),
panelBackgroundColor: UIColor(rgb: 0x141414), panelIconColor: UIColor(rgb: 0x808080),
buttonFillColor: UIColor(rgb: 0x5A5A5A), panelHighlightedIconBackgroundColor: UIColor(rgb: 0x000000),
buttonStrokeColor: UIColor(rgb: 0x0C0C0C), stickersBackgroundColor: UIColor(rgb: 0x000000),
buttonHighlightedFillColor: UIColor(rgb: 0x5A5A5A, alpha: 0.7), stickersSectionTextColor: UIColor(rgb: 0x7b7b7b),
buttonHighlightedStrokeColor: UIColor(rgb: 0x0C0C0C), stickersSearchBackgroundColor: UIColor(rgb: 0x1c1c1d),
buttonTextColor: UIColor(rgb: 0xffffff) stickersSearchPlaceholderColor: UIColor(rgb: 0x8e8e92),
) stickersSearchPrimaryColor: .white,
stickersSearchControlColor: UIColor(rgb: 0x8e8e92),
gifsBackgroundColor: UIColor(rgb: 0x000000)
)
private let historyNavigation = PresentationThemeChatHistoryNavigation( let inputButtonPanel = PresentationThemeInputButtonPanel(
fillColor: UIColor(rgb: 0x1C1C1D), panelSeparatorColor: UIColor(rgb: 0x3d3d40),
strokeColor: UIColor(rgb: 0x000000), panelBackgroundColor: UIColor(rgb: 0x141414),
foregroundColor: UIColor(rgb: 0xffffff), buttonFillColor: UIColor(rgb: 0x5A5A5A),
badgeBackgroundColor: accentColor, buttonStrokeColor: UIColor(rgb: 0x0C0C0C),
badgeStrokeColor: .black, buttonHighlightedFillColor: UIColor(rgb: 0x5A5A5A, alpha: 0.7),
badgeTextColor: .black buttonHighlightedStrokeColor: UIColor(rgb: 0x0C0C0C),
) buttonTextColor: UIColor(rgb: 0xffffff)
)
private let chat = PresentationThemeChat( let historyNavigation = PresentationThemeChatHistoryNavigation(
bubble: bubble, fillColor: UIColor(rgb: 0x1C1C1D),
serviceMessage: serviceMessage, strokeColor: UIColor(rgb: 0x000000),
inputPanel: inputPanel, foregroundColor: UIColor(rgb: 0xffffff),
inputMediaPanel: inputMediaPanel, badgeBackgroundColor: accentColor,
inputButtonPanel: inputButtonPanel, badgeStrokeColor: .black,
historyNavigation: historyNavigation badgeTextColor: .black
) )
private let actionSheet = PresentationThemeActionSheet( let chat = PresentationThemeChat(
dimColor: UIColor(white: 0.0, alpha: 0.5), bubble: bubble,
backgroundType: .dark, serviceMessage: serviceMessage,
opaqueItemBackgroundColor: UIColor(rgb: 0x1c1c1d), inputPanel: inputPanel,
itemBackgroundColor: UIColor(rgb: 0x1c1c1d, alpha: 0.8), inputMediaPanel: inputMediaPanel,
opaqueItemHighlightedBackgroundColor: UIColor(white: 0.0, alpha: 1.0), inputButtonPanel: inputButtonPanel,
itemHighlightedBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.5), //!!! historyNavigation: historyNavigation
standardActionTextColor: accentColor, )
opaqueItemSeparatorColor: UIColor(white: 0.0, alpha: 1.0),
destructiveActionTextColor: destructiveColor,
disabledActionTextColor: UIColor(rgb: 0x4d4d4d), //!!!
primaryTextColor: .white,
secondaryTextColor: UIColor(rgb: 0x5e5e5e), //!!!
controlAccentColor: accentColor,
inputBackgroundColor: UIColor(rgb: 0x545454), //!!!
inputHollowBackgroundColor: UIColor(rgb: 0x545454),
inputBorderColor: UIColor(rgb: 0x545454),
inputPlaceholderColor: UIColor(rgb: 0xaaaaaa), //!!!
inputTextColor: .white,
inputClearButtonColor: UIColor(rgb: 0xaaaaaa),
checkContentColor: .black
)
private let inAppNotification = PresentationThemeInAppNotification( let actionSheet = PresentationThemeActionSheet(
fillColor: UIColor(rgb: 0x1c1c1d), dimColor: UIColor(white: 0.0, alpha: 0.5),
primaryTextColor: .white,
expandedNotification: PresentationThemeExpandedNotification(
backgroundType: .dark, backgroundType: .dark,
navigationBar: PresentationThemeExpandedNotificationNavigationBar( opaqueItemBackgroundColor: UIColor(rgb: 0x1c1c1d),
backgroundColor: UIColor(rgb: 0x1c1c1d), itemBackgroundColor: UIColor(rgb: 0x1c1c1d, alpha: 0.8),
primaryTextColor: accentColor, opaqueItemHighlightedBackgroundColor: UIColor(white: 0.0, alpha: 1.0),
controlColor: accentColor, itemHighlightedBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.5),
separatorColor: UIColor(rgb: 0x000000) standardActionTextColor: accentColor,
opaqueItemSeparatorColor: UIColor(rgb: 0x3d3d40),
destructiveActionTextColor: destructiveColor,
disabledActionTextColor: UIColor(rgb: 0x4d4d4d),
primaryTextColor: .white,
secondaryTextColor: UIColor(rgb: 0x5e5e5e),
controlAccentColor: accentColor,
inputBackgroundColor: UIColor(rgb: 0x5a5a5e),
inputHollowBackgroundColor: UIColor(rgb: 0x5a5a5e),
inputBorderColor: UIColor(rgb: 0x5a5a5e),
inputPlaceholderColor: UIColor(rgb: 0xaaaaaa),
inputTextColor: .white,
inputClearButtonColor: UIColor(rgb: 0xaaaaaa),
checkContentColor: .black
)
let inAppNotification = PresentationThemeInAppNotification(
fillColor: UIColor(rgb: 0x1c1c1d),
primaryTextColor: .white,
expandedNotification: PresentationThemeExpandedNotification(
backgroundType: .dark,
navigationBar: PresentationThemeExpandedNotificationNavigationBar(
backgroundColor: UIColor(rgb: 0x1c1c1d),
primaryTextColor: accentColor,
controlColor: accentColor,
separatorColor: UIColor(rgb: 0x000000)
)
) )
) )
)
public let defaultDarkPresentationTheme = PresentationTheme( return PresentationTheme(
name: .builtin(.nightGrayscale), name: .builtin(.nightGrayscale),
overallDarkAppearance: true, overallDarkAppearance: true,
allowsCustomWallpapers: false, auth: auth,
auth: auth, passcode: passcode,
passcode: passcode, rootController: rootController,
rootController: rootController, list: list,
list: list, chatList: chatList,
chatList: chatList, chat: chat,
chat: chat, actionSheet: actionSheet,
actionSheet: actionSheet, inAppNotification: inAppNotification
inAppNotification: inAppNotification )
) }
public let defaultDarkPresentationTheme = makeDarkPresentationTheme(accentColor: 0x2EA6FF)
public func makeDarkPresentationTheme(accentColor: Int32?) -> PresentationTheme {
let color: UIColor
if let accentColor = accentColor {
color = UIColor(rgb: UInt32(bitPattern: accentColor))
} else {
color = UIColor(rgb: UInt32(bitPattern: defaultDayAccentColor))
}
return makeDarkPresentationTheme(accentColor: color)
}

View File

@ -449,7 +449,6 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
return PresentationTheme( return PresentationTheme(
name: .builtin(day ? .day : .dayClassic), name: .builtin(day ? .day : .dayClassic),
overallDarkAppearance: false, overallDarkAppearance: false,
allowsCustomWallpapers: true,
auth: auth, auth: auth,
passcode: passcode, passcode: passcode,
rootController: rootController, rootController: rootController,

View File

@ -279,9 +279,9 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager) -
case .dayClassic: case .dayClassic:
themeValue = defaultPresentationTheme themeValue = defaultPresentationTheme
case .nightGrayscale: case .nightGrayscale:
themeValue = defaultDarkPresentationTheme themeValue = makeDarkPresentationTheme(accentColor: effectiveAccentColor)
case .nightAccent: case .nightAccent:
themeValue = defaultDarkAccentPresentationTheme themeValue = makeDarkAccentPresentationTheme(accentColor: effectiveAccentColor)
case .day: case .day:
themeValue = makeDefaultDayPresentationTheme(accentColor: effectiveAccentColor, serviceBackgroundColor: defaultServiceBackgroundColor) themeValue = makeDefaultDayPresentationTheme(accentColor: effectiveAccentColor, serviceBackgroundColor: defaultServiceBackgroundColor)
} }
@ -561,9 +561,9 @@ public func updatedPresentationData(accountManager: AccountManager, applicationI
case .dayClassic: case .dayClassic:
themeValue = makeDefaultPresentationTheme(serviceBackgroundColor: serviceBackgroundColor) themeValue = makeDefaultPresentationTheme(serviceBackgroundColor: serviceBackgroundColor)
case .nightGrayscale: case .nightGrayscale:
themeValue = defaultDarkPresentationTheme themeValue = makeDarkPresentationTheme(accentColor: effectiveAccentColor)
case .nightAccent: case .nightAccent:
themeValue = defaultDarkAccentPresentationTheme themeValue = makeDarkAccentPresentationTheme(accentColor: effectiveAccentColor)
case .day: case .day:
themeValue = makeDefaultDayPresentationTheme(accentColor: effectiveAccentColor, serviceBackgroundColor: serviceBackgroundColor) themeValue = makeDefaultDayPresentationTheme(accentColor: effectiveAccentColor, serviceBackgroundColor: serviceBackgroundColor)
} }

View File

@ -951,7 +951,6 @@ public enum PresentationThemeName: Equatable {
public final class PresentationTheme: Equatable { public final class PresentationTheme: Equatable {
public let name: PresentationThemeName public let name: PresentationThemeName
public let overallDarkAppearance: Bool public let overallDarkAppearance: Bool
public let allowsCustomWallpapers: Bool
public let auth: PresentationThemeAuth public let auth: PresentationThemeAuth
public let passcode: PresentationThemePasscode public let passcode: PresentationThemePasscode
public let rootController: PresentationThemeRootController public let rootController: PresentationThemeRootController
@ -963,10 +962,9 @@ public final class PresentationTheme: Equatable {
public let resourceCache: PresentationsResourceCache = PresentationsResourceCache() public let resourceCache: PresentationsResourceCache = PresentationsResourceCache()
public init(name: PresentationThemeName, overallDarkAppearance: Bool, allowsCustomWallpapers: Bool, auth: PresentationThemeAuth, passcode: PresentationThemePasscode, rootController: PresentationThemeRootController, list: PresentationThemeList, chatList: PresentationThemeChatList, chat: PresentationThemeChat, actionSheet: PresentationThemeActionSheet, inAppNotification: PresentationThemeInAppNotification) { public init(name: PresentationThemeName, overallDarkAppearance: Bool, auth: PresentationThemeAuth, passcode: PresentationThemePasscode, rootController: PresentationThemeRootController, list: PresentationThemeList, chatList: PresentationThemeChatList, chat: PresentationThemeChat, actionSheet: PresentationThemeActionSheet, inAppNotification: PresentationThemeInAppNotification) {
self.name = name self.name = name
self.overallDarkAppearance = overallDarkAppearance self.overallDarkAppearance = overallDarkAppearance
self.allowsCustomWallpapers = allowsCustomWallpapers
self.auth = auth self.auth = auth
self.passcode = passcode self.passcode = passcode
self.rootController = rootController self.rootController = rootController

View File

@ -666,7 +666,7 @@ func convertMarkdownToAttributes(_ text: NSAttributedString) -> NSAttributedStri
while let match = regex.firstMatch(in: string as String, range: NSMakeRange(0, string.length)) { while let match = regex.firstMatch(in: string as String, range: NSMakeRange(0, string.length)) {
let matchIndex = stringOffset + match.range.location let matchIndex = stringOffset + match.range.location
result.append(text.attributedSubstring(from: NSMakeRange(0, match.range.location))) result.append(text.attributedSubstring(from: NSMakeRange(text.length - string.length, match.range.location)))
var pre = match.range(at: 3) var pre = match.range(at: 3)
if pre.location != NSNotFound { if pre.location != NSNotFound {

View File

@ -150,7 +150,7 @@ func uploadCustomWallpaper(context: AccountContext, wallpaper: WallpaperGalleryE
let _ = (updatePresentationThemeSettingsInteractively(accountManager: accountManager, { current in let _ = (updatePresentationThemeSettingsInteractively(accountManager: accountManager, { current in
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
themeSpecificChatWallpapers[current.theme.index] = wallpaper themeSpecificChatWallpapers[current.theme.index] = wallpaper
return PresentationThemeSettings(chatWallpaper: wallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: wallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
})).start() })).start()
} }

View File

@ -10,11 +10,11 @@ import UniversalMediaPlayer
private let kOutputBus: UInt32 = 0 private let kOutputBus: UInt32 = 0
private let kInputBus: UInt32 = 1 private let kInputBus: UInt32 = 1
private func audioRecorderNativeStreamDescription() -> AudioStreamBasicDescription { private func audioRecorderNativeStreamDescription(sampleRate: Float64) -> AudioStreamBasicDescription {
var canonicalBasicStreamDescription = AudioStreamBasicDescription() var canonicalBasicStreamDescription = AudioStreamBasicDescription()
canonicalBasicStreamDescription.mSampleRate = 16000.0 canonicalBasicStreamDescription.mSampleRate = sampleRate
canonicalBasicStreamDescription.mFormatID = kAudioFormatLinearPCM canonicalBasicStreamDescription.mFormatID = kAudioFormatLinearPCM
canonicalBasicStreamDescription.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked canonicalBasicStreamDescription.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked
canonicalBasicStreamDescription.mFramesPerPacket = 1 canonicalBasicStreamDescription.mFramesPerPacket = 1
canonicalBasicStreamDescription.mChannelsPerFrame = 1 canonicalBasicStreamDescription.mChannelsPerFrame = 1
canonicalBasicStreamDescription.mBitsPerChannel = 16 canonicalBasicStreamDescription.mBitsPerChannel = 16
@ -365,7 +365,7 @@ final class ManagedAudioRecorderContext {
return return
} }
var audioStreamDescription = audioRecorderNativeStreamDescription() var audioStreamDescription = audioRecorderNativeStreamDescription(sampleRate: 48000)
guard AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &audioStreamDescription, UInt32(MemoryLayout<AudioStreamBasicDescription>.size)) == noErr else { guard AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &audioStreamDescription, UInt32(MemoryLayout<AudioStreamBasicDescription>.size)) == noErr else {
AudioComponentInstanceDispose(audioUnit) AudioComponentInstanceDispose(audioUnit)
return return

View File

@ -46,8 +46,8 @@ public extension TermsOfServiceControllerTheme {
theme = defaultDarkPresentationTheme theme = defaultDarkPresentationTheme
case defaultDarkAccentPresentationTheme.list.itemBlocksBackgroundColor.argb: case defaultDarkAccentPresentationTheme.list.itemBlocksBackgroundColor.argb:
theme = defaultDarkAccentPresentationTheme theme = defaultDarkAccentPresentationTheme
default: default:
theme = defaultPresentationTheme theme = defaultPresentationTheme
} }
return theme return theme
} }

View File

@ -185,7 +185,7 @@ final class ThemeGridController: ViewController {
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
themeSpecificChatWallpapers[current.theme.index] = fallbackWallpaper themeSpecificChatWallpapers[current.theme.index] = fallbackWallpaper
return PresentationThemeSettings(chatWallpaper: fallbackWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: fallbackWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
})).start() })).start()
break break
} }
@ -257,7 +257,7 @@ final class ThemeGridController: ViewController {
} else { } else {
wallpaper = .builtin(WallpaperSettings()) wallpaper = .builtin(WallpaperSettings())
} }
return PresentationThemeSettings(chatWallpaper: wallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: [:], fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: wallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: [:], themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
}) })
}).start() }).start()

View File

@ -13,17 +13,23 @@ private final class ThemeSettingsControllerArguments {
let selectFontSize: (PresentationFontSize) -> Void let selectFontSize: (PresentationFontSize) -> Void
let openWallpaperSettings: () -> Void let openWallpaperSettings: () -> Void
let openAccentColor: (Int32) -> Void let openAccentColor: (Int32) -> Void
let selectAccentColor: (PresentationThemeAccentColor) -> Void
let toggleColorSlider: () -> Void
let toggleTintAllColors: () -> Void
let openAutoNightTheme: () -> Void let openAutoNightTheme: () -> Void
let toggleLargeEmoji: (Bool) -> Void let toggleLargeEmoji: (Bool) -> Void
let disableAnimations: (Bool) -> Void let disableAnimations: (Bool) -> Void
let selectAppIcon: (String) -> Void let selectAppIcon: (String) -> Void
init(context: AccountContext, selectTheme: @escaping (PresentationThemeReference) -> Void, selectFontSize: @escaping (PresentationFontSize) -> Void, openWallpaperSettings: @escaping () -> Void, openAccentColor: @escaping (Int32) -> Void, openAutoNightTheme: @escaping () -> Void, toggleLargeEmoji: @escaping (Bool) -> Void, disableAnimations: @escaping (Bool) -> Void, selectAppIcon: @escaping (String) -> Void) { init(context: AccountContext, selectTheme: @escaping (PresentationThemeReference) -> Void, selectFontSize: @escaping (PresentationFontSize) -> Void, openWallpaperSettings: @escaping () -> Void, openAccentColor: @escaping (Int32) -> Void, selectAccentColor: @escaping (PresentationThemeAccentColor) -> Void, toggleColorSlider: @escaping () -> Void, toggleTintAllColors: @escaping () -> Void, openAutoNightTheme: @escaping () -> Void, toggleLargeEmoji: @escaping (Bool) -> Void, disableAnimations: @escaping (Bool) -> Void, selectAppIcon: @escaping (String) -> Void) {
self.context = context self.context = context
self.selectTheme = selectTheme self.selectTheme = selectTheme
self.selectFontSize = selectFontSize self.selectFontSize = selectFontSize
self.openWallpaperSettings = openWallpaperSettings self.openWallpaperSettings = openWallpaperSettings
self.openAccentColor = openAccentColor self.openAccentColor = openAccentColor
self.selectAccentColor = selectAccentColor
self.toggleColorSlider = toggleColorSlider
self.toggleTintAllColors = toggleTintAllColors
self.openAutoNightTheme = openAutoNightTheme self.openAutoNightTheme = openAutoNightTheme
self.toggleLargeEmoji = toggleLargeEmoji self.toggleLargeEmoji = toggleLargeEmoji
self.disableAnimations = disableAnimations self.disableAnimations = disableAnimations
@ -42,6 +48,7 @@ private enum ThemeSettingsControllerSection: Int32 {
public enum ThemeSettingsEntryTag: ItemListItemTag { public enum ThemeSettingsEntryTag: ItemListItemTag {
case fontSize case fontSize
case theme case theme
case tint
case accentColor case accentColor
case icon case icon
case largeEmoji case largeEmoji
@ -64,6 +71,7 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
case wallpaper(PresentationTheme, String) case wallpaper(PresentationTheme, String)
case accentColor(PresentationTheme, String, PresentationThemeAccentColor?) case accentColor(PresentationTheme, String, PresentationThemeAccentColor?)
case autoNightTheme(PresentationTheme, String, String) case autoNightTheme(PresentationTheme, String, String)
case themeTint(PresentationTheme, String, Bool)
case themeItem(PresentationTheme, PresentationStrings, [PresentationThemeReference], PresentationThemeReference, [Int64: PresentationThemeAccentColor]) case themeItem(PresentationTheme, PresentationStrings, [PresentationThemeReference], PresentationThemeReference, [Int64: PresentationThemeAccentColor])
case iconHeader(PresentationTheme, String) case iconHeader(PresentationTheme, String)
case iconItem(PresentationTheme, PresentationStrings, [PresentationAppIcon], String?) case iconItem(PresentationTheme, PresentationStrings, [PresentationAppIcon], String?)
@ -74,7 +82,7 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
var section: ItemListSectionId { var section: ItemListSectionId {
switch self { switch self {
case .themeListHeader, .chatPreview, .themeItem, .accentColor: case .themeListHeader, .chatPreview, .themeItem, .themeTint, .accentColor:
return ThemeSettingsControllerSection.chatPreview.rawValue return ThemeSettingsControllerSection.chatPreview.rawValue
case .fontSizeHeader, .fontSize: case .fontSizeHeader, .fontSize:
return ThemeSettingsControllerSection.fontSize.rawValue return ThemeSettingsControllerSection.fontSize.rawValue
@ -95,28 +103,30 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
return 1 return 1
case .themeItem: case .themeItem:
return 2 return 2
case .accentColor: case .themeTint:
return 3 return 3
case .wallpaper: case .accentColor:
return 4 return 4
case .autoNightTheme: case .wallpaper:
return 5 return 5
case .fontSizeHeader: case .autoNightTheme:
return 6 return 6
case .fontSize: case .fontSizeHeader:
return 7 return 7
case .iconHeader: case .fontSize:
return 8 return 8
case .iconItem: case .iconHeader:
return 9 return 9
case .otherHeader: case .iconItem:
return 10 return 10
case .largeEmoji: case .otherHeader:
return 11 return 11
case .animations: case .largeEmoji:
return 12 return 12
case .animationsInfo: case .animations:
return 13 return 13
case .animationsInfo:
return 14
} }
} }
@ -134,6 +144,12 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
} else { } else {
return false return false
} }
case let .themeTint(lhsTheme, lhsTitle, lhsValue):
if case let .themeTint(rhsTheme, rhsTitle, rhsValue) = rhs, lhsTheme === rhsTheme, lhsTitle == rhsTitle, lhsValue == rhsValue {
return true
} else {
return false
}
case let .accentColor(lhsTheme, lhsText, lhsColor): case let .accentColor(lhsTheme, lhsText, lhsColor):
if case let .accentColor(rhsTheme, rhsText, rhsColor) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsColor == rhsColor { if case let .accentColor(rhsTheme, rhsText, rhsColor) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsColor == rhsColor {
return true return true
@ -227,20 +243,24 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
return ItemListDisclosureItem(theme: theme, title: text, label: "", sectionId: self.section, style: .blocks, action: { return ItemListDisclosureItem(theme: theme, title: text, label: "", sectionId: self.section, style: .blocks, action: {
arguments.openWallpaperSettings() arguments.openWallpaperSettings()
}) })
case let .accentColor(theme, text, color): case let .themeTint(theme, title, value):
return ItemListSwitchItem(theme: theme, title: title, value: value, sectionId: self.section, style: .blocks, updated: { value in
arguments.toggleLargeEmoji(value)
}, tag: ThemeSettingsEntryTag.tint)
case let .accentColor(theme, _, color):
let colorValue = color?.baseColor.colorValue ?? defaultDayAccentColor let colorValue = color?.baseColor.colorValue ?? defaultDayAccentColor
let accentColor = UIColor(rgb: UInt32(bitPattern: colorValue)) // let accentColor = UIColor(rgb: UInt32(bitPattern: colorValue))
return ItemListDisclosureItem(theme: theme, icon: nil, title: text, label: "", labelStyle: .color(accentColor), sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.openAccentColor(colorValue) var colors = PresentationThemeBaseColor.allCases
if theme.overallDarkAppearance {
colors = colors.filter { $0 != .black }
}
return ThemeSettingsAccentColorItem(theme: theme, sectionId: self.section, colors: colors, currentColor: color ?? PresentationThemeAccentColor(baseColor: .blue, value: 0.5), updated: { color in
arguments.selectAccentColor(color)
}, toggleSlider: {
arguments.toggleColorSlider()
}, tag: ThemeSettingsEntryTag.accentColor) }, tag: ThemeSettingsEntryTag.accentColor)
// return ThemeSettingsAccentColorItem(theme: theme, sectionId: self.section, colors: PresentationThemeBaseColor.allCases, currentColor: color ?? PresentationThemeAccentColor(baseColor: .blue, value: 0.5), updated: { color in
// let _ = updatePresentationThemeSettingsInteractively(accountManager: arguments.context.sharedContext.accountManager, { current in
// var themeSpecificAccentColors = current.themeSpecificAccentColors
// themeSpecificAccentColors[current.theme.index] = color
// return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
// }).start()
// }, toggleSlider: {
// })
case let .autoNightTheme(theme, text, value): case let .autoNightTheme(theme, text, value):
return ItemListDisclosureItem(theme: theme, icon: nil, title: text, label: value, labelStyle: .text, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: { return ItemListDisclosureItem(theme: theme, icon: nil, title: text, label: value, labelStyle: .text, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
arguments.openAutoNightTheme() arguments.openAutoNightTheme()
@ -248,8 +268,10 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
case let .themeListHeader(theme, text): case let .themeListHeader(theme, text):
return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section) return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section)
case let .themeItem(theme, strings, themes, currentTheme, themeSpecificAccentColors): case let .themeItem(theme, strings, themes, currentTheme, themeSpecificAccentColors):
return ThemeSettingsThemeItem(theme: theme, strings: strings, sectionId: self.section, themes: themes, themeSpecificAccentColors: themeSpecificAccentColors, currentTheme: currentTheme, updated: { theme in return ThemeSettingsThemeItem(theme: theme, strings: strings, sectionId: self.section, themes: themes, themeSpecificAccentColors: themeSpecificAccentColors, currentTheme: currentTheme, updatedTheme: { theme in
arguments.selectTheme(theme) arguments.selectTheme(theme)
}, currentColor: nil, updatedColor: { color in
arguments.selectAccentColor(color)
}) })
case let .iconHeader(theme, text): case let .iconHeader(theme, text):
return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section) return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section)
@ -273,7 +295,19 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
} }
} }
private func themeSettingsControllerEntries(presentationData: PresentationData, theme: PresentationTheme, themeReference: PresentationThemeReference, themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], autoNightSettings: AutomaticThemeSwitchSetting, strings: PresentationStrings, wallpaper: TelegramWallpaper, fontSize: PresentationFontSize, dateTimeFormat: PresentationDateTimeFormat, largeEmoji: Bool, disableAnimations: Bool, availableAppIcons: [PresentationAppIcon], currentAppIconName: String?) -> [ThemeSettingsControllerEntry] { private struct ThemeSettingsState: Equatable {
let displayColorSlider: Bool
init(displayColorSlider: Bool) {
self.displayColorSlider = displayColorSlider
}
func withDisplayColorSlider(_ displayColorSlider: Bool) -> ThemeSettingsState {
return ThemeSettingsState(displayColorSlider: displayColorSlider)
}
}
private func themeSettingsControllerEntries(presentationData: PresentationData, theme: PresentationTheme, themeReference: PresentationThemeReference, themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], autoNightSettings: AutomaticThemeSwitchSetting, strings: PresentationStrings, wallpaper: TelegramWallpaper, fontSize: PresentationFontSize, dateTimeFormat: PresentationDateTimeFormat, largeEmoji: Bool, disableAnimations: Bool, availableAppIcons: [PresentationAppIcon], currentAppIconName: String?, displayColorSlider: Bool) -> [ThemeSettingsControllerEntry] {
var entries: [ThemeSettingsControllerEntry] = [] var entries: [ThemeSettingsControllerEntry] = []
entries.append(.themeListHeader(presentationData.theme, strings.Appearance_ColorTheme.uppercased())) entries.append(.themeListHeader(presentationData.theme, strings.Appearance_ColorTheme.uppercased()))
@ -281,7 +315,10 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
if case .builtin = themeReference { if case .builtin = themeReference {
entries.append(.themeItem(presentationData.theme, presentationData.strings, [.builtin(.dayClassic), .builtin(.day), .builtin(.nightAccent), .builtin(.nightGrayscale)], themeReference, themeSpecificAccentColors)) entries.append(.themeItem(presentationData.theme, presentationData.strings, [.builtin(.dayClassic), .builtin(.day), .builtin(.nightAccent), .builtin(.nightGrayscale)], themeReference, themeSpecificAccentColors))
} }
if theme.name == .builtin(.day) { if theme.name == .builtin(.nightAccent) || theme.name == .builtin(.nightGrayscale) {
//entries.append(.themeTint(presentationData.theme, strings.Appearance_TintAllColors, false))
}
if theme.name != .builtin(.dayClassic) {
entries.append(.accentColor(presentationData.theme, strings.Appearance_AccentColor, themeSpecificAccentColors[themeReference.index])) entries.append(.accentColor(presentationData.theme, strings.Appearance_AccentColor, themeSpecificAccentColors[themeReference.index]))
} }
@ -290,12 +327,12 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
if theme.name == .builtin(.day) || theme.name == .builtin(.dayClassic) { if theme.name == .builtin(.day) || theme.name == .builtin(.dayClassic) {
let title: String let title: String
switch autoNightSettings.trigger { switch autoNightSettings.trigger {
case .none: case .none:
title = strings.AutoNightTheme_Disabled title = strings.AutoNightTheme_Disabled
case .timeBased: case .timeBased:
title = strings.AutoNightTheme_Scheduled title = strings.AutoNightTheme_Scheduled
case .brightness: case .brightness:
title = strings.AutoNightTheme_Automatic title = strings.AutoNightTheme_Automatic
} }
entries.append(.autoNightTheme(presentationData.theme, strings.Appearance_AutoNightTheme, title)) entries.append(.autoNightTheme(presentationData.theme, strings.Appearance_AutoNightTheme, title))
} }
@ -317,6 +354,13 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
} }
public func themeSettingsController(context: AccountContext, focusOnItemTag: ThemeSettingsEntryTag? = nil) -> ViewController { public func themeSettingsController(context: AccountContext, focusOnItemTag: ThemeSettingsEntryTag? = nil) -> ViewController {
let initialState = ThemeSettingsState(displayColorSlider: false)
let statePromise = ValuePromise(initialState, ignoreRepeated: true)
let stateValue = Atomic(value: initialState)
let updateState: ((ThemeSettingsState) -> ThemeSettingsState) -> Void = { f in
statePromise.set(stateValue.modify { f($0) })
}
var pushControllerImpl: ((ViewController) -> Void)? var pushControllerImpl: ((ViewController) -> Void)?
var presentControllerImpl: ((ViewController) -> Void)? var presentControllerImpl: ((ViewController) -> Void)?
@ -344,33 +388,54 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
current = PresentationThemeSettings.defaultSettings current = PresentationThemeSettings.defaultSettings
} }
let wallpaper: TelegramWallpaper let chatWallpaper: TelegramWallpaper
if let themeSpecificWallpaper = current.themeSpecificChatWallpapers[theme.index] { if let themeSpecificWallpaper = current.themeSpecificChatWallpapers[theme.index] {
wallpaper = themeSpecificWallpaper if case let .builtin(themeReference) = theme {
} else { switch themeReference {
if case let .builtin(theme) = theme {
switch theme {
case .day:
wallpaper = .color(0xffffff)
case .dayClassic:
wallpaper = .builtin(WallpaperSettings())
case .nightAccent: case .nightAccent:
wallpaper = .color(0x18222d) if let themeSpecificAccentColor = current.themeSpecificAccentColors[theme.index] {
case .nightGrayscale: let accentColor = UIColor(rgb: UInt32(bitPattern: themeSpecificAccentColor.color))
wallpaper = .color(0x000000) let backgroundColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18)
chatWallpaper = .color(Int32(bitPattern: backgroundColor.rgb))
} else {
chatWallpaper = .color(0x18222d)
}
default:
chatWallpaper = themeSpecificWallpaper
} }
} else { } else {
wallpaper = .builtin(WallpaperSettings()) chatWallpaper = themeSpecificWallpaper
}
} else {
if case let .builtin(themeReference) = theme {
switch themeReference {
case .day:
chatWallpaper = .color(0xffffff)
case .dayClassic:
chatWallpaper = .builtin(WallpaperSettings())
case .nightAccent:
if let themeSpecificAccentColor = current.themeSpecificAccentColors[theme.index] {
let accentColor = UIColor(rgb: UInt32(bitPattern: themeSpecificAccentColor.color))
let backgroundColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18)
chatWallpaper = .color(Int32(bitPattern: backgroundColor.rgb))
} else {
chatWallpaper = .color(0x18222d)
}
case .nightGrayscale:
chatWallpaper = .color(0x000000)
}
} else {
chatWallpaper = .builtin(WallpaperSettings())
} }
} }
return PresentationThemeSettings(chatWallpaper: wallpaper, theme: theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: chatWallpaper, theme: theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
}) })
}).start() }).start()
}, selectFontSize: { size in }, selectFontSize: { size in
let _ = updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in let _ = updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in
return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, fontSize: size, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: size, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
}).start() }).start()
}, openWallpaperSettings: { }, openWallpaperSettings: {
pushControllerImpl?(ThemeGridController(context: context)) pushControllerImpl?(ThemeGridController(context: context))
@ -402,18 +467,45 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
var themeSpecificAccentColors = current.themeSpecificAccentColors var themeSpecificAccentColors = current.themeSpecificAccentColors
themeSpecificAccentColors[current.theme.index] = PresentationThemeAccentColor(baseColor: themeAccentColor, value: 0.5) themeSpecificAccentColors[current.theme.index] = PresentationThemeAccentColor(baseColor: themeAccentColor, value: 0.5)
return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
}).start() }).start()
})) }))
}, selectAccentColor: { color in
let _ = updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in
var themeSpecificAccentColors = current.themeSpecificAccentColors
themeSpecificAccentColors[current.theme.index] = color
var chatWallpaper = current.chatWallpaper
if case let .builtin(themeReference) = current.theme {
switch themeReference {
case .nightAccent:
if let themeSpecificAccentColor = themeSpecificAccentColors[current.theme.index] {
let accentColor = UIColor(rgb: UInt32(bitPattern: themeSpecificAccentColor.color))
let backgroundColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18)
chatWallpaper = .color(Int32(bitPattern: backgroundColor.rgb))
} else {
chatWallpaper = .color(0x18222d)
}
default:
break
}
}
return PresentationThemeSettings(chatWallpaper: chatWallpaper, theme: current.theme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
}).start()
}, toggleColorSlider: {
updateState { $0.withDisplayColorSlider(!$0.displayColorSlider) }
}, toggleTintAllColors: {
}, openAutoNightTheme: { }, openAutoNightTheme: {
pushControllerImpl?(themeAutoNightSettingsController(context: context)) pushControllerImpl?(themeAutoNightSettingsController(context: context))
}, toggleLargeEmoji: { largeEmoji in }, toggleLargeEmoji: { largeEmoji in
let _ = updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in let _ = updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in
return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: largeEmoji, disableAnimations: current.disableAnimations)
}).start() }).start()
}, disableAnimations: { disabled in }, disableAnimations: { disabled in
let _ = updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in let _ = updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in
return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: disabled) return PresentationThemeSettings(chatWallpaper: current.chatWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: disabled)
}).start() }).start()
}, selectAppIcon: { name in }, selectAppIcon: { name in
currentAppIconName.set(name) currentAppIconName.set(name)
@ -421,8 +513,8 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
}) })
}) })
let signal = combineLatest(context.sharedContext.presentationData |> deliverOnMainQueue, context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings]) |> deliverOnMainQueue, availableAppIcons, currentAppIconName.get() |> deliverOnMainQueue) let signal = combineLatest(context.sharedContext.presentationData |> deliverOnMainQueue, context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings]) |> deliverOnMainQueue, availableAppIcons, currentAppIconName.get() |> deliverOnMainQueue, statePromise.get() |> deliverOnMainQueue)
|> map { presentationData, sharedData, availableAppIcons, currentAppIconName -> (ItemListControllerState, (ItemListNodeState<ThemeSettingsControllerEntry>, ThemeSettingsControllerEntry.ItemGenerationArguments)) in |> map { presentationData, sharedData, availableAppIcons, currentAppIconName, state -> (ItemListControllerState, (ItemListNodeState<ThemeSettingsControllerEntry>, ThemeSettingsControllerEntry.ItemGenerationArguments)) in
let theme: PresentationTheme let theme: PresentationTheme
let fontSize: PresentationFontSize let fontSize: PresentationFontSize
let wallpaper: TelegramWallpaper let wallpaper: TelegramWallpaper
@ -437,14 +529,20 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
case .dayClassic: case .dayClassic:
theme = defaultPresentationTheme theme = defaultPresentationTheme
case .nightGrayscale: case .nightGrayscale:
theme = defaultDarkPresentationTheme theme = makeDarkPresentationTheme(accentColor: settings.themeSpecificAccentColors[settings.theme.index]?.color ?? defaultDayAccentColor)
case .nightAccent: case .nightAccent:
theme = defaultDarkAccentPresentationTheme theme = makeDarkAccentPresentationTheme(accentColor: settings.themeSpecificAccentColors[settings.theme.index]?.color ?? defaultDayAccentColor)
case .day: case .day:
theme = makeDefaultDayPresentationTheme(accentColor: settings.themeSpecificAccentColors[settings.theme.index]?.color ?? defaultDayAccentColor, serviceBackgroundColor: defaultServiceBackgroundColor) theme = makeDefaultDayPresentationTheme(accentColor: settings.themeSpecificAccentColors[settings.theme.index]?.color ?? defaultDayAccentColor, serviceBackgroundColor: defaultServiceBackgroundColor)
} }
} }
wallpaper = settings.chatWallpaper
if let themeSpecificWallpaper = settings.themeSpecificChatWallpapers[settings.theme.index] {
wallpaper = themeSpecificWallpaper
} else {
wallpaper = settings.chatWallpaper
}
fontSize = settings.fontSize fontSize = settings.fontSize
dateTimeFormat = presentationData.dateTimeFormat dateTimeFormat = presentationData.dateTimeFormat
@ -452,7 +550,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
disableAnimations = settings.disableAnimations disableAnimations = settings.disableAnimations
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.Appearance_Title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back)) let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.Appearance_Title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back))
let listState = ItemListNodeState(entries: themeSettingsControllerEntries(presentationData: presentationData, theme: theme, themeReference: settings.theme, themeSpecificAccentColors: settings.themeSpecificAccentColors, autoNightSettings: settings.automaticThemeSwitchSetting, strings: presentationData.strings, wallpaper: wallpaper, fontSize: fontSize, dateTimeFormat: dateTimeFormat, largeEmoji: largeEmoji, disableAnimations: disableAnimations, availableAppIcons: availableAppIcons, currentAppIconName: currentAppIconName), style: .blocks, ensureVisibleItemTag: focusOnItemTag, animateChanges: false) let listState = ItemListNodeState(entries: themeSettingsControllerEntries(presentationData: presentationData, theme: theme, themeReference: settings.theme, themeSpecificAccentColors: settings.themeSpecificAccentColors, autoNightSettings: settings.automaticThemeSwitchSetting, strings: presentationData.strings, wallpaper: wallpaper, fontSize: fontSize, dateTimeFormat: dateTimeFormat, largeEmoji: largeEmoji, disableAnimations: disableAnimations, availableAppIcons: availableAppIcons, currentAppIconName: currentAppIconName, displayColorSlider: state.displayColorSlider), style: .blocks, ensureVisibleItemTag: focusOnItemTag, animateChanges: false)
return (controllerState, (listState, arguments)) return (controllerState, (listState, arguments))
} }

View File

@ -63,11 +63,23 @@ private func generateThemeIconImage(theme: PresentationThemeReference, accentCol
case .nightGrayscale: case .nightGrayscale:
background = UIColor(rgb: 0x000000) background = UIColor(rgb: 0x000000)
incomingBubble = UIColor(rgb: 0x1f1f1f) incomingBubble = UIColor(rgb: 0x1f1f1f)
outgoingBubble = UIColor(rgb: 0x313131) if let accentColorValue = accentColor {
let accentColor = UIColor(rgb: UInt32(bitPattern: accentColorValue))
outgoingBubble = accentColor
} else {
outgoingBubble = UIColor(rgb: 0x313131)
}
case .nightAccent: case .nightAccent:
background = UIColor(rgb: 0x18222d) if let accentColorValue = accentColor {
incomingBubble = UIColor(rgb: 0x32475e) let accentColor = UIColor(rgb: UInt32(bitPattern: accentColorValue))
outgoingBubble = UIColor(rgb: 0x3d6a97) background = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18)
incomingBubble = accentColor.withMultiplied(hue: 1.024, saturation: 0.585, brightness: 0.25)
outgoingBubble = accentColor.withMultiplied(hue: 1.019, saturation: 0.731, brightness: 0.59)
} else {
background = UIColor(rgb: 0x18222d)
incomingBubble = UIColor(rgb: 0x32475e)
outgoingBubble = UIColor(rgb: 0x3d6a97)
}
} }
context.setFillColor(background.cgColor) context.setFillColor(background.cgColor)
@ -97,16 +109,20 @@ class ThemeSettingsThemeItem: ListViewItem, ItemListItem {
let themes: [PresentationThemeReference] let themes: [PresentationThemeReference]
let themeSpecificAccentColors: [Int64: PresentationThemeAccentColor] let themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]
let currentTheme: PresentationThemeReference let currentTheme: PresentationThemeReference
let updated: (PresentationThemeReference) -> Void let updatedTheme: (PresentationThemeReference) -> Void
let currentColor: PresentationThemeAccentColor?
let updatedColor: (PresentationThemeAccentColor) -> Void
let tag: ItemListItemTag? let tag: ItemListItemTag?
init(theme: PresentationTheme, strings: PresentationStrings, sectionId: ItemListSectionId, themes: [PresentationThemeReference], themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], currentTheme: PresentationThemeReference, updated: @escaping (PresentationThemeReference) -> Void, tag: ItemListItemTag? = nil) { init(theme: PresentationTheme, strings: PresentationStrings, sectionId: ItemListSectionId, themes: [PresentationThemeReference], themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], currentTheme: PresentationThemeReference, updatedTheme: @escaping (PresentationThemeReference) -> Void, currentColor: PresentationThemeAccentColor?, updatedColor: @escaping (PresentationThemeAccentColor) -> Void, tag: ItemListItemTag? = nil) {
self.theme = theme self.theme = theme
self.strings = strings self.strings = strings
self.themes = themes self.themes = themes
self.themeSpecificAccentColors = themeSpecificAccentColors self.themeSpecificAccentColors = themeSpecificAccentColors
self.currentTheme = currentTheme self.currentTheme = currentTheme
self.updated = updated self.updatedTheme = updatedTheme
self.currentColor = currentColor
self.updatedColor = updatedColor
self.tag = tag self.tag = tag
self.sectionId = sectionId self.sectionId = sectionId
} }
@ -352,7 +368,7 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
if let name = name { if let name = name {
imageNode.setup(theme: item.theme, icon: generateThemeIconImage(theme: theme, accentColor: item.themeSpecificAccentColors[theme.index]?.color), title: NSAttributedString(string: name, font: textFont, textColor: selected ? item.theme.list.itemAccentColor : item.theme.list.itemPrimaryTextColor, paragraphAlignment: .center), bordered: true, selected: selected, action: { [weak self, weak imageNode] in imageNode.setup(theme: item.theme, icon: generateThemeIconImage(theme: theme, accentColor: item.themeSpecificAccentColors[theme.index]?.color), title: NSAttributedString(string: name, font: textFont, textColor: selected ? item.theme.list.itemAccentColor : item.theme.list.itemPrimaryTextColor, paragraphAlignment: .center), bordered: true, selected: selected, action: { [weak self, weak imageNode] in
item.updated(theme) item.updatedTheme(theme)
if let imageNode = imageNode { if let imageNode = imageNode {
self?.scrollToNode(imageNode, animated: true) self?.scrollToNode(imageNode, animated: true)
} }

View File

@ -380,7 +380,7 @@ class WallpaperGalleryController: ViewController {
let _ = (updatePresentationThemeSettingsInteractively(accountManager: strongSelf.context.sharedContext.accountManager, { current in let _ = (updatePresentationThemeSettingsInteractively(accountManager: strongSelf.context.sharedContext.accountManager, { current in
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
themeSpecificChatWallpapers[current.theme.index] = wallpaper themeSpecificChatWallpapers[current.theme.index] = wallpaper
return PresentationThemeSettings(chatWallpaper: wallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: wallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
}) |> deliverOnMainQueue).start(completed: { }) |> deliverOnMainQueue).start(completed: {
self?.dismiss(forceAway: true) self?.dismiss(forceAway: true)
}) })

View File

@ -139,7 +139,7 @@ final class WallpaperUploadManager {
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
themeSpecificChatWallpapers[current.theme.index] = updatedWallpaper themeSpecificChatWallpapers[current.theme.index] = updatedWallpaper
return PresentationThemeSettings(chatWallpaper: updatedWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations) return PresentationThemeSettings(chatWallpaper: updatedWallpaper, theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, themeTintColors: current.themeTintColors, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
})).start() })).start()
} }
} }

View File

@ -130,9 +130,9 @@ static inline int writeOggPage(ogg_page *page, TGDataItem *fileItem)
self = [super init]; self = [super init];
if (self != nil) if (self != nil)
{ {
bitrate = 20 * 1024; bitrate = 30 * 1024;
rate = 48000; rate = 48000;
coding_rate = 16000; coding_rate = 48000;
frame_size = 960; frame_size = 960;
with_cvbr = 1; with_cvbr = 1;
max_ogg_delay = 48000; max_ogg_delay = 48000;
@ -178,13 +178,13 @@ static inline int writeOggPage(ogg_page *page, TGDataItem *fileItem)
const char *opus_version = opus_get_version_string(); const char *opus_version = opus_get_version_string();
comment_init(&inopt.comments, &inopt.comments_length, opus_version); comment_init(&inopt.comments, &inopt.comments_length, opus_version);
bitrate = 16 * 1024; // bitrate = 16 * 1024;
inopt.rawmode = 1; // inopt.rawmode = 1;
inopt.ignorelength = 1; // inopt.ignorelength = 1;
inopt.samplesize = 16; // inopt.samplesize = 16;
inopt.rate = 16000; // inopt.rate = 16000;
inopt.channels = 1; // inopt.channels = 1;
rate = (opus_int32)inopt.rate; rate = (opus_int32)inopt.rate;
inopt.skip = 0; inopt.skip = 0;

View File

@ -254,6 +254,7 @@ public struct PresentationThemeSettings: PreferencesEntry {
public var theme: PresentationThemeReference public var theme: PresentationThemeReference
public var themeSpecificAccentColors: [Int64: PresentationThemeAccentColor] public var themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]
public var themeSpecificChatWallpapers: [Int64: TelegramWallpaper] public var themeSpecificChatWallpapers: [Int64: TelegramWallpaper]
public var themeTintColors: Bool
public var fontSize: PresentationFontSize public var fontSize: PresentationFontSize
public var automaticThemeSwitchSetting: AutomaticThemeSwitchSetting public var automaticThemeSwitchSetting: AutomaticThemeSwitchSetting
public var largeEmoji: Bool public var largeEmoji: Bool
@ -283,14 +284,15 @@ public struct PresentationThemeSettings: PreferencesEntry {
} }
public static var defaultSettings: PresentationThemeSettings { public static var defaultSettings: PresentationThemeSettings {
return PresentationThemeSettings(chatWallpaper: .builtin(WallpaperSettings()), theme: .builtin(.dayClassic), themeSpecificAccentColors: [:], themeSpecificChatWallpapers: [:], fontSize: .regular, automaticThemeSwitchSetting: AutomaticThemeSwitchSetting(trigger: .none, theme: .nightAccent), largeEmoji: true, disableAnimations: true) return PresentationThemeSettings(chatWallpaper: .builtin(WallpaperSettings()), theme: .builtin(.dayClassic), themeSpecificAccentColors: [:], themeSpecificChatWallpapers: [:], themeTintColors: false, fontSize: .regular, automaticThemeSwitchSetting: AutomaticThemeSwitchSetting(trigger: .none, theme: .nightAccent), largeEmoji: true, disableAnimations: true)
} }
public init(chatWallpaper: TelegramWallpaper, theme: PresentationThemeReference, themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], themeSpecificChatWallpapers: [Int64: TelegramWallpaper], fontSize: PresentationFontSize, automaticThemeSwitchSetting: AutomaticThemeSwitchSetting, largeEmoji: Bool, disableAnimations: Bool) { public init(chatWallpaper: TelegramWallpaper, theme: PresentationThemeReference, themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], themeSpecificChatWallpapers: [Int64: TelegramWallpaper], themeTintColors: Bool, fontSize: PresentationFontSize, automaticThemeSwitchSetting: AutomaticThemeSwitchSetting, largeEmoji: Bool, disableAnimations: Bool) {
self.chatWallpaper = chatWallpaper self.chatWallpaper = chatWallpaper
self.theme = theme self.theme = theme
self.themeSpecificAccentColors = themeSpecificAccentColors self.themeSpecificAccentColors = themeSpecificAccentColors
self.themeSpecificChatWallpapers = themeSpecificChatWallpapers self.themeSpecificChatWallpapers = themeSpecificChatWallpapers
self.themeTintColors = themeTintColors
self.fontSize = fontSize self.fontSize = fontSize
self.automaticThemeSwitchSetting = automaticThemeSwitchSetting self.automaticThemeSwitchSetting = automaticThemeSwitchSetting
self.largeEmoji = largeEmoji self.largeEmoji = largeEmoji
@ -338,6 +340,8 @@ public struct PresentationThemeSettings: PreferencesEntry {
self.themeSpecificAccentColors[PresentationThemeReference.builtin(.day).index] = PresentationThemeAccentColor(baseColor: baseColor, value: 0.5) self.themeSpecificAccentColors[PresentationThemeReference.builtin(.day).index] = PresentationThemeAccentColor(baseColor: baseColor, value: 0.5)
} }
self.themeTintColors = decoder.decodeBoolForKey("themeTintColors", orElse: false)
self.fontSize = PresentationFontSize(rawValue: decoder.decodeInt32ForKey("f", orElse: PresentationFontSize.regular.rawValue)) ?? .regular self.fontSize = PresentationFontSize(rawValue: decoder.decodeInt32ForKey("f", orElse: PresentationFontSize.regular.rawValue)) ?? .regular
self.automaticThemeSwitchSetting = (decoder.decodeObjectForKey("automaticThemeSwitchSetting", decoder: { AutomaticThemeSwitchSetting(decoder: $0) }) as? AutomaticThemeSwitchSetting) ?? AutomaticThemeSwitchSetting(trigger: .none, theme: .nightAccent) self.automaticThemeSwitchSetting = (decoder.decodeObjectForKey("automaticThemeSwitchSetting", decoder: { AutomaticThemeSwitchSetting(decoder: $0) }) as? AutomaticThemeSwitchSetting) ?? AutomaticThemeSwitchSetting(trigger: .none, theme: .nightAccent)
self.largeEmoji = decoder.decodeBoolForKey("largeEmoji", orElse: true) self.largeEmoji = decoder.decodeBoolForKey("largeEmoji", orElse: true)
@ -353,6 +357,7 @@ public struct PresentationThemeSettings: PreferencesEntry {
encoder.encodeObjectDictionary(self.themeSpecificChatWallpapers, forKey: "themeSpecificChatWallpapers", keyEncoder: { key, encoder in encoder.encodeObjectDictionary(self.themeSpecificChatWallpapers, forKey: "themeSpecificChatWallpapers", keyEncoder: { key, encoder in
encoder.encodeInt64(key, forKey: "k") encoder.encodeInt64(key, forKey: "k")
}) })
encoder.encodeBool(self.themeTintColors, forKey: "themeTintColors")
encoder.encodeInt32(self.fontSize.rawValue, forKey: "f") encoder.encodeInt32(self.fontSize.rawValue, forKey: "f")
encoder.encodeObject(self.automaticThemeSwitchSetting, forKey: "automaticThemeSwitchSetting") encoder.encodeObject(self.automaticThemeSwitchSetting, forKey: "automaticThemeSwitchSetting")
encoder.encodeBool(self.largeEmoji, forKey: "largeEmoji") encoder.encodeBool(self.largeEmoji, forKey: "largeEmoji")
@ -368,7 +373,7 @@ public struct PresentationThemeSettings: PreferencesEntry {
} }
public static func ==(lhs: PresentationThemeSettings, rhs: PresentationThemeSettings) -> Bool { public static func ==(lhs: PresentationThemeSettings, rhs: PresentationThemeSettings) -> Bool {
return lhs.chatWallpaper == rhs.chatWallpaper && lhs.theme == rhs.theme && lhs.themeSpecificAccentColors == rhs.themeSpecificAccentColors && lhs.themeSpecificChatWallpapers == rhs.themeSpecificChatWallpapers && lhs.fontSize == rhs.fontSize && lhs.automaticThemeSwitchSetting == rhs.automaticThemeSwitchSetting && lhs.largeEmoji == rhs.largeEmoji && lhs.disableAnimations == rhs.disableAnimations return lhs.chatWallpaper == rhs.chatWallpaper && lhs.theme == rhs.theme && lhs.themeSpecificAccentColors == rhs.themeSpecificAccentColors && lhs.themeSpecificChatWallpapers == rhs.themeSpecificChatWallpapers && lhs.themeTintColors == rhs.themeTintColors && lhs.fontSize == rhs.fontSize && lhs.automaticThemeSwitchSetting == rhs.automaticThemeSwitchSetting && lhs.largeEmoji == rhs.largeEmoji && lhs.disableAnimations == rhs.disableAnimations
} }
} }