From: Damyan Ivanov Date: Thu, 7 Mar 2019 03:52:02 +0000 (+0200) Subject: central method for setting the last profile update date X-Git-Tag: v0.8~36 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=d295c5e74a18fed6383109ec463bc6c3f6b48fce;p=mobile-ledger.git central method for setting the last profile update date --- diff --git a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java index 4ca3f827..35277d67 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java @@ -49,7 +49,6 @@ import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.Stack; import java.util.regex.Matcher; @@ -340,10 +339,7 @@ public class RetrieveTransactionsTask profile.deleteNotPresentTransactions(db); db.setTransactionSuccessful(); - Log.d("db", "Updating transaction value stamp"); - Date now = new Date(); - profile.setLongOption(MLDB.OPT_LAST_SCRAPE, now.getTime()); - Data.lastUpdateDate.set(now); + profile.setLastUpdateStamp(); return null; } diff --git a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java index 59ae1958..ae877c33 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java @@ -25,6 +25,7 @@ import net.ktnx.mobileledger.utils.Globals; import net.ktnx.mobileledger.utils.MLDB; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.UUID; @@ -340,4 +341,10 @@ public final class MobileLedgerProfile { public void deleteNotPresentTransactions(SQLiteDatabase db) { db.execSQL("DELETE FROM transactions WHERE profile=? AND keep = 0", new String[]{uuid}); } + public void setLastUpdateStamp() { + Log.d("db", "Updating transaction value stamp"); + Date now = new Date(); + setLongOption(MLDB.OPT_LAST_SCRAPE, now.getTime()); + Data.lastUpdateDate.set(now); + } }