Skip to content

Commit

Permalink
Do not show change log when it is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Petersson authored and buggmagnet committed Oct 17, 2023
1 parent 9ea790f commit d903827
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
}

// Change log can be presented simultaneously with other routes.
if !appPreferences.isSeenLatestChanges {
if !appPreferences.hasSeenLastChanges {
routes.append(.changelog)
}

Expand Down Expand Up @@ -995,12 +995,13 @@ extension DeviceState {
}

fileprivate extension AppPreferencesDataSource {
var isSeenLatestChanges: Bool {
self.lastSeenChangeLogVersion == Bundle.main.shortVersion
var hasSeenLastChanges: Bool {
!ChangeLogInteractor().hasNewChanges ||
(lastSeenChangeLogVersion == Bundle.main.shortVersion)
}

mutating func markChangeLogSeen() {
self.lastSeenChangeLogVersion = Bundle.main.shortVersion
lastSeenChangeLogVersion = Bundle.main.shortVersion
}

// swiftlint:disable:next file_length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import MullvadLogging
final class ChangeLogInteractor {
private let logger = Logger(label: "ChangeLogInteractor")
private var items: [String] = []

var hasNewChanges: Bool {
!items.isEmpty
}

var viewModel: ChangeLogViewModel {
return ChangeLogViewModel(
body: items
Expand Down

0 comments on commit d903827

Please sign in to comment.