@@ -13,6 +13,7 @@ import BalancedTextComponent
1313import TelegramPresentationData
1414import TelegramStringFormatting
1515import Markdown
16+ import GlassControls
1617
1718private final class ScheduleVideoChatSheetContentComponent : Component {
1819 typealias EnvironmentType = ViewControllerComponentContainer . Environment
@@ -33,8 +34,8 @@ private final class ScheduleVideoChatSheetContentComponent: Component {
3334 }
3435
3536 final class View : UIView {
36- private let button = ComponentView < Empty > ( )
37- private let cancelButton = ComponentView < Empty > ( )
37+ private let buttons = ComponentView < Empty > ( )
38+ private let actionButton = ComponentView < Empty > ( )
3839
3940 private let title = ComponentView < Empty > ( )
4041 private let mainText = ComponentView < Empty > ( )
@@ -110,6 +111,43 @@ private final class ScheduleVideoChatSheetContentComponent: Component {
110111 var contentHeight : CGFloat = 0.0
111112 contentHeight += 16.0
112113
114+ let buttonsSize = self . buttons. update (
115+ transition: transition,
116+ component: AnyComponent (
117+ GlassControlPanelComponent (
118+ theme: environment. theme,
119+ leftItem: GlassControlPanelComponent . Item (
120+ items: [
121+ GlassControlGroupComponent . Item (
122+ id: AnyHashable ( " close " ) ,
123+ content: . icon( " Navigation/Close " ) ,
124+ action: { [ weak self] in
125+ guard let component = self ? . component else {
126+ return
127+ }
128+ component. dismiss ( )
129+ }
130+ )
131+ ] ,
132+ background: . panel
133+ ) ,
134+ centralItem: nil ,
135+ rightItem: nil ,
136+ centerAlignmentIfPossible: true ,
137+ isDark: true
138+ )
139+ ) ,
140+ environment: { } ,
141+ containerSize: CGSize ( width: availableSize. width - 16.0 * 2.0 , height: 44.0 )
142+ )
143+ if let buttonsView = self . buttons. view {
144+ if buttonsView. superview == nil {
145+ self . addSubview ( buttonsView)
146+ }
147+ transition. setFrame ( view: buttonsView, frame: CGRect ( origin: CGPoint ( x: floor ( ( availableSize. width - buttonsSize. width) * 0.5 ) , y: contentHeight) , size: buttonsSize) )
148+ }
149+ contentHeight += buttonsSize. height
150+
113151 let titleString = NSMutableAttributedString ( )
114152 titleString. append ( NSAttributedString ( string: environment. strings. VideoChat_ScheduleButtonTitle, font: Font . semibold ( 17.0 ) , textColor: environment. theme. list. itemPrimaryTextColor) )
115153
@@ -126,9 +164,8 @@ private final class ScheduleVideoChatSheetContentComponent: Component {
126164 if titleView. superview == nil {
127165 self . addSubview ( titleView)
128166 }
129- transition. setFrame ( view: titleView, frame: CGRect ( origin: CGPoint ( x: floor ( ( availableSize. width - titleSize. width) * 0.5 ) , y: contentHeight) , size: titleSize) )
167+ transition. setFrame ( view: titleView, frame: CGRect ( origin: CGPoint ( x: floor ( ( availableSize. width - titleSize. width) * 0.5 ) , y: contentHeight - buttonsSize . height * 0.5 - titleSize . height * 0.5 ) , size: titleSize) )
130168 }
131- contentHeight += titleSize. height
132169 contentHeight += 16.0
133170
134171 let pickerView : UIDatePicker
@@ -221,17 +258,20 @@ private final class ScheduleVideoChatSheetContentComponent: Component {
221258 transition. setFrame ( view: mainTextView, frame: CGRect ( origin: CGPoint ( x: floor ( ( availableSize. width - mainTextSize. width) * 0.5 ) , y: contentHeight) , size: mainTextSize) )
222259 }
223260 contentHeight += mainTextSize. height
224- contentHeight += 10 .0
261+ contentHeight += 32 .0
225262
226263 var buttonContents : [ AnyComponentWithIdentity < Empty > ] = [ ]
227264 buttonContents. append ( AnyComponentWithIdentity ( id: AnyHashable ( 0 as Int ) , component: AnyComponent (
228265 Text ( text: buttonTitle, font: Font . semibold ( 17.0 ) , color: environment. theme. list. itemCheckColors. foregroundColor)
229266 ) ) )
230267 let buttonTransition = transition
231- let buttonSize = self . button. update (
268+
269+ let buttonInsets = ContainerViewLayout . concentricInsets ( bottomInset: environment. safeInsets. bottom, innerDiameter: 52.0 , sideInset: 30.0 )
270+ let buttonSize = self . actionButton. update (
232271 transition: buttonTransition,
233272 component: AnyComponent ( ButtonComponent (
234273 background: ButtonComponent . Background (
274+ style: . glass,
235275 color: UIColor ( rgb: 0x3252EF ) ,
236276 foreground: . white,
237277 pressedColor: UIColor ( rgb: 0x3252EF ) . withMultipliedAlpha ( 0.8 )
@@ -250,56 +290,17 @@ private final class ScheduleVideoChatSheetContentComponent: Component {
250290 }
251291 ) ) ,
252292 environment: { } ,
253- containerSize: CGSize ( width: availableSize. width - sideInset * 2.0 , height: 50 .0)
293+ containerSize: CGSize ( width: availableSize. width - buttonInsets . left - buttonInsets . right , height: 52 .0)
254294 )
255- let buttonFrame = CGRect ( origin: CGPoint ( x: sideInset , y: contentHeight) , size: buttonSize)
256- if let buttonView = self . button . view {
295+ let buttonFrame = CGRect ( origin: CGPoint ( x: buttonInsets . left , y: contentHeight) , size: buttonSize)
296+ if let buttonView = self . actionButton . view {
257297 if buttonView. superview == nil {
258298 self . addSubview ( buttonView)
259299 }
260300 transition. setFrame ( view: buttonView, frame: buttonFrame)
261301 }
262302 contentHeight += buttonSize. height
263- contentHeight += 10.0
264-
265- let cancelButtonSize = self . cancelButton. update (
266- transition: buttonTransition,
267- component: AnyComponent ( ButtonComponent (
268- background: ButtonComponent . Background (
269- color: UIColor ( rgb: 0x2B2B2F ) ,
270- foreground: . white,
271- pressedColor: UIColor ( rgb: 0x2B2B2F ) . withMultipliedAlpha ( 0.8 )
272- ) ,
273- content: AnyComponentWithIdentity ( id: AnyHashable ( 0 as Int ) , component: AnyComponent (
274- Text ( text: environment. strings. Common_Cancel, font: Font . semibold ( 17.0 ) , color: environment. theme. list. itemPrimaryTextColor)
275- ) ) ,
276- isEnabled: true ,
277- tintWhenDisabled: false ,
278- displaysProgress: false ,
279- action: { [ weak self] in
280- guard let self, let component = self . component else {
281- return
282- }
283- component. dismiss ( )
284- }
285- ) ) ,
286- environment: { } ,
287- containerSize: CGSize ( width: availableSize. width - sideInset * 2.0 , height: 50.0 )
288- )
289- let cancelButtonFrame = CGRect ( origin: CGPoint ( x: sideInset, y: contentHeight) , size: cancelButtonSize)
290- if let cancelButtonView = self . cancelButton. view {
291- if cancelButtonView. superview == nil {
292- self . addSubview ( cancelButtonView)
293- }
294- transition. setFrame ( view: cancelButtonView, frame: cancelButtonFrame)
295- }
296- contentHeight += cancelButtonSize. height
297-
298- if environment. safeInsets. bottom. isZero {
299- contentHeight += 16.0
300- } else {
301- contentHeight += environment. safeInsets. bottom + 14.0
302- }
303+ contentHeight += buttonInsets. bottom
303304
304305 return CGSize ( width: availableSize. width, height: contentHeight)
305306 }
@@ -407,7 +408,8 @@ private final class ScheduleVideoChatSheetScreenComponent: Component {
407408 } )
408409 }
409410 ) ) ,
410- backgroundColor: . color( UIColor ( rgb: 0x1C1C1E ) ) ,
411+ style: . glass,
412+ backgroundColor: . color( UIColor ( rgb: 0x1c1c1e ) ) ,
411413 animateOut: self . sheetAnimateOut
412414 ) ) ,
413415 environment: {
0 commit comments