Commit 2f1a6a61 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

UI: smart list

display profile name if exists.

Change-Id: If2d8f2c730608098337ad0e470997e39488e5b3f
parent 001646dc
...@@ -181,6 +181,18 @@ class ConversationViewModel: Stateable, ViewModel { ...@@ -181,6 +181,18 @@ class ConversationViewModel: Stateable, ViewModel {
var userName = Variable<String>("") var userName = Variable<String>("")
lazy var bestName: Observable<String> = {
return Observable
.combineLatest(userName.asObservable(),
displayName.asObservable()) {(userName, displayname) in
guard let name = displayname,
!name.isEmpty else {
return userName
}
return name
}
}()
var profileImageData = Variable<Data?>(nil) var profileImageData = Variable<Data?>(nil)
var inviteButtonIsAvailable = BehaviorSubject(value: true) var inviteButtonIsAvailable = BehaviorSubject(value: true)
......
...@@ -88,7 +88,7 @@ class ConversationCell: UITableViewCell, NibReusable { ...@@ -88,7 +88,7 @@ class ConversationCell: UITableViewCell, NibReusable {
.disposed(by: self.disposeBag) .disposed(by: self.disposeBag)
// username // username
item.userName.asObservable() item.bestName.asObservable()
.observeOn(MainScheduler.instance) .observeOn(MainScheduler.instance)
.bind(to: self.nameLabel.rx.text) .bind(to: self.nameLabel.rx.text)
.disposed(by: self.disposeBag) .disposed(by: self.disposeBag)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment