amplify icon indicating copy to clipboard operation
amplify copied to clipboard

Add time factor adjustment for debug testing

Open btkelly opened this issue 10 years ago • 5 comments

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.

btkelly avatar Jan 04 '16 21:01 btkelly

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 ?

stkent avatar Jan 19 '16 14:01 stkent

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.

stkent avatar Jan 19 '16 14:01 stkent

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.

btkelly avatar Jan 19 '16 14:01 btkelly

Hmm, but both those suggestions mess up configureWithDefaults...

stkent avatar Jan 19 '16 14:01 stkent

Good thought r.e. debug prefix! Will think on that.

stkent avatar Jan 19 '16 14:01 stkent