@Test public void initially_can_request() { LocalCodeRequestRateLimiter limiter = new LocalCodeRequestRateLimiter(60_000); assertTrue(limiter.canRequest(RegistrationCodeRequest.Mode.SMS_WITHOUT_LISTENER, "+155512345678", 1000)); }
@MainThread public boolean canRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime) { Data data = dataMap.get(mode); return data == null || !data.limited(e164Number, currentTime); }
LocalCodeRequestRateLimiter implements Parcelable { @MainThread public boolean canRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime) { Data data = dataMap.get(mode); return data == null || !data.limited(e164Number, currentTime); } }
LocalCodeRequestRateLimiter implements Parcelable { @MainThread public boolean canRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime) { Data data = dataMap.get(mode); return data == null || !data.limited(e164Number, currentTime); } LocalCodeRequestRateLimiter(long timePeriod); }
LocalCodeRequestRateLimiter implements Parcelable { @MainThread public boolean canRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime) { Data data = dataMap.get(mode); return data == null || !data.limited(e164Number, currentTime); } LocalCodeRequestRateLimiter(long timePeriod); @MainThread boolean canRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime); @MainThread void onSuccessfulRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime); @MainThread void onUnsuccessfulRequest(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); }
LocalCodeRequestRateLimiter implements Parcelable { @MainThread public boolean canRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime) { Data data = dataMap.get(mode); return data == null || !data.limited(e164Number, currentTime); } LocalCodeRequestRateLimiter(long timePeriod); @MainThread boolean canRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime); @MainThread void onSuccessfulRequest(@NonNull RegistrationCodeRequest.Mode mode, @NonNull String e164Number, long currentTime); @MainThread void onUnsuccessfulRequest(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); static final Creator<LocalCodeRequestRateLimiter> CREATOR; }