Fix #2203: Require number of uploads not to have decimal (#2615)

This commit is contained in:
Adam Jones 2019-03-17 16:54:55 +00:00 committed by GitHub
parent 0b25730a18
commit 3b7b6f91a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 40 deletions

View file

@ -42,6 +42,10 @@ public class ContributionsSyncAdapter extends AbstractThreadedSyncAdapter {
private static final ContentValues[] EMPTY = {};
private static int COMMIT_THRESHOLD = 10;
// Arbitrary limit to cap the number of contributions to ever load. This is a maximum built
// into the app, rather than the user's setting. Also see Github issue #52.
public static final int ABSOLUTE_CONTRIBUTIONS_LOAD_LIMIT = 500;
@SuppressWarnings("WeakerAccess")
@Inject MediaWikiApi mwApi;
@Inject
@ -52,13 +56,6 @@ public class ContributionsSyncAdapter extends AbstractThreadedSyncAdapter {
super(context, autoInitialize);
}
private int getLimit() {
int limit = 500;
Timber.d("Max number of uploads set to %d", limit);
return limit; // FIXME: Parameterize!
}
private boolean fileExists(ContentProviderClient client, String filename) {
if (filename == null) {
return false;
@ -100,7 +97,7 @@ public class ContributionsSyncAdapter extends AbstractThreadedSyncAdapter {
while (!done) {
try {
result = mwApi.logEvents(user, lastModified, queryContinue, getLimit());
result = mwApi.logEvents(user, lastModified, queryContinue, ABSOLUTE_CONTRIBUTIONS_LOAD_LIMIT);
} catch (IOException e) {
// There isn't really much we can do, eh?
// FIXME: Perhaps add EventLogging?