-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMyProfilePageViewModel.swift
42 lines (35 loc) · 1.08 KB
/
MyProfilePageViewModel.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// MyProfilePageViewModel.swift
// Commun
//
// Created by Chung Tran on 12/3/19.
// Copyright © 2019 Commun Limited. All rights reserved.
//
import Foundation
import RxSwift
class MyProfilePageViewModel: UserProfilePageViewModel {
lazy var subscriptionsVM = SubscriptionsViewModel.ofCurrentUserTypeCommunity
lazy var balancesVM = BalancesViewModel.ofCurrentUser
override init(userId: String? = nil, username: String? = nil, authorizationRequired: Bool = true) {
super.init(userId: userId, username: username)
defer {
balancesVM.update()
bindCurrentProfile()
}
}
func bindCurrentProfile() {
ResponseAPIContentGetProfile.observeCurrentProfile
.filter {$0 != nil}
.filter {$0 != self.profile.value}
.bind(to: profile)
.disposed(by: disposeBag)
}
override func reload() {
subscriptionsVM.reload()
balancesVM.update()
super.reload()
}
override func bindHighlightCommunities() {
// do nothing
}
}