Skip to content

Commit

Permalink
fix gracePeriodInstallDelay
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed Feb 14, 2024
1 parent 560afb4 commit 1099da8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Nudge/Utilities/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 1099da8

Please sign in to comment.