@@ -21,6 +21,7 @@ import ListSectionComponent
2121import TelegramStringFormatting
2222import MediaEditor
2323import UrlEscaping
24+ import GlassBarButtonComponent
2425
2526private let linkTag = GenericComponentViewTag ( )
2627private let nameTag = GenericComponentViewTag ( )
@@ -69,8 +70,8 @@ private final class SheetContent: CombinedComponent {
6970
7071 static var body : Body {
7172 let background = Child ( RoundedRectangle . self)
72- let cancelButton = Child ( Button . self)
73- let doneButton = Child ( Button . self)
73+ let cancelButton = Child ( GlassBarButtonComponent . self)
74+ let doneButton = Child ( GlassBarButtonComponent . self)
7475 let title = Child ( Text . self)
7576 let urlSection = Child ( ListSectionComponent . self)
7677 let nameSection = Child ( ListSectionComponent . self)
@@ -85,7 +86,7 @@ private final class SheetContent: CombinedComponent {
8586 let presentationData = component. context. sharedContext. currentPresentationData. with { $0 }
8687
8788 let sideInset : CGFloat = 16.0
88- var contentSize = CGSize ( width: context. availableSize. width, height: 18 .0)
89+ var contentSize = CGSize ( width: context. availableSize. width, height: 36 .0)
8990
9091 let background = background. update (
9192 component: RoundedRectangle ( color: theme. list. blocksBackgroundColor, cornerRadius: 8.0 ) ,
@@ -98,24 +99,28 @@ private final class SheetContent: CombinedComponent {
9899
99100 let constrainedTitleWidth = context. availableSize. width - 16.0 * 2.0
100101
102+ let barButtonSize = CGSize ( width: 40.0 , height: 40.0 )
101103 let cancelButton = cancelButton. update (
102- component: Button (
103- content: AnyComponent (
104- Text (
105- text: strings. Common_Cancel,
106- font: Font . regular ( 17.0 ) ,
107- color: theme. actionSheet. controlAccentColor
104+ component: GlassBarButtonComponent (
105+ size: barButtonSize,
106+ backgroundColor: theme. rootController. navigationBar. glassBarButtonBackgroundColor,
107+ isDark: theme. overallDarkAppearance,
108+ state: . generic,
109+ component: AnyComponentWithIdentity ( id: " close " , component: AnyComponent (
110+ BundleIconComponent (
111+ name: " Navigation/Close " ,
112+ tintColor: theme. rootController. navigationBar. glassBarButtonForegroundColor
108113 )
109- ) ,
110- action: {
114+ ) ) ,
115+ action: { _ in
111116 component. dismiss ( )
112117 }
113118 ) ,
114119 availableSize: context. availableSize,
115120 transition: . immediate
116121 )
117122 context. add ( cancelButton
118- . position ( CGPoint ( x: sideInset + cancelButton. size. width / 2.0 , y: contentSize . height + cancelButton. size. height / 2.0 ) )
123+ . position ( CGPoint ( x: sideInset + cancelButton. size. width / 2.0 , y: 16.0 + cancelButton. size. height / 2.0 ) )
119124 )
120125
121126 let explicitLink = explicitUrl ( context. component. link)
@@ -126,16 +131,19 @@ private final class SheetContent: CombinedComponent {
126131
127132 let controller = environment. controller
128133 let doneButton = doneButton. update (
129- component: Button (
130- content: AnyComponent (
131- Text (
132- text: strings. Common_Done,
133- font: Font . bold ( 17.0 ) ,
134- color: isValidLink ? theme. actionSheet. controlAccentColor : theme. actionSheet. secondaryTextColor
135- )
136- ) ,
134+ component: GlassBarButtonComponent (
135+ size: barButtonSize,
136+ backgroundColor: isValidLink ? environment. theme. list. itemCheckColors. fillColor : environment. theme. list. itemCheckColors. fillColor. desaturated ( ) . withMultipliedAlpha ( 0.5 ) ,
137+ isDark: environment. theme. overallDarkAppearance,
138+ state: . tintedGlass,
137139 isEnabled: isValidLink,
138- action: { [ weak state] in
140+ component: AnyComponentWithIdentity ( id: " done " , component: AnyComponent (
141+ BundleIconComponent (
142+ name: " Navigation/Done " ,
143+ tintColor: environment. theme. list. itemCheckColors. foregroundColor
144+ )
145+ ) ) ,
146+ action: { [ weak state] _ in
139147 if let controller = controller ( ) as? CreateLinkScreen , let state {
140148 if state. complete ( controller: controller) {
141149 component. dismiss ( )
@@ -147,17 +155,16 @@ private final class SheetContent: CombinedComponent {
147155 transition: . immediate
148156 )
149157 context. add ( doneButton
150- . position ( CGPoint ( x: context. availableSize. width - sideInset - doneButton. size. width / 2.0 , y: contentSize . height + doneButton. size. height / 2.0 ) )
158+ . position ( CGPoint ( x: context. availableSize. width - sideInset - doneButton. size. width / 2.0 , y: 16.0 + doneButton. size. height / 2.0 ) )
151159 )
152160
153-
154161 let title = title. update (
155162 component: Text ( text: component. isEdit ? strings. MediaEditor_Link_EditTitle : strings. MediaEditor_Link_CreateTitle, font: Font . bold ( 17.0 ) , color: theme. list. itemPrimaryTextColor) ,
156163 availableSize: CGSize ( width: constrainedTitleWidth, height: context. availableSize. height) ,
157164 transition: . immediate
158165 )
159166 context. add ( title
160- . position ( CGPoint ( x: context. availableSize. width / 2.0 , y: contentSize. height + title . size . height / 2.0 ) )
167+ . position ( CGPoint ( x: context. availableSize. width / 2.0 , y: contentSize. height) )
161168 )
162169 contentSize. height += title. size. height
163170 contentSize. height += 40.0
@@ -222,6 +229,7 @@ private final class SheetContent: CombinedComponent {
222229 let urlSection = urlSection. update (
223230 component: ListSectionComponent (
224231 theme: theme,
232+ style: . glass,
225233 header: AnyComponent ( MultilineTextComponent (
226234 text: . plain( NSAttributedString (
227235 string: strings. MediaEditor_Link_LinkTo_Title. uppercased ( ) ,
@@ -249,6 +257,7 @@ private final class SheetContent: CombinedComponent {
249257 let nameSection = nameSection. update (
250258 component: ListSectionComponent (
251259 theme: theme,
260+ style: . glass,
252261 header: AnyComponent ( MultilineTextComponent (
253262 text: . plain( NSAttributedString (
254263 string: strings. MediaEditor_Link_LinkName_Title. uppercased ( ) ,
@@ -542,6 +551,7 @@ private final class CreateLinkSheetComponent: CombinedComponent {
542551 } )
543552 }
544553 ) ) ,
554+ style: . glass,
545555 backgroundColor: . blur( . dark) ,
546556 followContentSizeChanges: true ,
547557 clipsContent: true ,
@@ -816,7 +826,7 @@ private final class LinkFieldComponent: Component {
816826 containerSize: availableSize
817827 )
818828
819- let size = CGSize ( width: availableSize. width, height: 44 .0)
829+ let size = CGSize ( width: availableSize. width, height: 52 .0)
820830 if let placeholderComponentView = self . placeholderView. view {
821831 if placeholderComponentView. superview == nil {
822832 self . insertSubview ( placeholderComponentView, at: 0 )
@@ -827,7 +837,7 @@ private final class LinkFieldComponent: Component {
827837 placeholderComponentView. isHidden = !component. text. isEmpty
828838 }
829839
830- self . textField. frame = CGRect ( x: 15.0 , y: 0 .0, width: size. width - 30.0 , height: 44.0 )
840+ self . textField. frame = CGRect ( x: 15.0 , y: 4 .0, width: size. width - 30.0 , height: 44.0 )
831841
832842 return size
833843 }
0 commit comments