Fix cache and boosts

This commit is contained in:
tom79 2019-06-09 15:14:05 +02:00
parent 4b21eae461
commit 97cc6343e7
3 changed files with 6 additions and 6 deletions

View File

@ -57,7 +57,6 @@ public class RetrieveRemoteDataAsyncTask extends AsyncTask<Void, Void, Void> {
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
API api = new API(this.contextReference.get()); API api = new API(this.contextReference.get());
Log.v(Helper.TAG,"url: " + this.url);
APIResponse apiResponse = api.search(this.url); APIResponse apiResponse = api.search(this.url);
if( apiResponse.getResults() != null) if( apiResponse.getResults() != null)
results = apiResponse.getResults(); results = apiResponse.getResults();

View File

@ -21,7 +21,6 @@ import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@ -2282,7 +2281,11 @@ public class API {
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC); LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT); Account account = new AccountDAO(context, db).getAccountByToken(prefKeyOauthTokenT);
new TimelineCacheDAO(context, db).update(targetedId, resp, account.getId(), account.getInstance()); Status indb = new TimelineCacheDAO(context, db).getSingle(targetedId);
if( indb != null) {
String response = httpsConnection.get(getAbsoluteUrl(String.format("/statuses/%s", targetedId)), 60, null, prefKeyOauthTokenT);
new TimelineCacheDAO(context, db).update(targetedId, response, account.getId(), account.getInstance());
}
} }
} catch (HttpsConnection.HttpsConnectionException e) { } catch (HttpsConnection.HttpsConnectionException e) {
setError(e.getStatusCode(), e); setError(e.getStatusCode(), e);

View File

@ -138,9 +138,7 @@ public class CrossActions {
confirmation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false); confirmation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
else if (doAction == API.StatusAction.UNREBLOG || doAction == API.StatusAction.REBLOG) else if (doAction == API.StatusAction.UNREBLOG || doAction == API.StatusAction.REBLOG)
confirmation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true); confirmation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true);
else if (doAction == API.StatusAction.FOLLOW || doAction == API.StatusAction.UNFOLLOW) if(type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && limitedToOwner){
confirmation = false;
if(type != null && type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && limitedToOwner){
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null); String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();