1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 05:16:58 +00:00

Fix profile fetching when username sometimes without '@'

This commit is contained in:
Ammar Githam 2021-03-21 00:23:25 +09:00
parent bbe87c8dbd
commit 16fd56c7e5

View File

@ -592,8 +592,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
private void fetchProfileDetails() {
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
public void onResult(final User user) {
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,
Toast.LENGTH_LONG).show();
else Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
} catch (final Throwable e) {}
} catch (final Throwable ignored) {}
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);