Skip to content
Erik Gomez edited this page Aug 24, 2021 · 6 revisions

Introduction

While the user deferrals feature was technically available in v1.0.0 of Nudge, it was only calculated per active Nudge session. After closing Nudge and re-opening, the deferral count would be reset to 0.

With v1.1.0 and higher, user deferrals are now saved and maintained across the entirety of a Nudge event.

NSUserDefaults

Nudge saves the following keys in ~/Library/Preferences/com.github.macadmins.Nudge.plist

  • deferRunUntil
  • requiredMinimumOSVersion
  • userDeferrals
  • userQuitDeferrals
  • userSessionDeferrals

Resetting values when a new Nudge event is detected

When Nudge first opens up, it determines what Nudge event is configured for the and compares the requiredMinimumOSVersion key of the JSON/mobileconfiguration against requiredMinimumOSVersion key in NSUserDefaults.

If the value in your configuration is higher than the value in NSUserDefaults the following occurs:

  • Log event: New Nudge event detected - resetting all deferral values
  • deferRunUntil key is deleted
  • userDeferrals, userQuitDeferrals, userSessionDeferrals are reset to 0

Types of user deferrals

There are two types of user deferrals: session deferrals and quit deferrals.

  • Session deferrals are the amount of times Nudge was not the forefront application when the built-in nudge timer was passed.
    • The count is saved to userSessionDeferrals
  • Quit deferrals are the amount of times Nudge was exited out by the user
    • The count is saved to userQuitDeferrals

Session and Quit deferrals values are combined for all Nudge logic and saved to userDeferrals

Defer buttons

There are four buttons available to the user. The text is customizable following the updateElements key structure.

Behavior of Defer buttons

Notes

userQuitDeferrals and LaunchAgent behavior

It is very likely that your LaunchAgent timing will no longer occur when utilizing userQuitDeferrals. For instance, if you have Nudge set to launch every 30 minutes, but a user has deferred for a day, you will lose up to 24 nudge events. If you do not want this behavior, it is recommended to disable user deferrals with the allowUserQuitDeferrals key.

Timestamps and logging

When utilizing the Nudge Logging LaunchDaemon, the log events are always saved with the machine's local time, while Nudge calculates and saves all time via UTC (GMT timezone). This is a cosmetic issue.

Testing and resetting Nudge

If you are an admin and want to reset Nudge's user deferral behavior, simple run the following command via Terminal

defaults delete ~/Library/Preferences/com.github.macadmins.Nudge.plist
Clone this wiki locally