Implement FAB journeys & rough edge warnings element-ios#5226

- List of Space members with search
- Invite interactions
- Join room from list
- Implement add room button, with rough edge warning.
This commit is contained in:
Gil Eluard
2021-12-10 09:59:10 +01:00
parent 13382ac9bd
commit d0a6b2dd11
27 changed files with 335 additions and 32 deletions
@@ -0,0 +1,88 @@
//
// Copyright 2020 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
import Reusable
@objc
protocol AddItemHeaderViewDelegate: AnyObject {
func addItemHeaderView(_ headerView: AddItemHeaderView, didTapButton button: UIButton)
}
@objcMembers
final class AddItemHeaderView: UIView, NibLoadable, Themable {
// MARK: - Constants
private enum Constants {
static let buttonHighlightedAlpha: CGFloat = 0.2
}
// MARK: - Properties
@IBOutlet private weak var button: UIButton!
@IBOutlet private weak var iconBackgroundView: UIView!
@IBOutlet private weak var iconView: UIImageView!
@IBOutlet private weak var titleLabel: UILabel!
weak var delegate: AddItemHeaderViewDelegate?
private var title: String? {
didSet {
titleLabel.text = title
}
}
private var icon: UIImage? {
didSet {
iconView.image = icon
}
}
// MARK: - Setup
static func instantiate(title: String?, icon: UIImage?) -> AddItemHeaderView {
let view = AddItemHeaderView.loadFromNib()
view.icon = icon
view.title = title
view.update(theme: ThemeService.shared().theme)
return view
}
// MARK: - Life cycle
override func awakeFromNib() {
super.awakeFromNib()
button.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)
iconBackgroundView.layer.masksToBounds = true
iconBackgroundView.layer.cornerRadius = iconBackgroundView.bounds.width / 2
}
// MARK: - Public
func update(theme: Theme) {
iconBackgroundView.layer.backgroundColor = theme.colors.quinaryContent.cgColor
iconView.tintColor = theme.colors.secondaryContent
titleLabel.textColor = theme.colors.primaryContent
titleLabel.font = theme.fonts.headline
}
// MARK: - Action
@objc private func buttonAction(_ sender: UIButton) {
delegate?.addItemHeaderView(self, didTapButton: button)
}
}