diff --git a/app/src/main/java/fr/free/nrw/commons/category/ContinuationClient.kt b/app/src/main/java/fr/free/nrw/commons/category/ContinuationClient.kt index cbf9017b2..a85eee79d 100644 --- a/app/src/main/java/fr/free/nrw/commons/category/ContinuationClient.kt +++ b/app/src/main/java/fr/free/nrw/commons/category/ContinuationClient.kt @@ -38,4 +38,15 @@ abstract class ContinuationClient { continuationStore.remove("$prefix$category") } + /** + * Remove the existing the key from continuationExists and continuationStore + * + * @param prefix + * @param userName the username + */ + protected fun resetUserContinuation(prefix: String, userName: String) { + continuationExists.remove("$prefix$userName") + continuationStore.remove("$prefix$userName") + } + } diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionBoundaryCallback.kt b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionBoundaryCallback.kt index 8786edb05..00f002176 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionBoundaryCallback.kt +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionBoundaryCallback.kt @@ -27,6 +27,9 @@ class ContributionBoundaryCallback @Inject constructor( * network */ override fun onZeroItemsLoaded() { + if (sessionManager.userName != null) { + mediaClient.resetUserNameContinuation(sessionManager.userName!!) + } fetchContributions() } @@ -66,6 +69,8 @@ class ContributionBoundaryCallback @Inject constructor( ) } ) + }else { + compositeDisposable.clear() } } diff --git a/app/src/main/java/fr/free/nrw/commons/data/DBOpenHelper.java b/app/src/main/java/fr/free/nrw/commons/data/DBOpenHelper.java index 530cb3f94..d5989e1b3 100644 --- a/app/src/main/java/fr/free/nrw/commons/data/DBOpenHelper.java +++ b/app/src/main/java/fr/free/nrw/commons/data/DBOpenHelper.java @@ -50,6 +50,7 @@ public class DBOpenHelper extends SQLiteOpenHelper { public void deleteTable(SQLiteDatabase db, String tableName) { try { db.execSQL(String.format(DROP_TABLE_STATEMENT, tableName)); + onCreate(db); } catch (SQLiteException e) { e.printStackTrace(); } diff --git a/app/src/main/java/fr/free/nrw/commons/media/MediaClient.kt b/app/src/main/java/fr/free/nrw/commons/media/MediaClient.kt index 0db413466..5ca20b946 100644 --- a/app/src/main/java/fr/free/nrw/commons/media/MediaClient.kt +++ b/app/src/main/java/fr/free/nrw/commons/media/MediaClient.kt @@ -149,6 +149,14 @@ class MediaClient @Inject constructor( resetContinuation(CATEGORY_CONTINUATION_PREFIX, category) } + /** + * Call the resetUserContinuation method + * + * @param userName the username + */ + fun resetUserNameContinuation(userName: String) = + resetUserContinuation("user_", userName) + override fun responseMapper( networkResult: Single, key: String?