Add time factor adjustment for debug testing
Allow the consumer to adjust what a day means in real time. For instance if I have the cool down set to 7 days but I want to test I would be able to set 1 day to 1 minute or something like that to allow for easy event testing.
Actually allowing a dilation would be pretty invasive; that dilation would need to be passed into individual event checks, as well as into the application checks manager. How do you feel rewriting all time-based methods to be based on seconds instead? Then debug testing would look something like
AmplifyStateTracker.get(this)
.setInstallTimeCooldownSeconds(BuildConfig.DEBUG ? 30 : TimeUnit.DAYS.toSeconds(7))
.trackLastEventTime(AmplifyViewEvent.USER_GAVE_CRITICAL_FEEDBACK,
new CooldownSecondsCheck(BuildConfig.DEBUG ? 30 : TimeUnit.DAYS.toSeconds(7)));
I thought about allowing both seconds-based and days-based methods, but they you'd need to calling different configuration methods in debug vs release modes...
Thoughts @btkelly ?
Alternatively, leave everything in days but allow fractional input; then we'd have something like
AmplifyStateTracker.get(this)
.setInstallTimeCooldownDays(BuildConfig.DEBUG ? TimeUnit.SECONDS.toDays(30) : 7)
.trackLastEventTime(AmplifyViewEvent.USER_GAVE_CRITICAL_FEEDBACK,
new CooldownDaysCheck(BuildConfig.DEBUG ? TimeUnit.SECONDS.toDays(30) : 7));
I think I like that better.
Not bad, I wonder if debug mode should set a prefix on all keys as well. Just to make sure the adjusted timings don't get screwed up by setting debug vs production.
Hmm, but both those suggestions mess up configureWithDefaults...
Good thought r.e. debug prefix! Will think on that.