mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Swift
		
	
| // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
 | |
| 
 | |
| import UIKit
 | |
| import SessionUIKit
 | |
| 
 | |
| final class InfoBanner: UIView {
 | |
|     init(message: String, backgroundColor: ThemeValue, messageLabelAccessibilityLabel: String? = nil) {
 | |
|         super.init(frame: CGRect.zero)
 | |
|         
 | |
|         setUpViewHierarchy(message: message, backgroundColor: backgroundColor, messageLabelAccessibilityLabel: messageLabelAccessibilityLabel)
 | |
|     }
 | |
|     
 | |
|     override init(frame: CGRect) {
 | |
|         preconditionFailure("Use init(message:) instead.")
 | |
|     }
 | |
|     
 | |
|     required init?(coder: NSCoder) {
 | |
|         preconditionFailure("Use init(coder:) instead.")
 | |
|     }
 | |
|     
 | |
|     private func setUpViewHierarchy(message: String, backgroundColor: ThemeValue, messageLabelAccessibilityLabel: String?) {
 | |
|         themeBackgroundColor = backgroundColor
 | |
|         
 | |
|         let label: UILabel = UILabel()
 | |
|         label.accessibilityLabel = messageLabelAccessibilityLabel
 | |
|         label.font = .boldSystemFont(ofSize: Values.smallFontSize)
 | |
|         label.text = message
 | |
|         label.themeTextColor = .textPrimary
 | |
|         label.textAlignment = .center
 | |
|         label.lineBreakMode = .byWordWrapping
 | |
|         label.numberOfLines = 0
 | |
|         addSubview(label)
 | |
|         
 | |
|         label.pin(to: self, withInset: Values.mediumSpacing)
 | |
|     }
 | |
| }
 |