Skip to content

Commit 505c6ed

Browse files
author
Soner Yuksel
committed
Merge branch 'soner/fix/3.9.6-bug-bash' into 'main' part section
Fix #839: All Locations” count mismatch with Desktop/Android See merge request ws/client/iosapp!1051
1 parent 48cadf1 commit 505c6ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Windscribe/ViewControllers/MainViewController/Components/Lists Header Views/ServerInfoView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)