Browse Source

Check logged in onCreate of ProfileFragment

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

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

@ -210,6 +210,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
public View onCreateView(@NonNull final LayoutInflater inflater, public View onCreateView(@NonNull final LayoutInflater inflater,
final ViewGroup container, final ViewGroup container,
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
cookie = settingsHelper.getString(Constants.COOKIE);
isLoggedIn = !Utils.isEmpty(cookie) && Utils.getUserIdFromCookie(cookie) != null;
if (root != null) { if (root != null) {
if (getArguments() != null) { if (getArguments() != null) {
final ProfileFragmentArgs fragmentArgs = ProfileFragmentArgs.fromBundle(getArguments()); final ProfileFragmentArgs fragmentArgs = ProfileFragmentArgs.fromBundle(getArguments());
@ -274,8 +276,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} }
private void init() { private void init() {
cookie = settingsHelper.getString(Constants.COOKIE);
isLoggedIn = !Utils.isEmpty(cookie) && Utils.getUserIdFromCookie(cookie) != null;
if (getArguments() != null) { if (getArguments() != null) {
final ProfileFragmentArgs fragmentArgs = ProfileFragmentArgs.fromBundle(getArguments()); final ProfileFragmentArgs fragmentArgs = ProfileFragmentArgs.fromBundle(getArguments());
username = fragmentArgs.getUsername(); username = fragmentArgs.getUsername();

Loading…
Cancel
Save