Skip to content

Commit b5f9ea9

Browse files
author
Soner Yuksel
committed
Merge branch 'fix-free-accounts-pro-locations-are-disabled-main' into 'main'
Fix free accounts pro locations are disabled See merge request ws/client/iosapp!1002
1 parent ce0d7ae commit b5f9ea9

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Windscribe/ViewControllers/MainViewController/Components/Server List Cells/NodeTableViewCell.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,23 @@ class NodeTableViewCellModel: BaseNodeCellViewModel, NodeTableViewCellModelType
3838

3939
override var isSignalVisible: Bool { !isDisabled }
4040
override var isDisabled: Bool {
41-
return !(displayingGroup?.canConnect() ?? true)
41+
guard let displayingGroup else { return true }
42+
guard let session = sessionManager.session else { return true }
43+
44+
// If there is no best node means user cannot connect to this location
45+
if displayingGroup.bestNode == nil {
46+
// this can be because the user is free and the location is pro
47+
// and in that case we should just show it as pro location - it is not disabled
48+
if !session.isUserPro && displayingGroup.premiumOnly { return false }
49+
// if the locations has a node that is not best node check forceDisconnect
50+
// if it forces to disconnect then the location is disabled
51+
if let node = displayingGroup.nodes.first {
52+
return node.forceDisconnect
53+
}
54+
// this locations is disabled as all the reasons have been exausted
55+
return true
56+
}
57+
return false
4258
}
4359

4460
override var serverHealth: CGFloat {

0 commit comments

Comments
 (0)