@@ -33,7 +33,7 @@ class ComposerUIView: UIView {
3333
3434 @IBOutlet weak var fromField : UILabel !
3535 @IBOutlet weak var fromButton : UIButton !
36- @IBOutlet weak var fromMenuView : BottomMenuView !
36+ @IBOutlet weak var accountOptionsView : MoreOptionsUIView !
3737
3838 @IBOutlet weak var separatorView : UIView !
3939 @IBOutlet weak var arrowButton : UIButton !
@@ -61,6 +61,7 @@ class ComposerUIView: UIView {
6161 var collapsed = false
6262 weak var myAccount : Account !
6363 var checkedDomains : [ String : Bool ] = Utils . defaultDomains
64+ var accountOptionsInterface : AccountOptionsInterface ?
6465
6566 var theme : Theme {
6667 return ThemeManager . shared. theme
@@ -98,7 +99,6 @@ class ComposerUIView: UIView {
9899
99100 toField. becomeFirstResponder ( )
100101
101- fromMenuView. delegate = self
102102 applyTheme ( )
103103 }
104104
@@ -121,7 +121,7 @@ class ComposerUIView: UIView {
121121 subjectTextField. backgroundColor = theme. background
122122 subjectTextField. textColor = theme. mainText
123123 subjectTextField. attributedPlaceholder = NSAttributedString ( string: String . localize ( " SUBJECT " ) , attributes: [ . foregroundColor: theme. mainText, . font: Font . regular. size ( subjectTextField. minimumFontSize) !] )
124- scrollView. backgroundColor = theme . background
124+ scrollView. backgroundColor = UIColor . red
125125 attachmentsTableView. backgroundColor = theme. background
126126 contactsTableView. backgroundColor = theme. background
127127 editorView. webView. backgroundColor = theme. background
@@ -136,22 +136,25 @@ class ComposerUIView: UIView {
136136 navigationBar. isTranslucent = false
137137 }
138138
139- func setFrom( account: Account , emails: [ String ] ) {
140- fromButton. isHidden = emails. count == 0
139+ func setFrom( account: Account ) {
140+ let accounts = Array ( SharedDB . getAccounts ( ignore: account. username) )
141+ fromButton. isHidden = accounts. count == 0
141142 let attributedFrom = NSMutableAttributedString ( string: " \( String . localize ( " FROM " ) ) : " , attributes: [ . font: Font . bold. size ( 15 ) !] )
142143 let attributedEmail = NSAttributedString ( string: account. email, attributes: [ . font: Font . regular. size ( 15 ) !] )
143144 attributedFrom. append ( attributedEmail)
144- fromMenuView. isUserInteractionEnabled = false
145- fromMenuView. initialLoad ( options: emails)
145+
146146 fromField. attributedText = attributedFrom
147147 fromButton. setImage ( UIImage ( named: " icon-down " ) , for: . normal)
148+
149+ accountOptionsInterface = AccountOptionsInterface ( accounts: accounts)
150+ accountOptionsInterface? . delegate = self
151+ accountOptionsView. setDelegate ( newDelegate: accountOptionsInterface!)
148152 self . myAccount = account
149153 }
150154
151155 @IBAction func didPressFrom( _ sender: Any ) {
152- fromMenuView. isUserInteractionEnabled = true
153- fromMenuView. toggleMenu ( true )
154156 fromButton. setImage ( UIImage ( named: " icon-up " ) , for: . normal)
157+ accountOptionsView. showMoreOptions ( )
155158
156159 self . toField. endEditing ( )
157160 self . ccField. endEditing ( )
@@ -325,7 +328,7 @@ extension ComposerUIView: CLTokenInputViewDelegate {
325328
326329 func tokenInputViewDidEndEditing( _ view: CLTokenInputView ) {
327330
328- // self.contactTableView .isHidden = true
331+ self . contactsTableView . isHidden = true
329332
330333 guard let text = view. text, text. count > 0 else {
331334 return
@@ -343,14 +346,18 @@ extension ComposerUIView: CLTokenInputViewDelegate {
343346 }
344347}
345348
346- extension ComposerUIView : BottomMenuDelegate {
347- func didPressOption( _ option: String ) {
348- delegate? . setAccount ( accountId: option)
349+ extension ComposerUIView : AccountOptionsInterfaceDelegate {
350+ func onClose( ) {
351+ fromButton. setImage ( UIImage ( named: " icon-down " ) , for: . normal)
352+ accountOptionsView. closeMoreOptions ( )
349353 }
350354
351- func didPressBackground( ) {
352- fromMenuView. isUserInteractionEnabled = false
353- self . fromMenuView. toggleMenu ( false )
355+ func accountSelected( account: Account ) {
354356 fromButton. setImage ( UIImage ( named: " icon-down " ) , for: . normal)
357+ accountOptionsView. closeMoreOptions ( )
358+ guard !account. isInvalidated else {
359+ return
360+ }
361+ self . setFrom ( account: account)
355362 }
356363}
0 commit comments