diff options
4 files changed, 17 insertions, 16 deletions
diff --git a/ios/CHANGELOG.md b/ios/CHANGELOG.md index 46c914a0bd..a5f6ec62fc 100644 --- a/ios/CHANGELOG.md +++ b/ios/CHANGELOG.md @@ -24,6 +24,7 @@ Line wrap the file at 100 chars. Th ## [Unreleased] ### Added - Add UDP-over-TCP WireGuard obfuscation. +- Add custom API access methods. ## [2023.7 - 2023-11-23] ### Added diff --git a/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift b/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift index d06a804d3b..df519f9c12 100644 --- a/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift +++ b/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift @@ -17,16 +17,20 @@ struct ListAccessMethodInteractor: ListAccessMethodInteractorProtocol { self.repository = repository } - var itemsPublisher: any Publisher<[ListAccessMethodItem], Never> { - repository.accessMethodsPublisher.map { methods in - methods.map { $0.toListItem() } - } + var itemsPublisher: AnyPublisher<[ListAccessMethodItem], Never> { + repository.accessMethodsPublisher + .receive(on: RunLoop.main) + .map { methods in + methods.map { $0.toListItem() } + } + .eraseToAnyPublisher() } - var itemInUsePublisher: any Publisher<ListAccessMethodItem?, Never> { - repository.lastReachableAccessMethodPublisher.map { method in - method.toListItem() - } + var itemInUsePublisher: AnyPublisher<ListAccessMethodItem?, Never> { + repository.lastReachableAccessMethodPublisher + .receive(on: RunLoop.main) + .map { $0.toListItem() } + .eraseToAnyPublisher() } func item(by id: UUID) -> ListAccessMethodItem? { diff --git a/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractorProtocol.swift b/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractorProtocol.swift index 91e766341b..2ae28062b9 100644 --- a/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractorProtocol.swift +++ b/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractorProtocol.swift @@ -12,10 +12,10 @@ import MullvadSettings /// Types describing API access list interactor. protocol ListAccessMethodInteractorProtocol { /// Publisher that produces a list of method items upon persistent store modifications. - var itemsPublisher: any Publisher<[ListAccessMethodItem], Never> { get } + var itemsPublisher: AnyPublisher<[ListAccessMethodItem], Never> { get } /// Publisher that produces the last reachable method item upon persistent store modifications. - var itemInUsePublisher: any Publisher<ListAccessMethodItem?, Never> { get } + var itemInUsePublisher: AnyPublisher<ListAccessMethodItem?, Never> { get } /// Returns an item by id. func item(by id: UUID) -> ListAccessMethodItem? diff --git a/ios/MullvadVPN/View controllers/Settings/SettingsDataSource.swift b/ios/MullvadVPN/View controllers/Settings/SettingsDataSource.swift index 71c493b7c8..39b8d0835a 100644 --- a/ios/MullvadVPN/View controllers/Settings/SettingsDataSource.swift +++ b/ios/MullvadVPN/View controllers/Settings/SettingsDataSource.swift @@ -146,17 +146,13 @@ final class SettingsDataSource: UITableViewDiffableDataSource<SettingsDataSource private func updateDataSnapshot() { var snapshot = NSDiffableDataSourceSnapshot<Section, Item>() + snapshot.appendSections([.main]) + if interactor.deviceState.isLoggedIn { - snapshot.appendSections([.main]) snapshot.appendItems([.preferences], toSection: .main) } - #if DEBUG - if !snapshot.sectionIdentifiers.contains(.main) { - snapshot.appendSections([.main]) - } snapshot.appendItems([.apiAccess], toSection: .main) - #endif #if DEBUG snapshot.appendItems([.ipOverride], toSection: .main) |
