UI improvements

This commit is contained in:
Ilya Laktyushin 2023-03-01 21:11:50 +04:00
parent 699287d011
commit 167d6fd49e
13 changed files with 24 additions and 246 deletions

View File

@ -66,6 +66,7 @@ public final class AnimatedAvatarSetContext {
private let avatarFont = avatarPlaceholderFont(size: 12.0)
private final class ContentNode: ASDisplayNode {
private let context: AccountContext
private var audioLevelView: VoiceBlobView?
private var audioLevelBlobOverlay: UIImageView?
private let unclippedNode: ASImageNode
@ -77,6 +78,7 @@ private final class ContentNode: ASDisplayNode {
private var disposable: Disposable?
init(context: AccountContext, peer: EnginePeer?, placeholderColor: UIColor, synchronousLoad: Bool, size: CGSize, spacing: CGFloat) {
self.context = context
self.size = size
self.spacing = spacing
@ -162,7 +164,7 @@ private final class ContentNode: ASDisplayNode {
}
func updateAudioLevel(color: UIColor, backgroundColor: UIColor, value: Float) {
if self.audioLevelView == nil, value > 0.0 {
if self.audioLevelView == nil, value > 0.0, self.context.sharedContext.energyUsageSettings.fullTranslucency {
let blobFrame = self.unclippedNode.bounds.insetBy(dx: -8.0, dy: -8.0)
let audioLevelView = VoiceBlobView(

View File

@ -440,7 +440,7 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode {
return
}
if strongSelf.audioLevelView == nil {
if strongSelf.audioLevelView == nil, strongSelf.context.sharedContext.energyUsageSettings.fullTranslucency {
let blobFrame = CGRect(origin: CGPoint(), size: CGSize(width: 36.0, height: 36.0)).insetBy(dx: -12.0, dy: -12.0)
let audioLevelView = VoiceBlobView(

View File

@ -495,24 +495,10 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
let leftInset: CGFloat = 58.0 + params.leftInset
// let premiumConfiguration = PremiumConfiguration.with(appConfiguration: item.context.currentAppConfiguration.with { $0 })
var titleIconsWidth: CGFloat = 0.0
let currentCredibilityIconImage: UIImage? = nil
let credibilityIconOffset: CGFloat = 0.0
// if item.peer.isScam {
// currentCredibilityIconImage = PresentationResourcesChatList.scamIcon(item.presentationData.theme, strings: item.presentationData.strings, type: .regular)
// credibilityIconOffset = 2.0
// } else if item.peer.isFake {
// currentCredibilityIconImage = PresentationResourcesChatList.fakeIcon(item.presentationData.theme, strings: item.presentationData.strings, type: .regular)
// credibilityIconOffset = 2.0
// } else if item.peer.isVerified {
// currentCredibilityIconImage = PresentationResourcesChatList.verifiedIcon(item.presentationData.theme)
// credibilityIconOffset = 3.0
// } else if item.peer.isPremium && !premiumConfiguration.isPremiumDisabled {
// currentCredibilityIconImage = PresentationResourcesChatList.premiumIcon(item.presentationData.theme)
// credibilityIconOffset = 3.0
// }
if let currentCredibilityIconImage = currentCredibilityIconImage {
titleIconsWidth += 4.0 + currentCredibilityIconImage.size.width
@ -691,7 +677,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
strongSelf.highlightNode.updateLevel(CGFloat(value))
if strongSelf.audioLevelView == nil, value > 0.0 {
if strongSelf.audioLevelView == nil, value > 0.0, item.context.sharedContext.energyUsageSettings.fullTranslucency {
let audioLevelView = VoiceBlobView(
frame: blobFrame,
maxLevel: 1.5,

View File

@ -661,7 +661,7 @@ final class VoiceChatMainStageNode: ASDisplayNode {
return
}
if strongSelf.speakingAudioLevelView == nil, value > 0.0 {
if strongSelf.speakingAudioLevelView == nil, value > 0.0, strongSelf.context.sharedContext.energyUsageSettings.fullTranslucency {
let audioLevelView = VoiceBlobView(
frame: blobFrame,
maxLevel: 1.5,

View File

@ -1063,7 +1063,7 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode {
return
}
if strongSelf.audioLevelView == nil, value > 0.0 {
if strongSelf.audioLevelView == nil, value > 0.0, item.context.sharedContext.energyUsageSettings.fullTranslucency {
let audioLevelView = VoiceBlobView(
frame: blobFrame,
maxLevel: 1.5,

View File

@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "EmptyChat@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,12 +0,0 @@
{
"images" : [
{
"filename" : "phone.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,176 +0,0 @@
%PDF-1.7
1 0 obj
<< /ExtGState << /E1 << /ca 0.500000 >> >> >>
endobj
2 0 obj
<< /Length 3 0 R >>
stream
/DeviceRGB CS
/DeviceRGB cs
q
/E1 gs
1.000000 0.000000 -0.000000 1.000000 0.000000 -0.003418 cm
0.000000 0.000000 0.000000 scn
1001.992859 2652.003418 m
1040.278442 2652.004395 1072.592285 2652.005127 1099.064819 2649.842285 c
1126.787598 2647.577148 1153.344360 2642.644287 1178.614136 2629.768555 c
1216.999146 2610.210449 1248.207153 2579.002441 1267.765259 2540.617432 c
1280.640869 2515.347656 1285.573730 2488.791016 1287.838745 2461.068115 c
1290.001709 2434.595947 1290.000854 2402.282471 1290.000000 2363.997559 c
1290.000000 288.009521 l
1290.000854 249.724609 1290.001709 217.410889 1287.838745 190.938965 c
1285.573730 163.216064 1280.640869 136.659180 1267.765259 111.389648 c
1248.207153 73.004395 1216.999146 41.796631 1178.614136 22.238281 c
1153.344360 9.362793 1126.787598 4.429932 1099.064819 2.164795 c
1072.592529 0.001709 1040.279175 0.002686 1001.994263 0.003662 c
288.005798 0.003662 l
249.720932 0.002686 217.407471 0.001709 190.935211 2.164795 c
163.212448 4.429932 136.655716 9.362793 111.386002 22.238281 c
73.000938 41.796631 41.792908 73.004395 22.234743 111.389648 c
9.359177 136.659180 4.426258 163.216064 2.161221 190.938965 c
-0.001672 217.411621 -0.000894 249.725342 0.000039 288.010742 c
0.000039 2363.996338 l
-0.000894 2402.281738 -0.001672 2434.595703 2.161221 2461.068115 c
4.426258 2488.791016 9.359177 2515.347656 22.234743 2540.617432 c
41.792908 2579.002441 73.000938 2610.210449 111.386002 2629.768555 c
136.655716 2642.644287 163.212463 2647.577148 190.935226 2649.842285 c
217.407806 2652.005127 249.721725 2652.004395 288.007172 2652.003418 c
1001.992859 2652.003418 l
h
75.695122 2513.377930 m
60.000065 2482.574707 60.000069 2442.250977 60.000069 2361.603516 c
60.000069 290.403564 l
60.000069 209.756104 60.000065 169.432129 75.695122 138.628906 c
89.500893 111.533691 111.530090 89.504395 138.625427 75.698730 c
169.428711 60.003662 209.752472 60.003662 290.399994 60.003662 c
999.600037 60.003662 l
1080.247559 60.003662 1120.571289 60.003662 1151.374634 75.698730 c
1178.469971 89.504395 1200.499146 111.533691 1214.304932 138.628906 c
1230.000000 169.432129 1230.000000 209.756104 1230.000000 290.403564 c
1230.000000 2361.603271 l
1230.000000 2442.250977 1230.000000 2482.574707 1214.304932 2513.377930 c
1200.499146 2540.473389 1178.469971 2562.502441 1151.374634 2576.308350 c
1120.571289 2592.003418 1080.247559 2592.003418 999.600037 2592.003418 c
290.400055 2592.003418 l
209.752487 2592.003418 169.428711 2592.003418 138.625427 2576.308350 c
111.530090 2562.502441 89.500893 2540.473389 75.695122 2513.377930 c
h
f*
n
Q
q
1.000000 0.000000 -0.000000 1.000000 18.000000 17.998047 cm
0.000000 0.000000 0.000000 scn
1079.599121 2613.900635 m
1053.868774 2616.002686 1022.190063 2616.002441 983.365845 2616.001953 c
270.634308 2616.001953 l
231.810059 2616.002441 200.131302 2616.002686 174.400970 2613.900635 c
147.791351 2611.726562 123.867096 2607.096191 101.557800 2595.729248 c
66.559647 2577.896729 38.105267 2549.442383 20.272820 2514.444092 c
8.905663 2492.134766 4.275493 2468.210693 2.101401 2441.601074 c
-0.000850 2415.870605 -0.000461 2384.191895 0.000014 2345.367676 c
0.000014 270.636230 l
-0.000461 231.812012 -0.000850 200.133301 2.101401 174.402832 c
4.275493 147.793457 8.905663 123.868896 20.272820 101.559814 c
38.105267 66.561523 66.559647 38.107178 101.557800 20.274658 c
123.867096 8.907715 147.791351 4.277344 174.400955 2.103271 c
200.132080 0.000977 231.812027 0.001465 270.637878 0.001953 c
983.362183 0.001953 l
1022.187927 0.001465 1053.867920 0.000977 1079.599121 2.103271 c
1106.208740 4.277344 1130.132935 8.907715 1152.442139 20.274658 c
1187.440308 38.107178 1215.894775 66.561523 1233.727173 101.559814 c
1245.094360 123.868896 1249.724609 147.793457 1251.898560 174.402832 c
1254.000854 200.131836 1254.000488 231.808838 1254.000000 270.630859 c
1254.000000 2345.373291 l
1254.000488 2384.194824 1254.000854 2415.871826 1251.898560 2441.601074 c
1249.724609 2468.210693 1245.094360 2492.134766 1233.727173 2514.444092 c
1215.894775 2549.442383 1187.440308 2577.896729 1152.442139 2595.729248 c
1130.132935 2607.096191 1106.208740 2611.726562 1079.599121 2613.900635 c
h
42.000034 2343.602051 m
42.000034 2424.249512 42.000031 2464.573242 57.695091 2495.376465 c
71.500854 2522.471924 93.530060 2544.500977 120.625397 2558.306885 c
151.428680 2574.001953 191.752472 2574.001953 272.400024 2574.001953 c
359.579956 2574.001953 l
360.458221 2573.991699 l
366.948761 2573.875977 371.125000 2572.780518 374.811859 2570.816895 c
378.715668 2568.737793 381.783417 2565.685303 383.882019 2561.791992 c
385.609863 2558.586670 386.679810 2555.006104 387.023712 2549.834473 c
387.280701 2523.251221 390.322266 2513.048340 395.821350 2502.766113 c
401.573456 2492.010498 410.014465 2483.569336 420.770050 2477.817383 c
431.525635 2472.065186 442.194092 2469.001953 471.614197 2469.001953 c
782.397766 2469.001953 l
811.817871 2469.001953 822.486328 2472.065186 833.241821 2477.817383 c
843.997375 2483.569336 852.438477 2492.010498 858.190613 2502.766113 c
863.689697 2513.048340 866.731323 2523.251221 866.988037 2549.840820 c
867.332153 2555.006104 868.402039 2558.586670 870.129883 2561.791992 c
872.228577 2565.685303 875.296265 2568.737793 879.200073 2570.816895 c
882.886963 2572.780518 887.063110 2573.875977 893.553711 2573.991699 c
894.431946 2574.001953 l
981.600037 2574.001953 l
1062.247559 2574.001953 1102.571289 2574.001953 1133.374634 2558.306885 c
1160.469971 2544.500977 1182.499146 2522.471924 1196.304932 2495.376465 c
1212.000000 2464.573242 1212.000000 2424.249512 1212.000000 2343.602051 c
1212.000000 272.401855 l
1212.000000 191.754395 1212.000000 151.430664 1196.304932 120.627197 c
1182.499146 93.531982 1160.469971 71.502930 1133.374634 57.697021 c
1102.571289 42.001953 1062.247559 42.001953 981.600037 42.001953 c
272.399963 42.001953 l
191.752441 42.001953 151.428680 42.001953 120.625397 57.697021 c
93.530060 71.502930 71.500854 93.531982 57.695091 120.627197 c
42.000031 151.430664 42.000034 191.754395 42.000034 272.401855 c
42.000034 2343.602051 l
h
f*
n
Q
endstream
endobj
3 0 obj
6076
endobj
4 0 obj
<< /Annots []
/Type /Page
/MediaBox [ 0.000000 0.000000 1290.000000 2652.000000 ]
/Resources 1 0 R
/Contents 2 0 R
/Parent 5 0 R
>>
endobj
5 0 obj
<< /Kids [ 4 0 R ]
/Count 1
/Type /Pages
>>
endobj
6 0 obj
<< /Pages 5 0 R
/Type /Catalog
>>
endobj
xref
0 7
0000000000 65535 f
0000000010 00000 n
0000000074 00000 n
0000006206 00000 n
0000006229 00000 n
0000006406 00000 n
0000006480 00000 n
trailer
<< /ID [ (some) (id) ]
/Root 6 0 R
/Size 7
>>
startxref
6539
%%EOF

View File

@ -1606,7 +1606,8 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
statusNode.backgroundNodeColor = backgroundNodeColor
}
if case .pause = state, isVoice, self.playbackAudioLevelNode == nil {
let effectsEnabled = self.context?.sharedContext.energyUsageSettings.fullTranslucency ?? true
if case .pause = state, isVoice, self.playbackAudioLevelNode == nil, effectsEnabled {
let blobFrame = progressFrame.insetBy(dx: -12.0, dy: -12.0)
let playbackAudioLevelNode = VoiceBlobNode(
maxLevel: 0.3,

View File

@ -8,6 +8,7 @@ import ContextUI
import ChatPresentationInterfaceState
import ChatMessageBackground
import ChatControllerInteraction
import AccountContext
final class ChatTextInputActionButtonsNode: ASDisplayNode {
private let presentationContext: ChatPresentationContext?
@ -37,13 +38,13 @@ final class ChatTextInputActionButtonsNode: ASDisplayNode {
private var validLayout: CGSize?
init(presentationInterfaceState: ChatPresentationInterfaceState, presentationContext: ChatPresentationContext?, presentController: @escaping (ViewController) -> Void) {
init(context: AccountContext, presentationInterfaceState: ChatPresentationInterfaceState, presentationContext: ChatPresentationContext?, presentController: @escaping (ViewController) -> Void) {
self.presentationContext = presentationContext
let theme = presentationInterfaceState.theme
let strings = presentationInterfaceState.strings
self.strings = strings
self.micButton = ChatTextInputMediaRecordingButton(theme: theme, strings: strings, presentController: presentController)
self.micButton = ChatTextInputMediaRecordingButton(context: context, theme: theme, strings: strings, presentController: presentController)
self.sendContainerNode = ASDisplayNode()
self.sendContainerNode.layer.allowsGroupOpacity = true

View File

@ -13,6 +13,7 @@ import ChatPresentationInterfaceState
import ComponentFlow
import LottieAnimationComponent
import LottieComponent
import AccountContext
private let offsetThreshold: CGFloat = 10.0
private let dismissOffsetThreshold: CGFloat = 70.0
@ -179,6 +180,7 @@ private final class ChatTextInputMediaRecordingButtonPresenter : NSObject, TGMod
}
final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButton, TGModernConversationInputMicButtonDelegate {
private let context: AccountContext
private var theme: PresentationTheme
private let strings: PresentationStrings
@ -302,7 +304,8 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
}
}
init(theme: PresentationTheme, strings: PresentationStrings, presentController: @escaping (ViewController) -> Void) {
init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, presentController: @escaping (ViewController) -> Void) {
self.context = context
self.theme = theme
self.strings = strings
self.animationView = ComponentView<Empty>()
@ -369,15 +372,7 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
case .video:
animationName = "anim_micToVideo"
}
//var animationMode: LottieAnimationComponent.AnimationItem.Mode = .still(position: .end)
/*let colorKeys = ["__allcolors__"]
var colors: [String: UIColor] = [:]
for colorKey in colorKeys {
colors[colorKey] = self.theme.chat.inputPanel.panelControlColor.blitOver(self.theme.chat.inputPanel.inputBackgroundColor, alpha: 1.0)
}*/
let _ = animationView.update(
transition: .immediate,
component: AnyComponent(LottieComponent(
@ -505,9 +500,11 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
override func animateIn() {
super.animateIn()
micDecoration.isHidden = false
micDecoration.startAnimating()
if self.context.sharedContext.energyUsageSettings.fullTranslucency {
micDecoration.isHidden = false
micDecoration.startAnimating()
}
let transition = ContainedViewLayoutTransition.animated(duration: 0.15, curve: .easeInOut)
if let layer = self.animationView.view?.layer {

View File

@ -752,7 +752,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
self.searchLayoutClearImageNode.isUserInteractionEnabled = false
self.searchLayoutClearButton.addSubnode(self.searchLayoutClearImageNode)
self.actionButtons = ChatTextInputActionButtonsNode(presentationInterfaceState: presentationInterfaceState, presentationContext: presentationContext, presentController: presentController)
self.actionButtons = ChatTextInputActionButtonsNode(context: context, presentationInterfaceState: presentationInterfaceState, presentationContext: presentationContext, presentController: presentController)
self.counterTextNode = ImmediateTextNode()
self.counterTextNode.textAlignment = .center