Browse Source

Fix profile fetching when username sometimes without '@'

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
16fd56c7e5
  1. 9
      app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java

9
app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java

@ -592,8 +592,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
private void fetchProfileDetails() { private void fetchProfileDetails() {
accountIsUpdated = false; accountIsUpdated = false;
new ProfileFetcher(TextUtils.isEmpty(username) ? null : username.trim().substring(1),
myId, isLoggedIn, new FetchListener<User>() {
String usernameTemp = username.trim();
if (usernameTemp.startsWith("@")) {
usernameTemp = usernameTemp.substring(1);
}
new ProfileFetcher(TextUtils.isEmpty(username) ? null : usernameTemp, myId, isLoggedIn, new FetchListener<User>() {
@Override @Override
public void onResult(final User user) { public void onResult(final User user) {
if (getContext() == null) return; if (getContext() == null) return;
@ -614,7 +617,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
isLoggedIn ? R.string.error_loading_profile_loggedin : R.string.error_loading_profile, isLoggedIn ? R.string.error_loading_profile_loggedin : R.string.error_loading_profile,
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
else Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); else Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
} catch (final Throwable e) {}
} catch (final Throwable ignored) {}
} }
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

Loading…
Cancel
Save