File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Windscribe/ViewControllers/MainViewController/Components/Lists Header Views Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ class ServerInfoViewModel: ServerInfoViewModelType {
3232 self . localDatabase = localDatabase
3333 self . languageManager = languageManager
3434 localDatabase. getServersObservable ( ) . subscribe {
35- self . count = $0. count
35+ // Count total number of groups (cities/endpoints) across all servers
36+ self . count = $0. reduce ( 0 ) { $0 + $1. groups. count }
3637 self . serverCountSubject. onNext ( self . count)
3738 } . disposed ( by: disposeBag)
3839
@@ -50,7 +51,8 @@ class ServerInfoViewModel: ServerInfoViewModelType {
5051 func updateWithSearchCount( searchCount: Int ) {
5152 if searchCount >= 0 {
5253 self . serverCountSubject. onNext ( searchCount)
53- } else if let count = localDatabase. getServers ( ) ? . count {
54+ } else if let servers = localDatabase. getServers ( ) {
55+ let count = servers. reduce ( 0 ) { $0 + $1. groups. count }
5456 self . serverCountSubject. onNext ( count)
5557 }
5658 }
You can’t perform that action at this time.
0 commit comments