From b195f2a1958383b65d35f021cec17b3a2c6042d1 Mon Sep 17 00:00:00 2001 From: nuclearfog Date: Thu, 22 Dec 2022 20:45:21 +0100 Subject: [PATCH] database bug fix, added error message --- .../org/nuclearfog/twidda/backend/utils/ErrorHandler.java | 4 +++- .../java/org/nuclearfog/twidda/database/AppDatabase.java | 6 ++++++ app/src/main/res/values-de-rDE/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/utils/ErrorHandler.java b/app/src/main/java/org/nuclearfog/twidda/backend/utils/ErrorHandler.java index b13b70c9..70ecc6ab 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/utils/ErrorHandler.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/utils/ErrorHandler.java @@ -104,12 +104,14 @@ public final class ErrorHandler { return context.getString(R.string.error_invalid_media); case ConnectionException.APP_SUSPENDED: - case ConnectionException.ERROR_API_ACCESS_DENIED: GlobalSettings settings = GlobalSettings.getInstance(context); if (settings.getLogin().usingDefaultTokens()) return context.getString(R.string.error_api_key_expired); return context.getString(R.string.error_api_access_denied); + case ConnectionException.ERROR_API_ACCESS_DENIED: + return context.getString(R.string.error_api_access_limited); + case ConnectionException.ERROR_NOT_DEFINED: return error.getMessage(); diff --git a/app/src/main/java/org/nuclearfog/twidda/database/AppDatabase.java b/app/src/main/java/org/nuclearfog/twidda/database/AppDatabase.java index fb81aa6f..d320a671 100644 --- a/app/src/main/java/org/nuclearfog/twidda/database/AppDatabase.java +++ b/app/src/main/java/org/nuclearfog/twidda/database/AppDatabase.java @@ -241,6 +241,11 @@ public class AppDatabase { */ private static final String STATUS_SELECT = StatusTable.NAME + "." + StatusTable.ID + "=?"; + /** + * select notification from notification table using status ID + */ + private static final String NOTIFICATION_SELECT = NotificationTable.NAME + "." + NotificationTable.ITEM + "=?"; + /** * select user from user table matching user ID */ @@ -632,6 +637,7 @@ public class AppDatabase { SQLiteDatabase db = getDbWrite(); db.delete(StatusTable.NAME, STATUS_SELECT, args); + db.delete(NotificationTable.NAME, NOTIFICATION_SELECT, args); db.delete(FavoriteTable.NAME, FAVORITE_SELECT_STATUS, args); commit(db); } diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index a1f50bf2..d51a1ff0 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -249,4 +249,5 @@ Antwort Statusmetriken Text ist leer! + Fehler! API Zugang wurde von Twitter beschränkt. \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ffa8268c..6630337c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -95,6 +95,7 @@ Error, corrupt API key! Account update failed! Please check your input! Error, API access denied! Please check your API Keys. + Error, API access limited by Twitter! Error, API Keys expired! Please update app! Too much mentions! Error, result cancelled!