fix #56
This commit is contained in:
parent
77321c4403
commit
43b04a5ee1
@ -262,7 +262,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
private DiscoverAdapter discoverAdapter;
|
private DiscoverAdapter discoverAdapter;
|
||||||
public SimpleExoPlayer currentFeedPlayer; // hack for remix drawer layout
|
public SimpleExoPlayer currentFeedPlayer; // hack for remix drawer layout
|
||||||
private String cookie = Utils.settingsHelper.getString(Constants.COOKIE);
|
private String cookie = Utils.settingsHelper.getString(Constants.COOKIE);
|
||||||
public boolean isLoggedIn = !Utils.isEmpty(cookie);
|
public boolean isLoggedIn = !Utils.isEmpty(cookie) && Utils.getUserIdFromCookie(cookie) != null;
|
||||||
|
|
||||||
public MainHelper(@NonNull final Main main) {
|
public MainHelper(@NonNull final Main main) {
|
||||||
stopCurrentExecutor();
|
stopCurrentExecutor();
|
||||||
|
@ -150,13 +150,10 @@ public final class Utils {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public static String getUserIdFromCookie(final String cookie) {
|
public static String getUserIdFromCookie(final String cookie) {
|
||||||
if (!isEmpty(cookie)) {
|
if (!isEmpty(cookie)) {
|
||||||
final int uidIndex = cookie.indexOf("ds_user_id");
|
final int uidIndex = cookie.indexOf("ds_user_id=");
|
||||||
if (uidIndex > 0) {
|
if (uidIndex > 0) {
|
||||||
final int uidEndIndex = cookie.indexOf(';', uidIndex + 10);
|
String uid = cookie.split("ds_user_id=")[1].split(";")[0];
|
||||||
if (uidEndIndex > 0) {
|
return !isEmpty(uid) ? uid : null;
|
||||||
final String uid = cookie.substring(uidIndex + 11, uidEndIndex);
|
|
||||||
return !isEmpty(uid) ? uid : null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user