]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/UpdateTransactionsTask.java
a welcome screen directs to the new profile activity when there are no profiles defined
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / UpdateTransactionsTask.java
index f58d3e5cae25f8f9a06ea4c8b941a3af40cd0af2..0f3d022ad785905a004d337f3f7233ca02ee72c7 100644 (file)
@@ -24,18 +24,22 @@ import android.util.Log;
 
 import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.LedgerTransaction;
+import net.ktnx.mobileledger.model.MobileLedgerProfile;
 import net.ktnx.mobileledger.model.TransactionListItem;
 import net.ktnx.mobileledger.utils.Globals;
 import net.ktnx.mobileledger.utils.MLDB;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
 
-public class UpdateTransactionsTask extends AsyncTask<String, Void, List<TransactionListItem>> {
-    protected List<TransactionListItem> doInBackground(String[] filterAccName) {
+public class UpdateTransactionsTask extends AsyncTask<String, Void, String> {
+    protected String doInBackground(String[] filterAccName) {
         Data.backgroundTaskCount.incrementAndGet();
-        String profile_uuid = Data.profile.get().getUuid();
+        final MobileLedgerProfile profile = Data.profile.get();
+        if (profile == null) return "Profile not configured";
+
+        String profile_uuid = profile.getUuid();
         try {
             ArrayList<TransactionListItem> newList = new ArrayList<>();
 
@@ -88,7 +92,10 @@ public class UpdateTransactionsTask extends AsyncTask<String, Void, List<Transac
                 Log.d("UTT", "transaction list value updated");
             }
 
-            return newList;
+            return null;
+        }
+        catch (ParseException e) {
+            return String.format("Error parsing stored date '%s'", e.getMessage());
         }
         finally {
             Data.backgroundTaskCount.decrementAndGet();