-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply filtering on custom lists #5980
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @mojganii)
ios/MullvadVPN/View controllers/SelectLocation/CustomListsDataSource.swift
line 28 at r1 (raw file):
/// Constructs a collection of node trees by copying each matching counterpart /// from the complete list of nodes created in ``AllLocationDataSource``. func reload(allLocationNodes: [LocationNode], isFiltered: Bool) {
Nit: This change can be made much smaller by changing the original code from ...fetchAll().map
to ...fetchAll().compactMap
and ... (see below)
ios/MullvadVPN/View controllers/SelectLocation/CustomListsDataSource.swift
line 51 at r1 (raw file):
} // Indicates if the relays are filtered by ``Ownership`` or ``Provider``, node should be added while it has children
... and:
if isFiltered && listNode.children.isEmpty {
return nil
} else {
return listNode
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mojganii)
ios/MullvadVPN/View controllers/SelectLocation/CustomListsDataSource.swift
line 28 at r1 (raw file):
Previously, rablador (Jon Petersson) wrote…
Nit: This change can be made much smaller by changing the original code from
...fetchAll().map
to...fetchAll().compactMap
and ... (see below)
Nit: This change can be made much smaller by changing the original code to use a compactMap instead.
Code snippet:
nodes = repository.fetchAll().compactMap { list in
[...]
// Indicates if the relays are filtered by ``Ownership`` or ``Provider``, node should be added while it has children
if isFiltered && listNode.children.isEmpty {
return nil
} else {
return listNode
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mojganii)
ios/MullvadVPN/View controllers/SelectLocation/CustomListsDataSource.swift
line 28 at r1 (raw file):
/// Constructs a collection of node trees by copying each matching counterpart /// from the complete list of nodes created in ``AllLocationDataSource``. func reload(allLocationNodes: [LocationNode], isFiltered: Bool) {
Nit: This change can be made much smaller by changing the original code to use a compactMap instead.
Code snippet:
nodes = repository.fetchAll().compactMap { list in
[...]
// Indicates if the relays are filtered by ``Ownership`` or ``Provider``, node should be added while it has children
if isFiltered && listNode.children.isEmpty {
return nil
} else {
return listNode
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mojganii)
b248cb3
to
c426ab9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @rablador)
ios/MullvadVPN/View controllers/SelectLocation/CustomListsDataSource.swift
line 28 at r1 (raw file):
Previously, rablador (Jon Petersson) wrote…
Nit: This change can be made much smaller by changing the original code to use a compactMap instead.
Considered
ios/MullvadVPN/View controllers/SelectLocation/CustomListsDataSource.swift
line 51 at r1 (raw file):
Previously, rablador (Jon Petersson) wrote…
... and:
if isFiltered && listNode.children.isEmpty { return nil } else { return listNode }
Indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved
49aefbe
to
6ca1714
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r1, 1 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved
6ca1714
to
e108acb
Compare
When a filter is applied, the custom lists should only display items that match the specified constraints. Any items that do not meet these constraints should be excluded from the list.
This change is