database bug fix, added error message

This commit is contained in:
nuclearfog 2022-12-22 20:45:21 +01:00
parent ac168c742a
commit b195f2a195
No known key found for this signature in database
GPG Key ID: 03488A185C476379
4 changed files with 11 additions and 1 deletions

View File

@ -104,12 +104,14 @@ public final class ErrorHandler {
return context.getString(R.string.error_invalid_media); return context.getString(R.string.error_invalid_media);
case ConnectionException.APP_SUSPENDED: case ConnectionException.APP_SUSPENDED:
case ConnectionException.ERROR_API_ACCESS_DENIED:
GlobalSettings settings = GlobalSettings.getInstance(context); GlobalSettings settings = GlobalSettings.getInstance(context);
if (settings.getLogin().usingDefaultTokens()) if (settings.getLogin().usingDefaultTokens())
return context.getString(R.string.error_api_key_expired); return context.getString(R.string.error_api_key_expired);
return context.getString(R.string.error_api_access_denied); 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: case ConnectionException.ERROR_NOT_DEFINED:
return error.getMessage(); return error.getMessage();

View File

@ -241,6 +241,11 @@ public class AppDatabase {
*/ */
private static final String STATUS_SELECT = StatusTable.NAME + "." + StatusTable.ID + "=?"; 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 * select user from user table matching user ID
*/ */
@ -632,6 +637,7 @@ public class AppDatabase {
SQLiteDatabase db = getDbWrite(); SQLiteDatabase db = getDbWrite();
db.delete(StatusTable.NAME, STATUS_SELECT, args); db.delete(StatusTable.NAME, STATUS_SELECT, args);
db.delete(NotificationTable.NAME, NOTIFICATION_SELECT, args);
db.delete(FavoriteTable.NAME, FAVORITE_SELECT_STATUS, args); db.delete(FavoriteTable.NAME, FAVORITE_SELECT_STATUS, args);
commit(db); commit(db);
} }

View File

@ -249,4 +249,5 @@
<string name="status_replyname_empty">Antwort</string> <string name="status_replyname_empty">Antwort</string>
<string name="status_metrics_title">Statusmetriken</string> <string name="status_metrics_title">Statusmetriken</string>
<string name="error_empty_text">Text ist leer!</string> <string name="error_empty_text">Text ist leer!</string>
<string name="error_api_access_limited">Fehler! API Zugang wurde von Twitter beschränkt.</string>
</resources> </resources>

View File

@ -95,6 +95,7 @@
<string name="error_corrupt_api_key">Error, corrupt API key!</string> <string name="error_corrupt_api_key">Error, corrupt API key!</string>
<string name="error_acc_update">Account update failed! Please check your input!</string> <string name="error_acc_update">Account update failed! Please check your input!</string>
<string name="error_api_access_denied">Error, API access denied! Please check your API Keys.</string> <string name="error_api_access_denied">Error, API access denied! Please check your API Keys.</string>
<string name="error_api_access_limited">Error, API access limited by Twitter!</string>
<string name="error_api_key_expired">Error, API Keys expired! Please update app!</string> <string name="error_api_key_expired">Error, API Keys expired! Please update app!</string>
<string name="error_mention_exceed">Too much mentions!</string> <string name="error_mention_exceed">Too much mentions!</string>
<string name="error_result_cancelled">Error, result cancelled!</string> <string name="error_result_cancelled">Error, result cancelled!</string>