Skip to content
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

storing custom list into settings #5782

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

mojganii
Copy link
Collaborator

@mojganii mojganii commented Feb 7, 2024

Storing custom lists in settings enhances the app's ability to access user preferences for relay connections.


This change is Reviewable

@mojganii mojganii added the iOS Issues related to iOS label Feb 7, 2024
Copy link

linear bot commented Feb 7, 2024

@mojganii mojganii self-assigned this Feb 7, 2024
Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @mojganii)


ios/MullvadSettings/CustomList.swift line 15 at r1 (raw file):

    public let id: UUID
    public var name: String
    public var list: [RelayLocation] = []

How do we know the heirarchy here? A custom list can have nested items, eg:

Code snippet:

[
   Country,
   Country: [
      City: [
         Relay: {}
      ],
      City: [
         Relay: {},
         Relay: {}
      ]
   ]
]

ios/MullvadSettings/CustomListRepository.swift line 51 at r1 (raw file):

            }
        } catch {
            throw error

Nit: If all we do is rethrow the error I think we can remove the do-catch. Alternatively we can add a logger message as well and keep it.


ios/MullvadSettings/CustomListRepositoryProtocol.swift line 20 at r1 (raw file):

    func update(_ list: CustomList)

    /// Delete custom list  by id.

Nit: Extra spacing here and in a few texts below.


ios/MullvadVPNTests/CustomListRepositoryTests.swift line 66 at r1 (raw file):

    }

    func testFetchingAllCustomList() throws {

Nit: Maybe we could add more than one list here to check that it works with multiple lists.

@mojganii mojganii force-pushed the store-custom-lists-in-settings-ios-464 branch from a2bab4b to 5f00efb Compare February 8, 2024 10:32
Copy link
Collaborator Author

@mojganii mojganii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 of 6 files reviewed, 2 unresolved discussions (waiting on @rablador)


ios/MullvadSettings/CustomList.swift line 15 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

How do we know the heirarchy here? A custom list can have nested items, eg:

in the current code LocationDataSource is passing RelayLocation to tunnel manager to set matched relay for connecting and when user expands the the node it's looking for children.hence It means it's enough to have access to hierarchy


ios/MullvadSettings/CustomListRepository.swift line 51 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

Nit: If all we do is rethrow the error I think we can remove the do-catch. Alternatively we can add a logger message as well and keep it.

the error should be shown in the UI; therefore, it needs to be thrown to be caught by the presentation layer.


ios/MullvadSettings/CustomListRepositoryProtocol.swift line 20 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

Nit: Extra spacing here and in a few texts below.

Done


ios/MullvadVPNTests/CustomListRepositoryTests.swift line 66 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

Nit: Maybe we could add more than one list here to check that it works with multiple lists.

Done

@mojganii mojganii force-pushed the store-custom-lists-in-settings-ios-464 branch 2 times, most recently from 19f7e1e to 66e3c8a Compare February 8, 2024 10:52
Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 3 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@acb-mv acb-mv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@rablador rablador left a 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/MullvadSettings/CustomListRepository.swift line 26 at r3 (raw file):

public struct CustomListRepository: CustomListRepositoryProtocol {
    public var publisher: AnyPublisher<[CustomList], Never> {

I don't think we need a publisher at this point, since we don't know yet how the repository will interact with the rest of the code. If needed, we can add one later and make use of it then.

Copy link
Contributor

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 6 files at r1, 2 of 3 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @mojganii and @rablador)


ios/MullvadSettings/CustomListRepository.swift line 20 at r3 (raw file):

        switch self {
        case .duplicateName:
            "Name is already taken."

If this is a user facing error, let's localize it


ios/MullvadSettings/CustomListRepository.swift line 26 at r3 (raw file):

Previously, rablador (Jon Petersson) wrote…

I don't think we need a publisher at this point, since we don't know yet how the repository will interact with the rest of the code. If needed, we can add one later and make use of it then.

I agree with @rablador, can we make it work without Combine here ?
We had some challenges when building API Access methods because of Combine, so I'd like to avoid future pain if we can avoid it, unless you feel it will make upcoming development much easier to manage.


ios/MullvadVPNTests/CustomListRepositoryTests.swift line 40 at r3 (raw file):

    func testAddingCustomList() throws {
        let name = "Netflix"

nit
I think we can rename this customListName to make it even more explicit.

Same with item below, we could name it customList

I like some of the examples by the way, I think it's nice that they represent how a user would use the API like in testFetchingAllCustomList 👍

@mojganii mojganii force-pushed the store-custom-lists-in-settings-ios-464 branch from 66e3c8a to 22b9142 Compare February 8, 2024 17:30
Copy link
Collaborator Author

@mojganii mojganii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 5 of 6 files reviewed, 3 unresolved discussions (waiting on @buggmagnet and @rablador)


ios/MullvadSettings/CustomListRepository.swift line 20 at r3 (raw file):

Previously, buggmagnet wrote…

If this is a user facing error, let's localize it

done


ios/MullvadSettings/CustomListRepository.swift line 26 at r3 (raw file):

Previously, buggmagnet wrote…

I agree with @rablador, can we make it work without Combine here ?
We had some challenges when building API Access methods because of Combine, so I'd like to avoid future pain if we can avoid it, unless you feel it will make upcoming development much easier to manage.

Let's keep it for UI I would remove that if I saw I don't need that anymore. at the moment it's more likely to need that

Copy link
Contributor

@rablador rablador left a 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 r4, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @buggmagnet and @mojganii)

Copy link
Contributor

@rablador rablador left a 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, 3 unresolved discussions (waiting on @buggmagnet and @mojganii)


ios/MullvadSettings/CustomListRepository.swift line 26 at r3 (raw file):

Previously, mojganii wrote…

Let's keep it for UI I would remove that if I saw I don't need that anymore. at the moment it's more likely to need that

I don't think we should keep things around in anticipation that we might need it. Better to add when we actually have evidence that we do.

@rablador rablador force-pushed the store-custom-lists-in-settings-ios-464 branch from 22b9142 to f411158 Compare February 15, 2024 12:26
Copy link
Contributor

@rablador rablador left a 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 r5, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @buggmagnet and @mojganii)

Copy link
Contributor

@buggmagnet buggmagnet left a 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 r4, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @mojganii)

Copy link
Contributor

@rablador rablador left a 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)

@buggmagnet buggmagnet force-pushed the store-custom-lists-in-settings-ios-464 branch from f411158 to e79f029 Compare February 16, 2024 09:59
@buggmagnet buggmagnet merged commit 1a6cc86 into main Feb 16, 2024
4 of 5 checks passed
@buggmagnet buggmagnet deleted the store-custom-lists-in-settings-ios-464 branch February 16, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS Issues related to iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants