mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-07 08:01:10 +00:00
Merge commit 'c85d0b21c7616e3057c15690f2c1896e8592037e'
This commit is contained in:
commit
321bedf047
@ -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.";
|
||||
"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.";
|
||||
|
||||
"Appearance.TintAllColors" = "Tint All Colors";
|
||||
|
||||
"Contacts.DeselectAll" = "Deselect All";
|
||||
|
@ -4,6 +4,34 @@ set -e
|
||||
|
||||
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
|
||||
cleanup-telegram-build-vms.sh
|
||||
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"
|
||||
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="$$"
|
||||
VM_NAME="$VM_BASE_NAME-$(openssl rand -hex 10)-build-telegram-$PROCESS_ID"
|
||||
|
||||
prlctl clone "$VM_BASE_NAME" --name "$VM_NAME"
|
||||
prlctl snapshot-switch "$VM_NAME" -i "$SNAPSHOT_ID"
|
||||
if [ "$BUILD_MACHINE" == "linux" ]; then
|
||||
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
|
||||
|
||||
@ -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"
|
||||
fi
|
||||
|
||||
prlctl stop "$VM_NAME" --kill
|
||||
prlctl delete "$VM_NAME"
|
||||
if [ "$BUILD_MACHINE" == "linux" ]; then
|
||||
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
|
||||
|
@ -115,6 +115,16 @@ public extension UIColor {
|
||||
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 {
|
||||
let alpha = min(1.0, max(0.0, alpha))
|
||||
let oneMinusAlpha = 1.0 - alpha
|
||||
|
@ -1,350 +1,379 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
private let accentColor: UIColor = UIColor(rgb: 0x2EA6FF)
|
||||
private let destructiveColor: UIColor = UIColor(rgb: 0xFF6767)
|
||||
private let constructiveColor: UIColor = UIColor(rgb: 0x08a723)
|
||||
private let secretColor: UIColor = UIColor(rgb: 0x89DF9E)
|
||||
private func makeDarkPresentationTheme(accentColor: UIColor) -> PresentationTheme {
|
||||
let destructiveColor: UIColor = UIColor(rgb: 0xFF6767)
|
||||
let constructiveColor: UIColor = UIColor(rgb: 0x08a723)
|
||||
let secretColor: UIColor = UIColor(rgb: 0x89DF9E)
|
||||
|
||||
private let rootStatusBar = PresentationThemeRootNavigationStatusBar(
|
||||
style: .white
|
||||
)
|
||||
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)
|
||||
|
||||
private let rootTabBar = PresentationThemeRootTabBar(
|
||||
backgroundColor: UIColor(rgb: 0x213040),
|
||||
separatorColor: UIColor(rgb: 0x131A23),
|
||||
iconColor: UIColor(rgb: 0x7e929f),
|
||||
selectedIconColor: accentColor,
|
||||
textColor: UIColor(rgb: 0x7e929f),
|
||||
selectedTextColor: accentColor,
|
||||
badgeBackgroundColor: UIColor(rgb: 0xEF5B5B),
|
||||
badgeStrokeColor: UIColor(rgb: 0xEF5B5B),
|
||||
badgeTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
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)
|
||||
|
||||
private let rootNavigationBar = PresentationThemeRootNavigationBar(
|
||||
buttonColor: accentColor,
|
||||
disabledButtonColor: UIColor(rgb: 0x5b646f),
|
||||
primaryTextColor: UIColor(rgb: 0xffffff),
|
||||
secondaryTextColor: UIColor(rgb: 0x8B9197),
|
||||
controlColor: UIColor(rgb: 0x8B9197),
|
||||
accentTextColor: accentColor,
|
||||
backgroundColor: UIColor(rgb: 0x213040),
|
||||
separatorColor: UIColor(rgb: 0x131A23),
|
||||
badgeBackgroundColor: UIColor(rgb: 0xEF5B5B),
|
||||
badgeStrokeColor: UIColor(rgb: 0xEF5B5B),
|
||||
badgeTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
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)
|
||||
|
||||
private let activeNavigationSearchBar = PresentationThemeActiveNavigationSearchBar(
|
||||
backgroundColor: UIColor(rgb: 0x213040),
|
||||
accentColor: accentColor,
|
||||
inputFillColor: UIColor(rgb: 0x182330),
|
||||
inputTextColor: UIColor(rgb: 0xffffff),
|
||||
inputPlaceholderTextColor: UIColor(rgb: 0x8B9197),
|
||||
inputIconColor: UIColor(rgb: 0x8B9197),
|
||||
inputClearButtonColor: UIColor(rgb: 0x8B9197),
|
||||
separatorColor: UIColor(rgb: 0x18222C)
|
||||
)
|
||||
let mainFreeTextColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.097, brightness: 0.56)
|
||||
|
||||
private let auth = PresentationThemeAuth(
|
||||
introStartButton: accentColor,
|
||||
introDotColor: UIColor(rgb: 0x8B9197)
|
||||
)
|
||||
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)
|
||||
|
||||
private let passcode = PresentationThemePasscode(
|
||||
backgroundColors: (UIColor(rgb: 0x1d2937), UIColor(rgb: 0x18222d)),
|
||||
buttonColor: UIColor(rgb: 0x213040)
|
||||
//backgroundColors: (UIColor(rgb: 0x263646), UIColor(rgb: 0x213040)),
|
||||
//buttonColor: UIColor(rgb: 0x7e93a0)
|
||||
)
|
||||
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)
|
||||
|
||||
private let rootController = PresentationThemeRootController(
|
||||
statusBar: rootStatusBar,
|
||||
tabBar: rootTabBar,
|
||||
navigationBar: rootNavigationBar,
|
||||
activeNavigationSearchBar: activeNavigationSearchBar
|
||||
)
|
||||
let rootStatusBar = PresentationThemeRootNavigationStatusBar(
|
||||
style: .white
|
||||
)
|
||||
|
||||
private let switchColors = PresentationThemeSwitch(
|
||||
frameColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
handleColor: UIColor(rgb: 0x121212),
|
||||
contentColor: accentColor,
|
||||
positiveColor: accentColor,
|
||||
negativeColor: destructiveColor
|
||||
)
|
||||
let rootTabBar = PresentationThemeRootTabBar(
|
||||
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 list = PresentationThemeList(
|
||||
blocksBackgroundColor: UIColor(rgb: 0x18222D),
|
||||
plainBackgroundColor: UIColor(rgb: 0x18222D),
|
||||
itemPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
itemSecondaryTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
itemDisabledTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), //!!!
|
||||
itemAccentColor: accentColor,
|
||||
itemHighlightedColor: UIColor(rgb: 0x28b772),
|
||||
itemDestructiveColor: destructiveColor,
|
||||
itemPlaceholderTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), //!!!
|
||||
itemBlocksBackgroundColor: UIColor(rgb: 0x213040),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x10171F),
|
||||
itemBlocksSeparatorColor: UIColor(rgb: 0x131A23),
|
||||
itemPlainSeparatorColor: UIColor(rgb: 0x131A23),
|
||||
disclosureArrowColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), //!!!
|
||||
sectionHeaderTextColor: UIColor(rgb: 0x82888E),
|
||||
freeTextColor: UIColor(rgb: 0x82888E),
|
||||
freeTextErrorColor: destructiveColor, //!!!
|
||||
freeTextSuccessColor: UIColor(rgb: 0x30cf30), //!!!
|
||||
freeMonoIcon: UIColor(rgb: 0x82888E),
|
||||
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: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
fillColor: accentColor,
|
||||
foregroundColor: .white
|
||||
),
|
||||
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)
|
||||
)
|
||||
let rootNavigationBar = PresentationThemeRootNavigationBar(
|
||||
buttonColor: accentColor,
|
||||
disabledButtonColor: accentColor.withMultiplied(hue: 1.033, saturation: 0.219, brightness: 0.44),
|
||||
primaryTextColor: UIColor(rgb: 0xffffff),
|
||||
secondaryTextColor: mainSecondaryColor,
|
||||
controlColor: mainSecondaryColor,
|
||||
accentTextColor: accentColor,
|
||||
backgroundColor: mainBackgroundColor,
|
||||
separatorColor: mainSeparatorColor,
|
||||
badgeBackgroundColor: UIColor(rgb: 0xEF5B5B),
|
||||
badgeStrokeColor: UIColor(rgb: 0xEF5B5B),
|
||||
badgeTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
|
||||
private let chatList = PresentationThemeChatList(
|
||||
backgroundColor: UIColor(rgb: 0x18222D),
|
||||
itemSeparatorColor: UIColor(rgb: 0x131A23),
|
||||
itemBackgroundColor: UIColor(rgb: 0x18222D),
|
||||
pinnedItemBackgroundColor: UIColor(rgb: 0x213040),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x10171F),
|
||||
itemSelectedBackgroundColor: UIColor(rgb: 0x10171F),
|
||||
titleColor: UIColor(rgb: 0xffffff),
|
||||
secretTitleColor: secretColor,
|
||||
dateTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
authorNameColor: UIColor(rgb: 0xffffff),
|
||||
messageTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
messageDraftTextColor: UIColor(rgb: 0xdd4b39), //!!!
|
||||
checkmarkColor: accentColor,
|
||||
pendingIndicatorColor: UIColor(rgb: 0x8E8E93),
|
||||
failedFillColor: destructiveColor,
|
||||
failedForegroundColor: .white,
|
||||
muteIconColor: UIColor(rgb: 0x8E8E93),
|
||||
unreadBadgeActiveBackgroundColor: accentColor,
|
||||
unreadBadgeActiveTextColor: UIColor(rgb: 0xffffff),
|
||||
unreadBadgeInactiveBackgroundColor: UIColor(rgb: 0xDBF5FF, alpha: 0.4),
|
||||
unreadBadgeInactiveTextColor: UIColor(rgb: 0x000000),
|
||||
pinnedBadgeColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
pinnedSearchBarColor: UIColor(rgb: 0x182330),
|
||||
regularSearchBarColor: UIColor(rgb: 0x0F161E),
|
||||
sectionHeaderFillColor: UIColor(rgb: 0x213040),
|
||||
sectionHeaderTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
searchBarKeyboardColor: .dark,
|
||||
verifiedIconFillColor: accentColor,
|
||||
verifiedIconForegroundColor: .white,
|
||||
secretIconColor: secretColor,
|
||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x72d5fd), UIColor(rgb: 0x2a9ef1)), foregroundColor: .white),
|
||||
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x5d6d77), UIColor(rgb: 0x4e5c64)), foregroundColor: UIColor(rgb: 0x18222d)),
|
||||
onlineDotColor: UIColor(rgb: 0x4cc91f)
|
||||
)
|
||||
let activeNavigationSearchBar = PresentationThemeActiveNavigationSearchBar(
|
||||
backgroundColor: mainBackgroundColor,
|
||||
accentColor: accentColor,
|
||||
inputFillColor: mainInputColor,
|
||||
inputTextColor: UIColor(rgb: 0xffffff),
|
||||
inputPlaceholderTextColor: mainSecondaryColor,
|
||||
inputIconColor: mainSecondaryColor,
|
||||
inputClearButtonColor: mainSecondaryColor,
|
||||
separatorColor: additionalBackgroundColor
|
||||
)
|
||||
|
||||
private let bubble = PresentationThemeChatBubble(
|
||||
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))),
|
||||
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))),
|
||||
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))),
|
||||
incomingPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
incomingSecondaryTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
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))
|
||||
)
|
||||
let auth = PresentationThemeAuth(
|
||||
introStartButton: accentColor,
|
||||
introDotColor: mainSecondaryColor
|
||||
)
|
||||
|
||||
private let serviceMessage = PresentationThemeServiceMessage(
|
||||
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))),
|
||||
unreadBarFillColor: UIColor(rgb: 0x213040),
|
||||
unreadBarStrokeColor: UIColor(rgb: 0x213040),
|
||||
unreadBarTextColor: UIColor(rgb: 0xffffff),
|
||||
dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff))
|
||||
)
|
||||
let passcode = PresentationThemePasscode(
|
||||
backgroundColors: (accentColor.withMultiplied(hue: 1.049, saturation: 0.573, brightness: 0.47), additionalBackgroundColor),
|
||||
buttonColor: mainBackgroundColor
|
||||
)
|
||||
|
||||
private let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
||||
buttonColor: accentColor,
|
||||
micLevelColor: accentColor.withAlphaComponent(0.2),
|
||||
activeIconColor: .white,
|
||||
panelControlFillColor: UIColor(rgb: 0x213040),
|
||||
panelControlStrokeColor: UIColor(rgb: 0x213040),
|
||||
panelControlContentPrimaryColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5), //!!!
|
||||
panelControlContentAccentColor: accentColor
|
||||
)
|
||||
let rootController = PresentationThemeRootController(
|
||||
statusBar: rootStatusBar,
|
||||
tabBar: rootTabBar,
|
||||
navigationBar: rootNavigationBar,
|
||||
activeNavigationSearchBar: activeNavigationSearchBar
|
||||
)
|
||||
|
||||
private let inputPanel = PresentationThemeChatInputPanel(
|
||||
panelBackgroundColor: UIColor(rgb: 0x213040),
|
||||
panelStrokeColor: UIColor(rgb: 0x131A23),
|
||||
panelControlAccentColor: accentColor,
|
||||
panelControlColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
panelControlDisabledColor: UIColor(rgb: 0x90979F, alpha: 0.5), //!!!
|
||||
panelControlDestructiveColor: destructiveColor,
|
||||
inputBackgroundColor: UIColor(rgb: 0x131C26),
|
||||
inputStrokeColor: UIColor(rgb: 0x131C26),
|
||||
inputPlaceholderColor: UIColor(rgb: 0xDBF5FF, alpha: 0.4),
|
||||
inputTextColor: UIColor(rgb: 0xffffff),
|
||||
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
|
||||
)
|
||||
let switchColors = PresentationThemeSwitch(
|
||||
frameColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
handleColor: UIColor(rgb: 0x121212),
|
||||
contentColor: accentColor,
|
||||
positiveColor: accentColor,
|
||||
negativeColor: destructiveColor
|
||||
)
|
||||
|
||||
private let inputMediaPanel = PresentationThemeInputMediaPanel(
|
||||
panelSeparatorColor: UIColor(rgb: 0x213040),
|
||||
panelIconColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
panelHighlightedIconBackgroundColor: UIColor(rgb: 0x131C26), //!!!
|
||||
stickersBackgroundColor: UIColor(rgb: 0x18222d),
|
||||
stickersSectionTextColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
stickersSearchBackgroundColor: UIColor(rgb: 0x121c25),
|
||||
stickersSearchPlaceholderColor: UIColor(rgb: 0x788a96),
|
||||
stickersSearchPrimaryColor: .white,
|
||||
stickersSearchControlColor: UIColor(rgb: 0x788a96),
|
||||
gifsBackgroundColor: UIColor(rgb: 0x18222d)
|
||||
)
|
||||
let list = PresentationThemeList(
|
||||
blocksBackgroundColor: additionalBackgroundColor,
|
||||
plainBackgroundColor: additionalBackgroundColor,
|
||||
itemPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
itemSecondaryTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
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 inputButtonPanel = PresentationThemeInputButtonPanel(
|
||||
panelSeparatorColor: UIColor(rgb: 0x213040),
|
||||
panelBackgroundColor: UIColor(rgb: 0x161A20),
|
||||
buttonFillColor: UIColor(rgb: 0x5B5F62),
|
||||
buttonStrokeColor: UIColor(rgb: 0x0D1013),
|
||||
buttonHighlightedFillColor: UIColor(rgb: 0x5B5F62, alpha: 0.7),
|
||||
buttonHighlightedStrokeColor: UIColor(rgb: 0x0D1013),
|
||||
buttonTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
let chatList = PresentationThemeChatList(
|
||||
backgroundColor: additionalBackgroundColor,
|
||||
itemSeparatorColor: mainSeparatorColor,
|
||||
itemBackgroundColor: additionalBackgroundColor,
|
||||
pinnedItemBackgroundColor: mainBackgroundColor,
|
||||
itemHighlightedBackgroundColor: mainSelectionColor,
|
||||
itemSelectedBackgroundColor: mainSelectionColor,
|
||||
titleColor: UIColor(rgb: 0xffffff),
|
||||
secretTitleColor: secretColor,
|
||||
dateTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
authorNameColor: UIColor(rgb: 0xffffff),
|
||||
messageTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
messageDraftTextColor: UIColor(rgb: 0xdd4b39),
|
||||
checkmarkColor: accentColor,
|
||||
pendingIndicatorColor: mainSecondaryTextColor.withAlphaComponent(0.4),
|
||||
failedFillColor: destructiveColor,
|
||||
failedForegroundColor: .white,
|
||||
muteIconColor: mainSecondaryTextColor.withAlphaComponent(0.4),
|
||||
unreadBadgeActiveBackgroundColor: accentColor,
|
||||
unreadBadgeActiveTextColor: UIColor(rgb: 0xffffff),
|
||||
unreadBadgeInactiveBackgroundColor: mainSecondaryTextColor.withAlphaComponent(0.4),
|
||||
unreadBadgeInactiveTextColor: additionalBackgroundColor,
|
||||
pinnedBadgeColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
pinnedSearchBarColor: mainInputColor,
|
||||
regularSearchBarColor: accentColor.withMultiplied(hue: 1.029, saturation: 0.609, brightness: 0.12),
|
||||
sectionHeaderFillColor: mainBackgroundColor,
|
||||
sectionHeaderTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
searchBarKeyboardColor: .dark,
|
||||
verifiedIconFillColor: accentColor,
|
||||
verifiedIconForegroundColor: .white,
|
||||
secretIconColor: secretColor,
|
||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x72d5fd), UIColor(rgb: 0x2a9ef1)), foregroundColor: .white),
|
||||
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x5d6d77), UIColor(rgb: 0x4e5c64)), foregroundColor: additionalBackgroundColor),
|
||||
onlineDotColor: UIColor(rgb: 0x4cc91f)
|
||||
)
|
||||
|
||||
private let historyNavigation = PresentationThemeChatHistoryNavigation(
|
||||
fillColor: UIColor(rgb: 0x213040),
|
||||
strokeColor: UIColor(rgb: 0x131A23),
|
||||
foregroundColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||
badgeBackgroundColor: accentColor,
|
||||
badgeStrokeColor: accentColor,
|
||||
badgeTextColor: .white
|
||||
)
|
||||
let bubble = PresentationThemeChatBubble(
|
||||
incoming: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: mainBackgroundColor, highlightedFill: highlightedIncomingBubbleColor, stroke: mainBackgroundColor), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: mainBackgroundColor, highlightedFill: highlightedIncomingBubbleColor, stroke: mainBackgroundColor)),
|
||||
outgoing: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: outgoingBubbleColor, highlightedFill: highlightedOutgoingBubbleColor, stroke: outgoingBubbleColor), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: outgoingBubbleColor, highlightedFill: highlightedOutgoingBubbleColor, stroke: outgoingBubbleColor)),
|
||||
freeform: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: mainBackgroundColor, highlightedFill: highlightedIncomingBubbleColor, stroke: mainBackgroundColor), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: mainBackgroundColor, highlightedFill: highlightedIncomingBubbleColor, stroke: mainBackgroundColor)),
|
||||
incomingPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
incomingSecondaryTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
incomingLinkTextColor: accentColor,
|
||||
incomingLinkHighlightColor: accentColor.withAlphaComponent(0.5),
|
||||
incomingScamColor: destructiveColor,
|
||||
outgoingPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
outgoingSecondaryTextColor: mainSecondaryTextColor.withAlphaComponent(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: accentColor.withMultiplied(hue: 0.99, saturation: 0.743, brightness: 1.0),
|
||||
incomingPendingActivityColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
outgoingPendingActivityColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
mediaDateAndStatusFillColor: UIColor(white: 0.0, alpha: 0.5),
|
||||
mediaDateAndStatusTextColor: .white,
|
||||
incomingFileTitleColor: UIColor(rgb: 0xffffff),
|
||||
outgoingFileTitleColor: UIColor(rgb: 0xffffff),
|
||||
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 chat = PresentationThemeChat(
|
||||
bubble: bubble,
|
||||
serviceMessage: serviceMessage,
|
||||
inputPanel: inputPanel,
|
||||
inputMediaPanel: inputMediaPanel,
|
||||
inputButtonPanel: inputButtonPanel,
|
||||
historyNavigation: historyNavigation
|
||||
)
|
||||
let serviceMessage = PresentationThemeServiceMessage(
|
||||
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))),
|
||||
unreadBarFillColor: mainBackgroundColor,
|
||||
unreadBarStrokeColor: mainBackgroundColor,
|
||||
unreadBarTextColor: UIColor(rgb: 0xffffff),
|
||||
dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff))
|
||||
)
|
||||
|
||||
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
|
||||
)
|
||||
let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
||||
buttonColor: accentColor,
|
||||
micLevelColor: accentColor.withAlphaComponent(0.2),
|
||||
activeIconColor: .white,
|
||||
panelControlFillColor: mainBackgroundColor,
|
||||
panelControlStrokeColor: mainBackgroundColor,
|
||||
panelControlContentPrimaryColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
panelControlContentAccentColor: accentColor
|
||||
)
|
||||
|
||||
private let inAppNotification = PresentationThemeInAppNotification(
|
||||
fillColor: UIColor(rgb: 0x213040),
|
||||
primaryTextColor: .white,
|
||||
expandedNotification: PresentationThemeExpandedNotification(
|
||||
let inputPanel = PresentationThemeChatInputPanel(
|
||||
panelBackgroundColor: mainBackgroundColor,
|
||||
panelStrokeColor: mainSeparatorColor,
|
||||
panelControlAccentColor: accentColor,
|
||||
panelControlColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
panelControlDisabledColor: UIColor(rgb: 0x90979F, alpha: 0.5),
|
||||
panelControlDestructiveColor: destructiveColor,
|
||||
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
|
||||
)
|
||||
|
||||
let inputMediaPanel = PresentationThemeInputMediaPanel(
|
||||
panelSeparatorColor: mainBackgroundColor,
|
||||
panelIconColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
panelHighlightedIconBackgroundColor: inputBackgroundColor,
|
||||
stickersBackgroundColor: additionalBackgroundColor,
|
||||
stickersSectionTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
stickersSearchBackgroundColor: UIColor(rgb: 0x121c25),
|
||||
stickersSearchPlaceholderColor: UIColor(rgb: 0x788a96),
|
||||
stickersSearchPrimaryColor: .white,
|
||||
stickersSearchControlColor: UIColor(rgb: 0x788a96),
|
||||
gifsBackgroundColor: additionalBackgroundColor
|
||||
)
|
||||
|
||||
let inputButtonPanel = PresentationThemeInputButtonPanel(
|
||||
panelSeparatorColor: mainBackgroundColor,
|
||||
panelBackgroundColor: UIColor(rgb: 0x161A20),
|
||||
buttonFillColor: UIColor(rgb: 0x5B5F62),
|
||||
buttonStrokeColor: UIColor(rgb: 0x0D1013),
|
||||
buttonHighlightedFillColor: UIColor(rgb: 0x5B5F62, alpha: 0.7),
|
||||
buttonHighlightedStrokeColor: UIColor(rgb: 0x0D1013),
|
||||
buttonTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
|
||||
let historyNavigation = PresentationThemeChatHistoryNavigation(
|
||||
fillColor: mainBackgroundColor,
|
||||
strokeColor: mainSeparatorColor,
|
||||
foregroundColor: mainSecondaryTextColor.withAlphaComponent(0.5),
|
||||
badgeBackgroundColor: accentColor,
|
||||
badgeStrokeColor: accentColor,
|
||||
badgeTextColor: .white
|
||||
)
|
||||
|
||||
let chat = PresentationThemeChat(
|
||||
bubble: bubble,
|
||||
serviceMessage: serviceMessage,
|
||||
inputPanel: inputPanel,
|
||||
inputMediaPanel: inputMediaPanel,
|
||||
inputButtonPanel: inputButtonPanel,
|
||||
historyNavigation: historyNavigation
|
||||
)
|
||||
|
||||
let actionSheet = PresentationThemeActionSheet(
|
||||
dimColor: UIColor(white: 0.0, alpha: 0.5),
|
||||
backgroundType: .dark,
|
||||
navigationBar: PresentationThemeExpandedNotificationNavigationBar(
|
||||
backgroundColor: UIColor(rgb: 0x213040),
|
||||
primaryTextColor: UIColor(rgb: 0xffffff),
|
||||
controlColor: accentColor,
|
||||
separatorColor: UIColor(rgb: 0x131A23)
|
||||
opaqueItemBackgroundColor: mainBackgroundColor,
|
||||
itemBackgroundColor: mainBackgroundColor.withAlphaComponent(0.8),
|
||||
opaqueItemHighlightedBackgroundColor: mainSelectionColor,
|
||||
itemHighlightedBackgroundColor: mainSelectionColor.withAlphaComponent(0.2),
|
||||
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(
|
||||
name: .builtin(.nightAccent),
|
||||
overallDarkAppearance: true,
|
||||
allowsCustomWallpapers: false,
|
||||
auth: auth,
|
||||
passcode: passcode,
|
||||
rootController: rootController,
|
||||
list: list,
|
||||
chatList: chatList,
|
||||
chat: chat,
|
||||
actionSheet: actionSheet,
|
||||
inAppNotification: inAppNotification
|
||||
)
|
||||
return PresentationTheme(
|
||||
name: .builtin(.nightAccent),
|
||||
overallDarkAppearance: true,
|
||||
auth: auth,
|
||||
passcode: passcode,
|
||||
rootController: rootController,
|
||||
list: list,
|
||||
chatList: chatList,
|
||||
chat: chat,
|
||||
actionSheet: actionSheet,
|
||||
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)
|
||||
}
|
||||
|
@ -1,348 +1,363 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
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 accentColor: UIColor = UIColor(rgb: 0xffffff)
|
||||
|
||||
private let rootStatusBar = PresentationThemeRootNavigationStatusBar(
|
||||
style: .white
|
||||
)
|
||||
private func makeDarkPresentationTheme(accentColor: UIColor) -> PresentationTheme {
|
||||
let destructiveColor: UIColor = UIColor(rgb: 0xeb5545)
|
||||
let constructiveColor: UIColor = UIColor(rgb: 0x08a723)
|
||||
let secretColor: UIColor = UIColor(rgb: 0x00B12C)
|
||||
|
||||
private let rootTabBar = PresentationThemeRootTabBar(
|
||||
backgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
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)
|
||||
)
|
||||
let rootStatusBar = PresentationThemeRootNavigationStatusBar(
|
||||
style: .white
|
||||
)
|
||||
|
||||
private let rootNavigationBar = PresentationThemeRootNavigationBar(
|
||||
buttonColor: accentColor,
|
||||
disabledButtonColor: UIColor(rgb: 0x525252),
|
||||
primaryTextColor: accentColor,
|
||||
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
||||
controlColor: UIColor(rgb: 0x767677),
|
||||
accentTextColor: accentColor,
|
||||
backgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
separatorColor: UIColor(rgb: 0x000000),
|
||||
badgeBackgroundColor: UIColor(rgb: 0xffffff),
|
||||
badgeStrokeColor: UIColor(rgb: 0x1c1c1d),
|
||||
badgeTextColor: UIColor(rgb: 0x1c1c1d)
|
||||
)
|
||||
let rootTabBar = PresentationThemeRootTabBar(
|
||||
backgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
separatorColor: UIColor(rgb: 0x3d3d40),
|
||||
iconColor: UIColor(rgb: 0x828282),
|
||||
selectedIconColor: accentColor,
|
||||
textColor: UIColor(rgb: 0x828282),
|
||||
selectedTextColor: accentColor,
|
||||
badgeBackgroundColor: UIColor(rgb: 0xeb5545),
|
||||
badgeStrokeColor: UIColor(rgb: 0x1c1c1d),
|
||||
badgeTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
|
||||
private let activeNavigationSearchBar = PresentationThemeActiveNavigationSearchBar(
|
||||
backgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
accentColor: accentColor,
|
||||
inputFillColor: UIColor(rgb: 0x272728),
|
||||
inputTextColor: accentColor,
|
||||
inputPlaceholderTextColor: UIColor(rgb: 0x5e5e5e),
|
||||
inputIconColor: UIColor(rgb: 0x5e5e5e),
|
||||
inputClearButtonColor: UIColor(rgb: 0x5e5e5e),
|
||||
separatorColor: UIColor(rgb: 0x000000)
|
||||
)
|
||||
let rootNavigationBar = PresentationThemeRootNavigationBar(
|
||||
buttonColor: accentColor,
|
||||
disabledButtonColor: UIColor(rgb: 0x525252),
|
||||
primaryTextColor: .white,
|
||||
secondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
||||
controlColor: UIColor(rgb: 0x767676),
|
||||
accentTextColor: accentColor,
|
||||
backgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
separatorColor: UIColor(rgb: 0x3d3d40),
|
||||
badgeBackgroundColor: UIColor(rgb: 0xeb5545),
|
||||
badgeStrokeColor: UIColor(rgb: 0x1c1c1d),
|
||||
badgeTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
|
||||
private let auth = PresentationThemeAuth(
|
||||
introStartButton: accentColor,
|
||||
introDotColor: UIColor(rgb: 0x5e5e5e)
|
||||
)
|
||||
let activeNavigationSearchBar = PresentationThemeActiveNavigationSearchBar(
|
||||
backgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
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(
|
||||
backgroundColors: (UIColor(rgb: 0x000000), UIColor(rgb: 0x000000)),
|
||||
buttonColor: UIColor(rgb: 0x1c1c1d)
|
||||
)
|
||||
let auth = PresentationThemeAuth(
|
||||
introStartButton: accentColor,
|
||||
introDotColor: UIColor(rgb: 0x5e5e5e)
|
||||
)
|
||||
|
||||
private let rootController = PresentationThemeRootController(
|
||||
statusBar: rootStatusBar,
|
||||
tabBar: rootTabBar,
|
||||
navigationBar: rootNavigationBar,
|
||||
activeNavigationSearchBar: activeNavigationSearchBar
|
||||
)
|
||||
let passcode = PresentationThemePasscode(
|
||||
backgroundColors: (UIColor(rgb: 0x000000), UIColor(rgb: 0x000000)),
|
||||
buttonColor: UIColor(rgb: 0x1c1c1d)
|
||||
)
|
||||
|
||||
private let switchColors = PresentationThemeSwitch(
|
||||
frameColor: UIColor(rgb: 0x545454),
|
||||
handleColor: UIColor(rgb: 0x121212),
|
||||
contentColor: UIColor(rgb: 0xb2b2b2),
|
||||
positiveColor: UIColor(rgb: 0x000000),
|
||||
negativeColor: destructiveColor
|
||||
)
|
||||
let rootController = PresentationThemeRootController(
|
||||
statusBar: rootStatusBar,
|
||||
tabBar: rootTabBar,
|
||||
navigationBar: rootNavigationBar,
|
||||
activeNavigationSearchBar: activeNavigationSearchBar
|
||||
)
|
||||
|
||||
private let list = PresentationThemeList(
|
||||
blocksBackgroundColor: UIColor(rgb: 0x000000),
|
||||
plainBackgroundColor: UIColor(rgb: 0x000000),
|
||||
itemPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
itemSecondaryTextColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
||||
itemDisabledTextColor: UIColor(rgb: 0x4d4d4d), //!!!
|
||||
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)
|
||||
)
|
||||
let switchColors = PresentationThemeSwitch(
|
||||
frameColor: UIColor(rgb: 0x5a5a5e),
|
||||
handleColor: UIColor(rgb: 0x121212),
|
||||
contentColor: UIColor(rgb: 0xb2b2b2),
|
||||
positiveColor: UIColor(rgb: 0x000000),
|
||||
negativeColor: destructiveColor
|
||||
)
|
||||
|
||||
private let chatList = PresentationThemeChatList(
|
||||
backgroundColor: UIColor(rgb: 0x000000),
|
||||
itemSeparatorColor: UIColor(rgb: 0x252525),
|
||||
itemBackgroundColor: UIColor(rgb: 0x000000),
|
||||
pinnedItemBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x191919),
|
||||
itemSelectedBackgroundColor: UIColor(rgb: 0x191919),
|
||||
titleColor: UIColor(rgb: 0xffffff),
|
||||
secretTitleColor: secretColor, //!!!
|
||||
dateTextColor: UIColor(rgb: 0x8e8e93),
|
||||
authorNameColor: UIColor(rgb: 0xffffff),
|
||||
messageTextColor: UIColor(rgb: 0x8e8e93),
|
||||
messageDraftTextColor: UIColor(rgb: 0xdd4b39), //!!!
|
||||
checkmarkColor: UIColor(rgb: 0xffffff),
|
||||
pendingIndicatorColor: UIColor(rgb: 0xffffff), //!!!
|
||||
failedFillColor: destructiveColor,
|
||||
failedForegroundColor: .white,
|
||||
muteIconColor: UIColor(rgb: 0x8e8e93), //!!!
|
||||
unreadBadgeActiveBackgroundColor: UIColor(rgb: 0xffffff),
|
||||
unreadBadgeActiveTextColor: UIColor(rgb: 0x000000),
|
||||
unreadBadgeInactiveBackgroundColor: UIColor(rgb: 0x666666),
|
||||
unreadBadgeInactiveTextColor:UIColor(rgb: 0x000000),
|
||||
pinnedBadgeColor: UIColor(rgb: 0x767677),
|
||||
pinnedSearchBarColor: UIColor(rgb: 0x272728),
|
||||
regularSearchBarColor: UIColor(rgb: 0x272728), //!!!
|
||||
sectionHeaderFillColor: UIColor(rgb: 0x1C1C1D),
|
||||
sectionHeaderTextColor: UIColor(rgb: 0xffffff),
|
||||
searchBarKeyboardColor: .dark,
|
||||
verifiedIconFillColor: accentColor,
|
||||
verifiedIconForegroundColor: .white,
|
||||
secretIconColor: secretColor,
|
||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x72d5fd), UIColor(rgb: 0x2a9ef1)), foregroundColor: .white),
|
||||
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x666666), UIColor(rgb: 0x666666)), foregroundColor: .black),
|
||||
onlineDotColor: UIColor(rgb: 0x4cc91f)
|
||||
)
|
||||
let list = PresentationThemeList(
|
||||
blocksBackgroundColor: UIColor(rgb: 0x000000),
|
||||
plainBackgroundColor: UIColor(rgb: 0x000000),
|
||||
itemPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
itemSecondaryTextColor: UIColor(rgb: 0x8f8f8f),
|
||||
itemDisabledTextColor: UIColor(rgb: 0x4d4d4d),
|
||||
itemAccentColor: accentColor,
|
||||
itemHighlightedColor: UIColor(rgb: 0x28b772),
|
||||
itemDestructiveColor: destructiveColor,
|
||||
itemPlaceholderTextColor: UIColor(rgb: 0x4d4d4d),
|
||||
itemBlocksBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x313135),
|
||||
itemBlocksSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
itemPlainSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
disclosureArrowColor: UIColor(rgb: 0x5a5a5e),
|
||||
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 bubble = PresentationThemeChatBubble(
|
||||
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))),
|
||||
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))),
|
||||
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))),
|
||||
incomingPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
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)
|
||||
)
|
||||
let chatList = PresentationThemeChatList(
|
||||
backgroundColor: UIColor(rgb: 0x000000),
|
||||
itemSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
itemBackgroundColor: UIColor(rgb: 0x000000),
|
||||
pinnedItemBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x191919),
|
||||
itemSelectedBackgroundColor: UIColor(rgb: 0x191919),
|
||||
titleColor: UIColor(rgb: 0xffffff),
|
||||
secretTitleColor: secretColor,
|
||||
dateTextColor: UIColor(rgb: 0x8e8e92),
|
||||
authorNameColor: UIColor(rgb: 0xffffff),
|
||||
messageTextColor: UIColor(rgb: 0x8e8e92),
|
||||
messageDraftTextColor: UIColor(rgb: 0xdd4b39),
|
||||
checkmarkColor: UIColor(rgb: 0xffffff),
|
||||
pendingIndicatorColor: UIColor(rgb: 0xffffff),
|
||||
failedFillColor: destructiveColor,
|
||||
failedForegroundColor: .white,
|
||||
muteIconColor: UIColor(rgb: 0x8e8e92),
|
||||
unreadBadgeActiveBackgroundColor: UIColor(rgb: 0xffffff),
|
||||
unreadBadgeActiveTextColor: UIColor(rgb: 0x000000),
|
||||
unreadBadgeInactiveBackgroundColor: UIColor(rgb: 0x666666),
|
||||
unreadBadgeInactiveTextColor:UIColor(rgb: 0x000000),
|
||||
pinnedBadgeColor: UIColor(rgb: 0x767677),
|
||||
pinnedSearchBarColor: UIColor(rgb: 0x272728),
|
||||
regularSearchBarColor: UIColor(rgb: 0x272728),
|
||||
sectionHeaderFillColor: UIColor(rgb: 0x1C1C1D),
|
||||
sectionHeaderTextColor: UIColor(rgb: 0xffffff),
|
||||
searchBarKeyboardColor: .dark,
|
||||
verifiedIconFillColor: accentColor,
|
||||
verifiedIconForegroundColor: .white,
|
||||
secretIconColor: secretColor,
|
||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x72d5fd), UIColor(rgb: 0x2a9ef1)), foregroundColor: .white),
|
||||
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: (UIColor(rgb: 0x666666), UIColor(rgb: 0x666666)), foregroundColor: .black),
|
||||
onlineDotColor: UIColor(rgb: 0x4cc91f)
|
||||
)
|
||||
|
||||
private let serviceMessage = PresentationThemeServiceMessage(
|
||||
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))),
|
||||
unreadBarFillColor: UIColor(rgb: 0x1b1b1b), //!!!
|
||||
unreadBarStrokeColor: UIColor(rgb: 0x000000),
|
||||
unreadBarTextColor: UIColor(rgb: 0xb2b2b2), //!!!
|
||||
dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2))
|
||||
)
|
||||
let bubble = PresentationThemeChatBubble(
|
||||
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))),
|
||||
outgoing: PresentationThemeBubbleColor(withWallpaper: PresentationThemeBubbleColorComponents(fill: accentColor, highlightedFill: accentColor.withMultipliedBrightnessBy(1.421), stroke: accentColor), withoutWallpaper: PresentationThemeBubbleColorComponents(fill: accentColor, highlightedFill: accentColor.withMultipliedBrightnessBy(1.421), stroke: accentColor)),
|
||||
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))),
|
||||
incomingPrimaryTextColor: UIColor(rgb: 0xffffff),
|
||||
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(
|
||||
buttonColor: accentColor,
|
||||
micLevelColor: accentColor.withAlphaComponent(0.2),
|
||||
activeIconColor: .black,
|
||||
panelControlFillColor: UIColor(rgb: 0x1C1C1D),
|
||||
panelControlStrokeColor: UIColor(rgb: 0x1C1C1D),
|
||||
panelControlContentPrimaryColor: UIColor(rgb: 0x9597a0), //!!!
|
||||
panelControlContentAccentColor: accentColor
|
||||
)
|
||||
let serviceMessage = PresentationThemeServiceMessage(
|
||||
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))),
|
||||
unreadBarFillColor: UIColor(rgb: 0x1b1b1b),
|
||||
unreadBarStrokeColor: UIColor(rgb: 0x000000),
|
||||
unreadBarTextColor: UIColor(rgb: 0xb2b2b2),
|
||||
dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff))
|
||||
)
|
||||
|
||||
private let inputPanel = PresentationThemeChatInputPanel(
|
||||
panelBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
panelStrokeColor: UIColor(rgb: 0x000000),
|
||||
panelControlAccentColor: accentColor,
|
||||
panelControlColor: UIColor(rgb: 0x808080),
|
||||
panelControlDisabledColor: UIColor(rgb: 0x808080, alpha: 0.5), //!!!
|
||||
panelControlDestructiveColor: UIColor(rgb: 0xff3b30), //!!!
|
||||
inputBackgroundColor: UIColor(rgb: 0x060606),
|
||||
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
|
||||
)
|
||||
let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
||||
buttonColor: accentColor,
|
||||
micLevelColor: accentColor.withAlphaComponent(0.2),
|
||||
activeIconColor: .black,
|
||||
panelControlFillColor: UIColor(rgb: 0x1C1C1D),
|
||||
panelControlStrokeColor: UIColor(rgb: 0x1C1C1D),
|
||||
panelControlContentPrimaryColor: UIColor(rgb: 0x9597a0),
|
||||
panelControlContentAccentColor: accentColor
|
||||
)
|
||||
|
||||
private let inputMediaPanel = PresentationThemeInputMediaPanel(
|
||||
panelSeparatorColor: UIColor(rgb: 0x000000),
|
||||
panelIconColor: UIColor(rgb: 0x808080),
|
||||
panelHighlightedIconBackgroundColor: UIColor(rgb: 0x000000), //!!!
|
||||
stickersBackgroundColor: UIColor(rgb: 0x000000),
|
||||
stickersSectionTextColor: UIColor(rgb: 0x7b7b7b),
|
||||
stickersSearchBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
stickersSearchPlaceholderColor: UIColor(rgb: 0x8e8e93),
|
||||
stickersSearchPrimaryColor: .white,
|
||||
stickersSearchControlColor: UIColor(rgb: 0x8e8e93),
|
||||
gifsBackgroundColor: UIColor(rgb: 0x000000)
|
||||
)
|
||||
let inputPanel = PresentationThemeChatInputPanel(
|
||||
panelBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
panelStrokeColor: UIColor(rgb: 0x000000),
|
||||
panelControlAccentColor: accentColor,
|
||||
panelControlColor: UIColor(rgb: 0x808080),
|
||||
panelControlDisabledColor: UIColor(rgb: 0x808080, alpha: 0.5),
|
||||
panelControlDestructiveColor: UIColor(rgb: 0xff3b30),
|
||||
inputBackgroundColor: UIColor(rgb: 0x060606),
|
||||
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 inputButtonPanel = PresentationThemeInputButtonPanel(
|
||||
panelSeparatorColor: UIColor(rgb: 0x000000),
|
||||
panelBackgroundColor: UIColor(rgb: 0x141414),
|
||||
buttonFillColor: UIColor(rgb: 0x5A5A5A),
|
||||
buttonStrokeColor: UIColor(rgb: 0x0C0C0C),
|
||||
buttonHighlightedFillColor: UIColor(rgb: 0x5A5A5A, alpha: 0.7),
|
||||
buttonHighlightedStrokeColor: UIColor(rgb: 0x0C0C0C),
|
||||
buttonTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
let inputMediaPanel = PresentationThemeInputMediaPanel(
|
||||
panelSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
panelIconColor: UIColor(rgb: 0x808080),
|
||||
panelHighlightedIconBackgroundColor: UIColor(rgb: 0x000000),
|
||||
stickersBackgroundColor: UIColor(rgb: 0x000000),
|
||||
stickersSectionTextColor: UIColor(rgb: 0x7b7b7b),
|
||||
stickersSearchBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
stickersSearchPlaceholderColor: UIColor(rgb: 0x8e8e92),
|
||||
stickersSearchPrimaryColor: .white,
|
||||
stickersSearchControlColor: UIColor(rgb: 0x8e8e92),
|
||||
gifsBackgroundColor: UIColor(rgb: 0x000000)
|
||||
)
|
||||
|
||||
private let historyNavigation = PresentationThemeChatHistoryNavigation(
|
||||
fillColor: UIColor(rgb: 0x1C1C1D),
|
||||
strokeColor: UIColor(rgb: 0x000000),
|
||||
foregroundColor: UIColor(rgb: 0xffffff),
|
||||
badgeBackgroundColor: accentColor,
|
||||
badgeStrokeColor: .black,
|
||||
badgeTextColor: .black
|
||||
)
|
||||
let inputButtonPanel = PresentationThemeInputButtonPanel(
|
||||
panelSeparatorColor: UIColor(rgb: 0x3d3d40),
|
||||
panelBackgroundColor: UIColor(rgb: 0x141414),
|
||||
buttonFillColor: UIColor(rgb: 0x5A5A5A),
|
||||
buttonStrokeColor: UIColor(rgb: 0x0C0C0C),
|
||||
buttonHighlightedFillColor: UIColor(rgb: 0x5A5A5A, alpha: 0.7),
|
||||
buttonHighlightedStrokeColor: UIColor(rgb: 0x0C0C0C),
|
||||
buttonTextColor: UIColor(rgb: 0xffffff)
|
||||
)
|
||||
|
||||
private let chat = PresentationThemeChat(
|
||||
bubble: bubble,
|
||||
serviceMessage: serviceMessage,
|
||||
inputPanel: inputPanel,
|
||||
inputMediaPanel: inputMediaPanel,
|
||||
inputButtonPanel: inputButtonPanel,
|
||||
historyNavigation: historyNavigation
|
||||
)
|
||||
let historyNavigation = PresentationThemeChatHistoryNavigation(
|
||||
fillColor: UIColor(rgb: 0x1C1C1D),
|
||||
strokeColor: UIColor(rgb: 0x000000),
|
||||
foregroundColor: UIColor(rgb: 0xffffff),
|
||||
badgeBackgroundColor: accentColor,
|
||||
badgeStrokeColor: .black,
|
||||
badgeTextColor: .black
|
||||
)
|
||||
|
||||
private let actionSheet = PresentationThemeActionSheet(
|
||||
dimColor: UIColor(white: 0.0, alpha: 0.5),
|
||||
backgroundType: .dark,
|
||||
opaqueItemBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
itemBackgroundColor: UIColor(rgb: 0x1c1c1d, alpha: 0.8),
|
||||
opaqueItemHighlightedBackgroundColor: UIColor(white: 0.0, alpha: 1.0),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.5), //!!!
|
||||
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
|
||||
)
|
||||
let chat = PresentationThemeChat(
|
||||
bubble: bubble,
|
||||
serviceMessage: serviceMessage,
|
||||
inputPanel: inputPanel,
|
||||
inputMediaPanel: inputMediaPanel,
|
||||
inputButtonPanel: inputButtonPanel,
|
||||
historyNavigation: historyNavigation
|
||||
)
|
||||
|
||||
private let inAppNotification = PresentationThemeInAppNotification(
|
||||
fillColor: UIColor(rgb: 0x1c1c1d),
|
||||
primaryTextColor: .white,
|
||||
expandedNotification: PresentationThemeExpandedNotification(
|
||||
let actionSheet = PresentationThemeActionSheet(
|
||||
dimColor: UIColor(white: 0.0, alpha: 0.5),
|
||||
backgroundType: .dark,
|
||||
navigationBar: PresentationThemeExpandedNotificationNavigationBar(
|
||||
backgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
primaryTextColor: accentColor,
|
||||
controlColor: accentColor,
|
||||
separatorColor: UIColor(rgb: 0x000000)
|
||||
opaqueItemBackgroundColor: UIColor(rgb: 0x1c1c1d),
|
||||
itemBackgroundColor: UIColor(rgb: 0x1c1c1d, alpha: 0.8),
|
||||
opaqueItemHighlightedBackgroundColor: UIColor(white: 0.0, alpha: 1.0),
|
||||
itemHighlightedBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.5),
|
||||
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(
|
||||
name: .builtin(.nightGrayscale),
|
||||
overallDarkAppearance: true,
|
||||
allowsCustomWallpapers: false,
|
||||
auth: auth,
|
||||
passcode: passcode,
|
||||
rootController: rootController,
|
||||
list: list,
|
||||
chatList: chatList,
|
||||
chat: chat,
|
||||
actionSheet: actionSheet,
|
||||
inAppNotification: inAppNotification
|
||||
)
|
||||
return PresentationTheme(
|
||||
name: .builtin(.nightGrayscale),
|
||||
overallDarkAppearance: true,
|
||||
auth: auth,
|
||||
passcode: passcode,
|
||||
rootController: rootController,
|
||||
list: list,
|
||||
chatList: chatList,
|
||||
chat: chat,
|
||||
actionSheet: actionSheet,
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,6 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
|
||||
return PresentationTheme(
|
||||
name: .builtin(day ? .day : .dayClassic),
|
||||
overallDarkAppearance: false,
|
||||
allowsCustomWallpapers: true,
|
||||
auth: auth,
|
||||
passcode: passcode,
|
||||
rootController: rootController,
|
||||
|
@ -279,9 +279,9 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager) -
|
||||
case .dayClassic:
|
||||
themeValue = defaultPresentationTheme
|
||||
case .nightGrayscale:
|
||||
themeValue = defaultDarkPresentationTheme
|
||||
themeValue = makeDarkPresentationTheme(accentColor: effectiveAccentColor)
|
||||
case .nightAccent:
|
||||
themeValue = defaultDarkAccentPresentationTheme
|
||||
themeValue = makeDarkAccentPresentationTheme(accentColor: effectiveAccentColor)
|
||||
case .day:
|
||||
themeValue = makeDefaultDayPresentationTheme(accentColor: effectiveAccentColor, serviceBackgroundColor: defaultServiceBackgroundColor)
|
||||
}
|
||||
@ -561,9 +561,9 @@ public func updatedPresentationData(accountManager: AccountManager, applicationI
|
||||
case .dayClassic:
|
||||
themeValue = makeDefaultPresentationTheme(serviceBackgroundColor: serviceBackgroundColor)
|
||||
case .nightGrayscale:
|
||||
themeValue = defaultDarkPresentationTheme
|
||||
themeValue = makeDarkPresentationTheme(accentColor: effectiveAccentColor)
|
||||
case .nightAccent:
|
||||
themeValue = defaultDarkAccentPresentationTheme
|
||||
themeValue = makeDarkAccentPresentationTheme(accentColor: effectiveAccentColor)
|
||||
case .day:
|
||||
themeValue = makeDefaultDayPresentationTheme(accentColor: effectiveAccentColor, serviceBackgroundColor: serviceBackgroundColor)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -951,7 +951,6 @@ public enum PresentationThemeName: Equatable {
|
||||
public final class PresentationTheme: Equatable {
|
||||
public let name: PresentationThemeName
|
||||
public let overallDarkAppearance: Bool
|
||||
public let allowsCustomWallpapers: Bool
|
||||
public let auth: PresentationThemeAuth
|
||||
public let passcode: PresentationThemePasscode
|
||||
public let rootController: PresentationThemeRootController
|
||||
@ -963,10 +962,9 @@ public final class PresentationTheme: Equatable {
|
||||
|
||||
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.overallDarkAppearance = overallDarkAppearance
|
||||
self.allowsCustomWallpapers = allowsCustomWallpapers
|
||||
self.auth = auth
|
||||
self.passcode = passcode
|
||||
self.rootController = rootController
|
||||
|
@ -666,7 +666,7 @@ func convertMarkdownToAttributes(_ text: NSAttributedString) -> NSAttributedStri
|
||||
while let match = regex.firstMatch(in: string as String, range: NSMakeRange(0, string.length)) {
|
||||
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)
|
||||
if pre.location != NSNotFound {
|
||||
|
@ -150,7 +150,7 @@ func uploadCustomWallpaper(context: AccountContext, wallpaper: WallpaperGalleryE
|
||||
let _ = (updatePresentationThemeSettingsInteractively(accountManager: accountManager, { current in
|
||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||
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()
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,11 @@ import UniversalMediaPlayer
|
||||
private let kOutputBus: UInt32 = 0
|
||||
private let kInputBus: UInt32 = 1
|
||||
|
||||
private func audioRecorderNativeStreamDescription() -> AudioStreamBasicDescription {
|
||||
private func audioRecorderNativeStreamDescription(sampleRate: Float64) -> AudioStreamBasicDescription {
|
||||
var canonicalBasicStreamDescription = AudioStreamBasicDescription()
|
||||
canonicalBasicStreamDescription.mSampleRate = 16000.0
|
||||
canonicalBasicStreamDescription.mSampleRate = sampleRate
|
||||
canonicalBasicStreamDescription.mFormatID = kAudioFormatLinearPCM
|
||||
canonicalBasicStreamDescription.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked
|
||||
canonicalBasicStreamDescription.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked
|
||||
canonicalBasicStreamDescription.mFramesPerPacket = 1
|
||||
canonicalBasicStreamDescription.mChannelsPerFrame = 1
|
||||
canonicalBasicStreamDescription.mBitsPerChannel = 16
|
||||
@ -365,7 +365,7 @@ final class ManagedAudioRecorderContext {
|
||||
return
|
||||
}
|
||||
|
||||
var audioStreamDescription = audioRecorderNativeStreamDescription()
|
||||
var audioStreamDescription = audioRecorderNativeStreamDescription(sampleRate: 48000)
|
||||
guard AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &audioStreamDescription, UInt32(MemoryLayout<AudioStreamBasicDescription>.size)) == noErr else {
|
||||
AudioComponentInstanceDispose(audioUnit)
|
||||
return
|
||||
|
Binary file not shown.
@ -46,8 +46,8 @@ public extension TermsOfServiceControllerTheme {
|
||||
theme = defaultDarkPresentationTheme
|
||||
case defaultDarkAccentPresentationTheme.list.itemBlocksBackgroundColor.argb:
|
||||
theme = defaultDarkAccentPresentationTheme
|
||||
default:
|
||||
theme = defaultPresentationTheme
|
||||
default:
|
||||
theme = defaultPresentationTheme
|
||||
}
|
||||
return theme
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ final class ThemeGridController: ViewController {
|
||||
|
||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||
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()
|
||||
break
|
||||
}
|
||||
@ -257,7 +257,7 @@ final class ThemeGridController: ViewController {
|
||||
} else {
|
||||
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()
|
||||
|
||||
|
@ -13,17 +13,23 @@ private final class ThemeSettingsControllerArguments {
|
||||
let selectFontSize: (PresentationFontSize) -> Void
|
||||
let openWallpaperSettings: () -> Void
|
||||
let openAccentColor: (Int32) -> Void
|
||||
let selectAccentColor: (PresentationThemeAccentColor) -> Void
|
||||
let toggleColorSlider: () -> Void
|
||||
let toggleTintAllColors: () -> Void
|
||||
let openAutoNightTheme: () -> Void
|
||||
let toggleLargeEmoji: (Bool) -> Void
|
||||
let disableAnimations: (Bool) -> 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.selectTheme = selectTheme
|
||||
self.selectFontSize = selectFontSize
|
||||
self.openWallpaperSettings = openWallpaperSettings
|
||||
self.openAccentColor = openAccentColor
|
||||
self.selectAccentColor = selectAccentColor
|
||||
self.toggleColorSlider = toggleColorSlider
|
||||
self.toggleTintAllColors = toggleTintAllColors
|
||||
self.openAutoNightTheme = openAutoNightTheme
|
||||
self.toggleLargeEmoji = toggleLargeEmoji
|
||||
self.disableAnimations = disableAnimations
|
||||
@ -42,6 +48,7 @@ private enum ThemeSettingsControllerSection: Int32 {
|
||||
public enum ThemeSettingsEntryTag: ItemListItemTag {
|
||||
case fontSize
|
||||
case theme
|
||||
case tint
|
||||
case accentColor
|
||||
case icon
|
||||
case largeEmoji
|
||||
@ -64,6 +71,7 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
||||
case wallpaper(PresentationTheme, String)
|
||||
case accentColor(PresentationTheme, String, PresentationThemeAccentColor?)
|
||||
case autoNightTheme(PresentationTheme, String, String)
|
||||
case themeTint(PresentationTheme, String, Bool)
|
||||
case themeItem(PresentationTheme, PresentationStrings, [PresentationThemeReference], PresentationThemeReference, [Int64: PresentationThemeAccentColor])
|
||||
case iconHeader(PresentationTheme, String)
|
||||
case iconItem(PresentationTheme, PresentationStrings, [PresentationAppIcon], String?)
|
||||
@ -74,7 +82,7 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
||||
|
||||
var section: ItemListSectionId {
|
||||
switch self {
|
||||
case .themeListHeader, .chatPreview, .themeItem, .accentColor:
|
||||
case .themeListHeader, .chatPreview, .themeItem, .themeTint, .accentColor:
|
||||
return ThemeSettingsControllerSection.chatPreview.rawValue
|
||||
case .fontSizeHeader, .fontSize:
|
||||
return ThemeSettingsControllerSection.fontSize.rawValue
|
||||
@ -95,28 +103,30 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
||||
return 1
|
||||
case .themeItem:
|
||||
return 2
|
||||
case .accentColor:
|
||||
case .themeTint:
|
||||
return 3
|
||||
case .wallpaper:
|
||||
case .accentColor:
|
||||
return 4
|
||||
case .autoNightTheme:
|
||||
case .wallpaper:
|
||||
return 5
|
||||
case .fontSizeHeader:
|
||||
case .autoNightTheme:
|
||||
return 6
|
||||
case .fontSize:
|
||||
case .fontSizeHeader:
|
||||
return 7
|
||||
case .iconHeader:
|
||||
case .fontSize:
|
||||
return 8
|
||||
case .iconItem:
|
||||
case .iconHeader:
|
||||
return 9
|
||||
case .otherHeader:
|
||||
case .iconItem:
|
||||
return 10
|
||||
case .largeEmoji:
|
||||
case .otherHeader:
|
||||
return 11
|
||||
case .animations:
|
||||
case .largeEmoji:
|
||||
return 12
|
||||
case .animationsInfo:
|
||||
case .animations:
|
||||
return 13
|
||||
case .animationsInfo:
|
||||
return 14
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,6 +144,12 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
||||
} else {
|
||||
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):
|
||||
if case let .accentColor(rhsTheme, rhsText, rhsColor) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsColor == rhsColor {
|
||||
return true
|
||||
@ -227,20 +243,24 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
||||
return ItemListDisclosureItem(theme: theme, title: text, label: "", sectionId: self.section, style: .blocks, action: {
|
||||
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 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)
|
||||
// let accentColor = UIColor(rgb: UInt32(bitPattern: 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)
|
||||
// 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):
|
||||
return ItemListDisclosureItem(theme: theme, icon: nil, title: text, label: value, labelStyle: .text, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
|
||||
arguments.openAutoNightTheme()
|
||||
@ -248,8 +268,10 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
||||
case let .themeListHeader(theme, text):
|
||||
return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section)
|
||||
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)
|
||||
}, currentColor: nil, updatedColor: { color in
|
||||
arguments.selectAccentColor(color)
|
||||
})
|
||||
case let .iconHeader(theme, text):
|
||||
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] = []
|
||||
|
||||
entries.append(.themeListHeader(presentationData.theme, strings.Appearance_ColorTheme.uppercased()))
|
||||
@ -281,7 +315,10 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
|
||||
if case .builtin = themeReference {
|
||||
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]))
|
||||
}
|
||||
|
||||
@ -290,12 +327,12 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
|
||||
if theme.name == .builtin(.day) || theme.name == .builtin(.dayClassic) {
|
||||
let title: String
|
||||
switch autoNightSettings.trigger {
|
||||
case .none:
|
||||
title = strings.AutoNightTheme_Disabled
|
||||
case .timeBased:
|
||||
title = strings.AutoNightTheme_Scheduled
|
||||
case .brightness:
|
||||
title = strings.AutoNightTheme_Automatic
|
||||
case .none:
|
||||
title = strings.AutoNightTheme_Disabled
|
||||
case .timeBased:
|
||||
title = strings.AutoNightTheme_Scheduled
|
||||
case .brightness:
|
||||
title = strings.AutoNightTheme_Automatic
|
||||
}
|
||||
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 {
|
||||
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 presentControllerImpl: ((ViewController) -> Void)?
|
||||
|
||||
@ -344,33 +388,54 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
current = PresentationThemeSettings.defaultSettings
|
||||
}
|
||||
|
||||
let wallpaper: TelegramWallpaper
|
||||
let chatWallpaper: TelegramWallpaper
|
||||
|
||||
if let themeSpecificWallpaper = current.themeSpecificChatWallpapers[theme.index] {
|
||||
wallpaper = themeSpecificWallpaper
|
||||
} else {
|
||||
if case let .builtin(theme) = theme {
|
||||
switch theme {
|
||||
case .day:
|
||||
wallpaper = .color(0xffffff)
|
||||
case .dayClassic:
|
||||
wallpaper = .builtin(WallpaperSettings())
|
||||
if case let .builtin(themeReference) = theme {
|
||||
switch themeReference {
|
||||
case .nightAccent:
|
||||
wallpaper = .color(0x18222d)
|
||||
case .nightGrayscale:
|
||||
wallpaper = .color(0x000000)
|
||||
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)
|
||||
}
|
||||
default:
|
||||
chatWallpaper = themeSpecificWallpaper
|
||||
}
|
||||
} 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()
|
||||
}, selectFontSize: { size 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()
|
||||
}, openWallpaperSettings: {
|
||||
pushControllerImpl?(ThemeGridController(context: context))
|
||||
@ -402,18 +467,45 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
var themeSpecificAccentColors = current.themeSpecificAccentColors
|
||||
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()
|
||||
}))
|
||||
}, 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: {
|
||||
pushControllerImpl?(themeAutoNightSettingsController(context: context))
|
||||
}, toggleLargeEmoji: { largeEmoji 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()
|
||||
}, disableAnimations: { disabled 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()
|
||||
}, selectAppIcon: { name in
|
||||
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)
|
||||
|> map { presentationData, sharedData, availableAppIcons, currentAppIconName -> (ItemListControllerState, (ItemListNodeState<ThemeSettingsControllerEntry>, ThemeSettingsControllerEntry.ItemGenerationArguments)) in
|
||||
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, state -> (ItemListControllerState, (ItemListNodeState<ThemeSettingsControllerEntry>, ThemeSettingsControllerEntry.ItemGenerationArguments)) in
|
||||
let theme: PresentationTheme
|
||||
let fontSize: PresentationFontSize
|
||||
let wallpaper: TelegramWallpaper
|
||||
@ -437,14 +529,20 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
case .dayClassic:
|
||||
theme = defaultPresentationTheme
|
||||
case .nightGrayscale:
|
||||
theme = defaultDarkPresentationTheme
|
||||
theme = makeDarkPresentationTheme(accentColor: settings.themeSpecificAccentColors[settings.theme.index]?.color ?? defaultDayAccentColor)
|
||||
case .nightAccent:
|
||||
theme = defaultDarkAccentPresentationTheme
|
||||
theme = makeDarkAccentPresentationTheme(accentColor: settings.themeSpecificAccentColors[settings.theme.index]?.color ?? defaultDayAccentColor)
|
||||
case .day:
|
||||
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
|
||||
|
||||
dateTimeFormat = presentationData.dateTimeFormat
|
||||
@ -452,7 +550,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
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 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))
|
||||
}
|
||||
|
@ -63,11 +63,23 @@ private func generateThemeIconImage(theme: PresentationThemeReference, accentCol
|
||||
case .nightGrayscale:
|
||||
background = UIColor(rgb: 0x000000)
|
||||
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:
|
||||
background = UIColor(rgb: 0x18222d)
|
||||
incomingBubble = UIColor(rgb: 0x32475e)
|
||||
outgoingBubble = UIColor(rgb: 0x3d6a97)
|
||||
if let accentColorValue = accentColor {
|
||||
let accentColor = UIColor(rgb: UInt32(bitPattern: accentColorValue))
|
||||
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)
|
||||
@ -97,16 +109,20 @@ class ThemeSettingsThemeItem: ListViewItem, ItemListItem {
|
||||
let themes: [PresentationThemeReference]
|
||||
let themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]
|
||||
let currentTheme: PresentationThemeReference
|
||||
let updated: (PresentationThemeReference) -> Void
|
||||
let updatedTheme: (PresentationThemeReference) -> Void
|
||||
let currentColor: PresentationThemeAccentColor?
|
||||
let updatedColor: (PresentationThemeAccentColor) -> Void
|
||||
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.strings = strings
|
||||
self.themes = themes
|
||||
self.themeSpecificAccentColors = themeSpecificAccentColors
|
||||
self.currentTheme = currentTheme
|
||||
self.updated = updated
|
||||
self.updatedTheme = updatedTheme
|
||||
self.currentColor = currentColor
|
||||
self.updatedColor = updatedColor
|
||||
self.tag = tag
|
||||
self.sectionId = sectionId
|
||||
}
|
||||
@ -352,7 +368,7 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
|
||||
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
|
||||
item.updated(theme)
|
||||
item.updatedTheme(theme)
|
||||
if let imageNode = imageNode {
|
||||
self?.scrollToNode(imageNode, animated: true)
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ class WallpaperGalleryController: ViewController {
|
||||
let _ = (updatePresentationThemeSettingsInteractively(accountManager: strongSelf.context.sharedContext.accountManager, { current in
|
||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||
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: {
|
||||
self?.dismiss(forceAway: true)
|
||||
})
|
||||
|
@ -139,7 +139,7 @@ final class WallpaperUploadManager {
|
||||
|
||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
@ -130,9 +130,9 @@ static inline int writeOggPage(ogg_page *page, TGDataItem *fileItem)
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
bitrate = 20 * 1024;
|
||||
bitrate = 30 * 1024;
|
||||
rate = 48000;
|
||||
coding_rate = 16000;
|
||||
coding_rate = 48000;
|
||||
frame_size = 960;
|
||||
with_cvbr = 1;
|
||||
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();
|
||||
comment_init(&inopt.comments, &inopt.comments_length, opus_version);
|
||||
|
||||
bitrate = 16 * 1024;
|
||||
// bitrate = 16 * 1024;
|
||||
|
||||
inopt.rawmode = 1;
|
||||
inopt.ignorelength = 1;
|
||||
inopt.samplesize = 16;
|
||||
inopt.rate = 16000;
|
||||
inopt.channels = 1;
|
||||
// inopt.rawmode = 1;
|
||||
// inopt.ignorelength = 1;
|
||||
// inopt.samplesize = 16;
|
||||
// inopt.rate = 16000;
|
||||
// inopt.channels = 1;
|
||||
|
||||
rate = (opus_int32)inopt.rate;
|
||||
inopt.skip = 0;
|
||||
|
@ -254,6 +254,7 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
||||
public var theme: PresentationThemeReference
|
||||
public var themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]
|
||||
public var themeSpecificChatWallpapers: [Int64: TelegramWallpaper]
|
||||
public var themeTintColors: Bool
|
||||
public var fontSize: PresentationFontSize
|
||||
public var automaticThemeSwitchSetting: AutomaticThemeSwitchSetting
|
||||
public var largeEmoji: Bool
|
||||
@ -283,14 +284,15 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
||||
}
|
||||
|
||||
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.theme = theme
|
||||
self.themeSpecificAccentColors = themeSpecificAccentColors
|
||||
self.themeSpecificChatWallpapers = themeSpecificChatWallpapers
|
||||
self.themeTintColors = themeTintColors
|
||||
self.fontSize = fontSize
|
||||
self.automaticThemeSwitchSetting = automaticThemeSwitchSetting
|
||||
self.largeEmoji = largeEmoji
|
||||
@ -338,6 +340,8 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
||||
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.automaticThemeSwitchSetting = (decoder.decodeObjectForKey("automaticThemeSwitchSetting", decoder: { AutomaticThemeSwitchSetting(decoder: $0) }) as? AutomaticThemeSwitchSetting) ?? AutomaticThemeSwitchSetting(trigger: .none, theme: .nightAccent)
|
||||
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.encodeInt64(key, forKey: "k")
|
||||
})
|
||||
encoder.encodeBool(self.themeTintColors, forKey: "themeTintColors")
|
||||
encoder.encodeInt32(self.fontSize.rawValue, forKey: "f")
|
||||
encoder.encodeObject(self.automaticThemeSwitchSetting, forKey: "automaticThemeSwitchSetting")
|
||||
encoder.encodeBool(self.largeEmoji, forKey: "largeEmoji")
|
||||
@ -368,7 +373,7 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user