Skip to content

Commit

Permalink
Enable API access methods for release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Petersson authored and buggmagnet committed Jan 31, 2024
1 parent c571e4c commit 1c461b4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1c461b4

Please sign in to comment.