diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java | 2 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/UserUtil.java | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java index 72b63e69..632b4c55 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java @@ -138,7 +138,6 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo } setContentView(R.layout.abstract_fragment_activity); - UserUtil.seedCurrentUser(this); if (findViewById(R.id.fragment_container) != null && savedInstanceState == null) { String fragmentType = getIntent().getStringExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE); if(fragmentType == null) { @@ -380,6 +379,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo getIntent().removeExtra(Constants.INTENT_EXTRA_VIEW_ALBUM); } + UserUtil.seedCurrentUser(this); createAccount(); runWhenServiceAvailable(new Runnable() { @Override diff --git a/app/src/main/java/github/daneren2005/dsub/util/UserUtil.java b/app/src/main/java/github/daneren2005/dsub/util/UserUtil.java index b9a3a3cf..6417dc81 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/UserUtil.java +++ b/app/src/main/java/github/daneren2005/dsub/util/UserUtil.java @@ -50,10 +50,10 @@ public final class UserUtil { private static final long MIN_VERIFY_DURATION = 1000L * 60L * 60L; private static int instance = -1; + private static int instanceHash = -1; private static User currentUser; private static long lastVerifiedTime = 0; - public static void refreshCurrentUser(Context context, boolean forceRefresh) { refreshCurrentUser(context, forceRefresh, false); } @@ -76,10 +76,12 @@ public final class UserUtil { } final int instance = Util.getActiveServer(context); - if(UserUtil.instance == instance && currentUser != null) { + final int instanceHash = (instance == 0) ? 0 : Util.getRestUrl(context, null).hashCode(); + if(UserUtil.instance == instance && UserUtil.instanceHash == instanceHash && currentUser != null) { return; } else { UserUtil.instance = instance; + UserUtil.instanceHash = instanceHash; } new SilentBackgroundTask<Void>(context) { |