2021-07-04 09:46:17 +00:00
|
|
|
//
|
|
|
|
// Copyright 2021 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 Foundation
|
|
|
|
import Reusable
|
|
|
|
|
2021-07-08 19:54:32 +00:00
|
|
|
class RoomNotificationSettingsAvatarView: UIView {
|
2021-07-04 09:46:17 +00:00
|
|
|
|
2021-07-26 10:02:38 +00:00
|
|
|
@IBOutlet weak var avatarView: RoomAvatarView!
|
2021-07-04 09:46:17 +00:00
|
|
|
@IBOutlet weak var nameLabel: UILabel!
|
|
|
|
|
2021-07-04 16:01:42 +00:00
|
|
|
func configure(viewData: AvatarViewDataProtocol) {
|
2021-07-26 10:02:38 +00:00
|
|
|
avatarView.fill(with: viewData)
|
2021-07-04 09:46:17 +00:00
|
|
|
|
2021-07-26 10:02:38 +00:00
|
|
|
switch viewData.fallbackImage {
|
|
|
|
case .matrixItem(_, let matrixItemDisplayName):
|
|
|
|
nameLabel.text = matrixItemDisplayName
|
|
|
|
default:
|
|
|
|
nameLabel.text = nil
|
2021-07-04 09:46:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-08 19:54:32 +00:00
|
|
|
|
|
|
|
extension RoomNotificationSettingsAvatarView: NibLoadable { }
|
|
|
|
extension RoomNotificationSettingsAvatarView: Themable {
|
|
|
|
func update(theme: Theme) {
|
|
|
|
nameLabel?.font = theme.fonts.title3SB
|
|
|
|
nameLabel?.textColor = theme.textPrimaryColor
|
|
|
|
}
|
|
|
|
}
|