aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-10-30 17:24:28 -0700
committerScott Jackson <daneren2005@gmail.com>2015-10-30 17:24:28 -0700
commita227f8e48b7f14b08f1fcdbeed827ea4c68a91d5 (patch)
treeea6cc5c1cedc8b3a606a490dafcc0e882466135b /app/src/main
parentfefc3b500d21bbd836c716bdcf9ebb7bb74a6d33 (diff)
downloaddsub-a227f8e48b7f14b08f1fcdbeed827ea4c68a91d5.tar.gz
dsub-a227f8e48b7f14b08f1fcdbeed827ea4c68a91d5.tar.bz2
dsub-a227f8e48b7f14b08f1fcdbeed827ea4c68a91d5.zip
Fix issue of current user not being refreshed when server details changed
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java2
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/UserUtil.java6
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) {