From 1099da8741942d77afb590d93da81bef3ab443cb Mon Sep 17 00:00:00 2001 From: Erik Gomez Date: Wed, 14 Feb 2024 09:58:04 -0600 Subject: [PATCH] fix gracePeriodInstallDelay --- Nudge/Utilities/Utils.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Nudge/Utilities/Utils.swift b/Nudge/Utilities/Utils.swift index 08d2c8e9..07618caa 100644 --- a/Nudge/Utilities/Utils.swift +++ b/Nudge/Utilities/Utils.swift @@ -78,18 +78,21 @@ struct AppStateManager { LogManager.info("Device within gracePeriodLaunchDelay, exiting Nudge", logger: uiLog) nudgePrimaryState.shouldExit = true return currentDate + } else { + LogManager.info("gracePeriodPath (\(UserExperienceVariables.gracePeriodPath)) outside of gracePeriodLaunchDelay (\(UserExperienceVariables.gracePeriodLaunchDelay)) - File age is \(gracePeriodPathCreationTimeInHours) hours", logger: uiLog) } if UserExperienceVariables.gracePeriodInstallDelay > gracePeriodPathCreationTimeInHours { - let newDate = gracePeriodPathCreationDate.addingTimeInterval(Double(combinedGracePeriod) * 3600) - LogManager.notice("Device permitted for gracePeriods - setting date to: \(newDate)", logger: uiLog) - return newDate + requiredInstallationDate = gracePeriodPathCreationDate.addingTimeInterval(Double(combinedGracePeriod) * 3600) + LogManager.notice("Device permitted for gracePeriods - setting date to: \(requiredInstallationDate)", logger: uiLog) + return requiredInstallationDate } } return PrefsWrapper.requiredInstallationDate } + func exitNudge() { LogManager.notice("Nudge is terminating due to condition met", logger: uiLog) nudgePrimaryState.shouldExit = true @@ -145,7 +148,7 @@ struct AppStateManager { let gracePeriodPath = UserExperienceVariables.gracePeriodPath guard FileManager.default.fileExists(atPath: gracePeriodPath) || CommandLineUtilities().unitTestingEnabled(), let gracePeriodPathCreationDate = getCreationDateForPath(gracePeriodPath, testFileDate: testFileDate) else { - LogManager.error("Grace period path not found or unable to get creation date - bypassing allowGracePeriods logic", logger: uiLog) + LogManager.error("Grace period path \(UserExperienceVariables.gracePeriodPath) not found or unable to get creation date - bypassing allowGracePeriods logic", logger: uiLog) return PrefsWrapper.requiredInstallationDate }