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

Clone this wiki locally