DefaultIssueReportHistoryRepository
class DefaultIssueReportHistoryRepository(preferences: IssueReportHistoryDataSource, currentTimeMillis: () -> Long = System::currentTimeMillis) : IssueReportHistoryRepository(source)
Guards filing with the history in preferences: the time of the last filed report, and up to MAX_RECENT_REPORTS entries of a filing time and a SHA-256 fingerprint of the report's normalized title and description.
Times are wall-clock, because the guards must hold across reboots. A last report that appears to be in the future, after the clock was set back, does not hold the next one.
A failed read refuses nothing and a failed write is dropped, as the contract requires.
Parameters
currentTimeMillis
Wall clock, replaceable in tests.
Constructors
Link copied to clipboard
constructor(preferences: IssueReportHistoryDataSource, currentTimeMillis: () -> Long = System::currentTimeMillis)
Functions
Link copied to clipboard
Records a filed report, which starts the cooldown and refuses the same report for a day.
Link copied to clipboard
Why a report with title and description cannot be sent now, or null when it can.