Postpone some actions

This commit is contained in:
Thomas 2020-08-11 15:38:54 +02:00
parent 8c7ccefc83
commit 8aad7a2679
1 changed files with 18 additions and 11 deletions

View File

@ -1324,6 +1324,7 @@ public abstract class BaseMainActivity extends BaseActivity
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
new ManageFiltersAsyncTask(BaseMainActivity.this, GET_ALL_FILTER, null, BaseMainActivity.this).execute();
}
}
/* Clean cache for statuses */
@ -1333,21 +1334,27 @@ public abstract class BaseMainActivity extends BaseActivity
new TimelineCacheDAO(BaseMainActivity.this, db).removeAfterDate(dateString);
});
if (Helper.isLoggedIn(BaseMainActivity.this)) {
new UpdateAccountInfoByIDAsyncTask(BaseMainActivity.this, account, BaseMainActivity.this).execute();
final Handler handler = new Handler();
handler.postDelayed(() -> new UpdateAccountInfoByIDAsyncTask(BaseMainActivity.this, account, BaseMainActivity.this).execute(), 2000);
}
mutedAccount = new TempMuteDAO(BaseMainActivity.this, db).getAllTimeMuted(account);
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
new RetrieveFeedsAsyncTask(BaseMainActivity.this, RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS, null, BaseMainActivity.this).execute();
if (BuildConfig.lite) {
String datesupdate = sharedpreferences.getString(Helper.TRACKING_LAST_UPDATE, null);
Date dateLastUpdate = Helper.stringToDate(BaseMainActivity.this, datesupdate);
Date dateUpdate = new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(10));
//Refresh tracking db if needed
if (datesupdate == null || dateUpdate.after(dateLastUpdate)) {
Intent scriptIntent = new Intent(BaseMainActivity.this, DownloadTrackingDBScriptsService.class);
startService(scriptIntent);
final Handler handler = new Handler();
handler.postDelayed(() -> {
new RetrieveFeedsAsyncTask(BaseMainActivity.this, RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS, null, BaseMainActivity.this).execute();
if (BuildConfig.lite) {
String datesupdate = sharedpreferences.getString(Helper.TRACKING_LAST_UPDATE, null);
Date dateLastUpdate = Helper.stringToDate(BaseMainActivity.this, datesupdate);
Date dateUpdate = new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(10));
//Refresh tracking db if needed
if (datesupdate == null || dateUpdate.after(dateLastUpdate)) {
Intent scriptIntent = new Intent(BaseMainActivity.this, DownloadTrackingDBScriptsService.class);
startService(scriptIntent);
}
}
}
}, 3000);
}
}