]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fixed a hard to reproduce crash upon returning to the app
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 13 Oct 2020 19:39:41 +0000 (22:39 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 13 Oct 2020 19:39:41 +0000 (22:39 +0300)
to reproduce, set the background process limit in the developer options
to "1"

app/src/main/java/net/ktnx/mobileledger/model/Data.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/SplashActivity.java

index f0ba846ec05d9271a7c4f390631cde6a9906c4e5..f0f3987789e56673285923eee2209dc915d10b13 100644 (file)
@@ -91,6 +91,10 @@ public final class Data {
         backgroundTasksRunning.postValue(cnt > 0);
     }
     public static void setCurrentProfile(@NonNull MobileLedgerProfile newProfile) {
+        MLDB.setOption(MLDB.OPT_PROFILE_UUID, newProfile.getUuid());
+        profile.setValue(newProfile);
+    }
+    public static void postCurrentProfile(@NonNull MobileLedgerProfile newProfile) {
         MLDB.setOption(MLDB.OPT_PROFILE_UUID, newProfile.getUuid());
         profile.postValue(newProfile);
     }
@@ -200,6 +204,7 @@ public final class Data {
         MobileLedgerProfile startupProfile = getProfile(profileUUID);
         if (startupProfile != null)
             setCurrentProfile(startupProfile);
+        Logger.debug("profile", "initProfile() returning " + startupProfile);
         return startupProfile;
     }
 
index c1bb4d3285f6828b1695016af4092936bf67da8e..4205c80b5775084c898792bdca8c3115479b0bee 100644 (file)
@@ -105,7 +105,7 @@ public class SplashActivity extends CrashReportingActivity {
             String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null);
             MobileLedgerProfile startupProfile = Data.getProfile(profileUUID);
             if (startupProfile != null)
-                Data.setCurrentProfile(startupProfile);
+                Data.postCurrentProfile(startupProfile);
             return null;
         }
         @Override