Browse Source

Simplify null and empty check

legacy
Ammar Githam 4 years ago
parent
commit
0a8b7020b5
  1. 8
      app/src/main/java/awais/instagrabber/utils/Utils.java

8
app/src/main/java/awais/instagrabber/utils/Utils.java

@ -121,10 +121,13 @@ public final class Utils {
public static void setupCookies(final String cookieRaw) { public static void setupCookies(final String cookieRaw) {
final CookieStore cookieStore = NET_COOKIE_MANAGER.getCookieStore(); final CookieStore cookieStore = NET_COOKIE_MANAGER.getCookieStore();
if (cookieRaw == "LOGOUT") {
if (cookieStore == null || isEmpty(cookieRaw)) {
return;
}
if (cookieRaw.equals("LOGOUT")) {
cookieStore.removeAll(); cookieStore.removeAll();
return;
} }
else if (cookieRaw != null && !isEmpty(cookieRaw)) {
try { try {
final URI uri1 = new URI("https://instagram.com"); final URI uri1 = new URI("https://instagram.com");
final URI uri2 = new URI("https://instagram.com/"); final URI uri2 = new URI("https://instagram.com/");
@ -145,7 +148,6 @@ public final class Utils {
if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e); if (BuildConfig.DEBUG) Log.e("AWAISKING_APP", "", e);
} }
} }
}
@Nullable @Nullable
public static String getUserIdFromCookie(final String cookie) { public static String getUserIdFromCookie(final String cookie) {

Loading…
Cancel
Save