Skip to content

Commit

Permalink
More update checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Sep 21, 2016
1 parent 813d8c6 commit e8cf843
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
7 changes: 5 additions & 2 deletions app/src/main/java/com/eveningoutpost/dexdrip/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -2268,8 +2268,11 @@ public void deleteAllBG(MenuItem myitem) {
}

public void checkForUpdate(MenuItem myitem) {
toast(getString(R.string.checking_for_update));
UpdateActivity.checkForAnUpdate(getApplicationContext());
if (JoH.ratelimit("manual-update-check",5)) {
toast(getString(R.string.checking_for_update));
UpdateActivity.last_check_time = -1;
UpdateActivity.checkForAnUpdate(getApplicationContext());
}
}

public void sendFeedback(MenuItem myitem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

import android.app.IntentService;
import android.content.Intent;
import android.os.PowerManager;

import com.eveningoutpost.dexdrip.Models.JoH;
import com.eveningoutpost.dexdrip.Models.UserError;

import static com.eveningoutpost.dexdrip.UtilityModels.UpdateActivity.checkForAnUpdate;

public class DailyIntentService extends IntentService {
// DAILY TASKS CAN GO IN HERE!

Expand All @@ -14,7 +18,18 @@ public DailyIntentService() {

@Override
protected void onHandleIntent(Intent intent) {
UserError.cleanup();
final PowerManager.WakeLock wl = JoH.getWakeLock("DailyIntentService", 120000);
try {
UserError.cleanup();
} catch (Exception e) {
//
}
try {
checkForAnUpdate(getApplicationContext());
} catch (Exception e) {
//
}
JoH.releaseWakeLock(wl);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void checkForAnUpdate(final Context context) {
if (!prefs.getBoolean(autoUpdatePrefsName, true)) return;
if (last_check_time == 0)
last_check_time = (double) prefs.getLong(last_update_check_time, 0);
if (((JoH.ts() - last_check_time) > 86400000) || (debug)) {
if (((JoH.ts() - last_check_time) > 86300000) || (debug)) {
last_check_time = JoH.ts();
prefs.edit().putLong(last_update_check_time, (long) last_check_time).apply();

Expand Down

0 comments on commit e8cf843

Please sign in to comment.