From d90382708b19e7e03aba2641688ba5655d8ffdd6 Mon Sep 17 00:00:00 2001 From: Jon Petersson Date: Mon, 16 Oct 2023 11:17:25 +0200 Subject: [PATCH] Do not show change log when it is empty --- ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift | 9 +++++---- .../View controllers/ChangeLog/ChangeLogInteractor.swift | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift b/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift index a58603fb041a..f5fce3f250f1 100644 --- a/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift +++ b/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift @@ -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) } @@ -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 diff --git a/ios/MullvadVPN/View controllers/ChangeLog/ChangeLogInteractor.swift b/ios/MullvadVPN/View controllers/ChangeLog/ChangeLogInteractor.swift index 3e5a85007fbf..571eeaf7564b 100644 --- a/ios/MullvadVPN/View controllers/ChangeLog/ChangeLogInteractor.swift +++ b/ios/MullvadVPN/View controllers/ChangeLog/ChangeLogInteractor.swift @@ -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