Commit ffe7dbf1 authored by Thomas's avatar Thomas
Browse files

Some changes

parent dddef970
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN;
import static app.fedilab.android.mastodon.helper.Helper.displayReleaseNotesIfNeeded;
import static app.fedilab.android.mastodon.helper.ThemeHelper.fetchAccentColor;
import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.sendAction;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.typeOfConnection;

import android.Manifest;
import android.annotation.SuppressLint;
@@ -374,6 +375,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
                            } else if (accounts.get(0).peertube_account != null) {
                                account = "@" + accounts.get(0).peertube_account.getAcct() + "@" + accounts.get(0).instance;
                            }
                            typeOfConnection = PeertubeMainActivity.TypeOfConnection.NORMAL;
                            Toasty.info(activity, activity.getString(R.string.toast_account_changed, account), Toasty.LENGTH_LONG).show();
                            BaseMainActivity.currentToken = accounts.get(0).token;
                            BaseMainActivity.currentUserID = accounts.get(0).user_id;
@@ -546,6 +548,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
                                            } else if (account.peertube_account != null) {
                                                acctForAccount = "@" + account.peertube_account.getUsername() + "@" + account.instance;
                                            }
                                            typeOfConnection = PeertubeMainActivity.TypeOfConnection.NORMAL;
                                            Toasty.info(activity, activity.getString(R.string.toast_account_changed, acctForAccount), Toasty.LENGTH_LONG).show();
                                            BaseMainActivity.currentToken = account.token;
                                            BaseMainActivity.currentUserID = account.user_id;
@@ -559,6 +562,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
                                            editor.commit();
                                            //The user is now aut
                                            //The user is now authenticated, it will be redirected to MainActivity

                                            Intent mainActivity = new Intent(activity, MainActivity.class);
                                            activity.startActivity(mainActivity);
                                            activity.finish();
@@ -711,6 +715,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
                        } else if (account.peertube_account != null) {
                            acct = "@" + account.peertube_account.getUsername() + "@" + account.instance;
                        }
                        typeOfConnection = PeertubeMainActivity.TypeOfConnection.NORMAL;
                        Toasty.info(activity, activity.getString(R.string.toast_account_changed, acct), Toasty.LENGTH_LONG).show();
                        BaseMainActivity.currentToken = account.token;
                        BaseMainActivity.currentUserID = account.user_id;
@@ -1358,6 +1363,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
                bundle.putBoolean(Helper.ARG_PEERTUBE_NAV_REMOTE, true);
                intent.putExtras(bundle);
                startActivity(intent);
                finish();
            } else if (id == R.id.nav_about_instance) {
                (new InstanceActivity()).show(getSupportFragmentManager(), null);
            }
+3 −0
Original line number Diff line number Diff line
@@ -302,6 +302,9 @@ public class Helper {
    public static final String PREF_USER_TOKEN = "PREF_USER_TOKEN";
    public static final String PREF_USER_ID = "PREF_USER_ID";
    public static final String PREF_USER_INSTANCE = "PREF_USER_INSTANCE";
    public static final String PREF_USER_INSTANCE_PEERTUBE_BROWSING = "PREF_USER_INSTANCE_PEERTUBE_BROWSING";


    public static final String PREF_USER_SOFTWARE = "PREF_USER_SOFTWARE";
    public static final String PREF_IS_MODERATOR = "PREF_IS_MODERATOR";
    public static final String PREF_IS_ADMINISTRATOR = "PREF_IS_ADMINISTRATOR";
+37 −35
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ package app.fedilab.android.peertube.activities;
 * You should have received a copy of the GNU General Public License along with Fedilab; if not,
 * see <http://www.gnu.org/licenses>. */

import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE_PEERTUBE_BROWSING;
import static app.fedilab.android.mastodon.helper.Helper.addFragment;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.INSTANCE_ADDRESS;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.PICK_INSTANCE;
@@ -32,6 +32,8 @@ import android.widget.LinearLayout;
import android.widget.Toast;

import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -65,33 +67,8 @@ public class ManageInstancesActivity extends BaseBarActivity implements AboutIns
    private AboutInstanceAdapter aboutInstanceAdapter;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityManageInstancesPeertubeBinding.inflate(getLayoutInflater());
        View view = binding.getRoot();
        setContentView(view);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);
        }
        binding.loader.setVisibility(View.VISIBLE);
        binding.noAction.setVisibility(View.GONE);
        binding.lvInstances.setVisibility(View.GONE);
        binding.actionButton.setOnClickListener(v -> showRadioButtonDialogFullInstances(ManageInstancesActivity.this));
        aboutInstances = new ArrayList<>();
        aboutInstanceAdapter = new AboutInstanceAdapter(this.aboutInstances);
        aboutInstanceAdapter.allInstancesRemoved = this;
        binding.lvInstances.setAdapter(aboutInstanceAdapter);
        LinearLayoutManager layoutManager
                = new LinearLayoutManager(ManageInstancesActivity.this);
        binding.lvInstances.setLayoutManager(layoutManager);
        InfoInstanceVM viewModelInfoInstance = new ViewModelProvider(ManageInstancesActivity.this).get(InfoInstanceVM.class);
        viewModelInfoInstance.getInstances().observe(ManageInstancesActivity.this, this::manageVIewInfoInstance);
    }

    @SuppressLint("ApplySharedPref")
    private void showRadioButtonDialogFullInstances(Activity activity) {
    public static void showRadioButtonDialogFullInstances(Activity activity, FragmentManager fragmentManager) {
        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
        AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(activity);
        alt_bld.setTitle(R.string.instance_choice);
@@ -116,7 +93,7 @@ public class ManageInstancesActivity extends BaseBarActivity implements AboutIns
                        WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo();
                        if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) {
                            SharedPreferences.Editor editor = sharedpreferences.edit();
                            editor.putString(PREF_USER_INSTANCE, newInstance);
                            editor.putString(PREF_USER_INSTANCE_PEERTUBE_BROWSING, newInstance);
                            editor.commit();
                            newInstance = newInstance.trim().toLowerCase();
                            InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(activity, newInstance, null).getAboutInstance();
@@ -136,24 +113,49 @@ public class ManageInstancesActivity extends BaseBarActivity implements AboutIns
                }).start());
        alt_bld.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
        alt_bld.setNeutralButton(R.string.help, (dialog, which) -> {
            getSupportFragmentManager().setFragmentResultListener(PICK_INSTANCE, this, (requestKey, result) -> {
            fragmentManager.setFragmentResultListener(PICK_INSTANCE, (LifecycleOwner) activity, (requestKey, result) -> {
                new Thread(() -> {
                    String newInstance = result.getString(INSTANCE_ADDRESS);
                    InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(ManageInstancesActivity.this, newInstance, null).getAboutInstance();
                    SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
                    new StoredInstanceDAO(ManageInstancesActivity.this, db).insertInstance(aboutInstance, newInstance);
                    runOnUiThread(() -> new Handler().post(() -> Helper.logoutNoRemoval(ManageInstancesActivity.this)));
                    InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(activity, newInstance, null).getAboutInstance();
                    SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
                    new StoredInstanceDAO(activity, db).insertInstance(aboutInstance, newInstance);
                    activity.runOnUiThread(() -> new Handler().post(() -> Helper.logoutNoRemoval(activity)));
                }).start();
                getSupportFragmentManager().clearFragmentResultListener(PICK_INSTANCE);
                fragmentManager.clearFragmentResultListener(PICK_INSTANCE);
            });
            addFragment(
                    getSupportFragmentManager(), android.R.id.content, new FragmentLoginPickInstancePeertube(),
                    fragmentManager, android.R.id.content, new FragmentLoginPickInstancePeertube(),
                    null, null, FragmentLoginPickInstancePeertube.class.getName());
        });
        AlertDialog alert = alt_bld.create();
        alert.show();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityManageInstancesPeertubeBinding.inflate(getLayoutInflater());
        View view = binding.getRoot();
        setContentView(view);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);
        }
        binding.loader.setVisibility(View.VISIBLE);
        binding.noAction.setVisibility(View.GONE);
        binding.lvInstances.setVisibility(View.GONE);
        binding.actionButton.setOnClickListener(v -> showRadioButtonDialogFullInstances(ManageInstancesActivity.this, getSupportFragmentManager()));
        aboutInstances = new ArrayList<>();
        aboutInstanceAdapter = new AboutInstanceAdapter(this.aboutInstances);
        aboutInstanceAdapter.allInstancesRemoved = this;
        binding.lvInstances.setAdapter(aboutInstanceAdapter);
        LinearLayoutManager layoutManager
                = new LinearLayoutManager(ManageInstancesActivity.this);
        binding.lvInstances.setLayoutManager(layoutManager);
        InfoInstanceVM viewModelInfoInstance = new ViewModelProvider(ManageInstancesActivity.this).get(InfoInstanceVM.class);
        viewModelInfoInstance.getInstances().observe(ManageInstancesActivity.this, this::manageVIewInfoInstance);
    }

    private void manageVIewInfoInstance(List<InstanceData.AboutInstance> aboutInstances) {
        binding.loader.setVisibility(View.GONE);
        if (aboutInstances == null || aboutInstances.size() == 0) {
+11 −12
Original line number Diff line number Diff line
@@ -127,7 +127,6 @@ import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.activities.BasePeertubeActivity;
import app.fedilab.android.databinding.ActivityPeertubeBinding;
@@ -591,7 +590,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
    private void playVideo() {
        if (status == null && typeOfConnection == PeertubeMainActivity.TypeOfConnection.REMOTE_ACCOUNT) {
            app.fedilab.android.mastodon.viewmodel.mastodon.SearchVM searchVM = new ViewModelProvider(PeertubeActivity.this).get(app.fedilab.android.mastodon.viewmodel.mastodon.SearchVM.class);
            searchVM.search(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, videoUuid, null, "statuses", false, true, false, 0, null, null, 1)
            searchVM.search(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), videoUuid, null, "statuses", false, true, false, 0, null, null, 1)
                    .observe(PeertubeActivity.this, results -> {
                        if (results != null && results.statuses != null && results.statuses.size() > 0) {
                            status = results.statuses.get(0);
@@ -1041,7 +1040,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                    }
                    alt_bld.setPositiveButton(R.string.yes, (dialog, id) -> {
                        if (status.reblogged) {
                            statusesVM.unReblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id)
                            statusesVM.unReblog(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id)
                                    .observe(PeertubeActivity.this, _status -> {
                                        if (_status != null) {
                                            status = _status;
@@ -1050,7 +1049,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                                    });
                        } else {
                            ((SparkButton) v).playAnimation();
                            statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id, null)
                            statusesVM.reblog(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id, null)
                                    .observe(PeertubeActivity.this, _status -> {
                                        if (_status != null) {
                                            status = _status;
@@ -1065,7 +1064,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                    alert.show();
                } else {
                    if (status.reblogged) {
                        statusesVM.unReblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id)
                        statusesVM.unReblog(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id)
                                .observe(PeertubeActivity.this, _status -> {
                                    if (_status != null) {
                                        status = _status;
@@ -1074,7 +1073,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                                });
                    } else {
                        ((SparkButton) v).playAnimation();
                        statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id, null)
                        statusesVM.reblog(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id, null)
                                .observe(PeertubeActivity.this, _status -> {
                                    if (_status != null) {
                                        status = _status;
@@ -1099,7 +1098,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                    }
                    alt_bld.setPositiveButton(R.string.yes, (dialog, id) -> {
                        if (status.favourited) {
                            statusesVM.unFavourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id)
                            statusesVM.unFavourite(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id)
                                    .observe(PeertubeActivity.this, _status -> {
                                        if (_status != null) {
                                            status = _status;
@@ -1108,7 +1107,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                                    });
                        } else {
                            ((SparkButton) v).playAnimation();
                            statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id)
                            statusesVM.favourite(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id)
                                    .observe(PeertubeActivity.this, _status -> {
                                        if (_status != null) {
                                            status = _status;
@@ -1123,7 +1122,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                    alert.show();
                } else {
                    if (status.favourited) {
                        statusesVM.unFavourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id)
                        statusesVM.unFavourite(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id)
                                .observe(PeertubeActivity.this, _status -> {
                                    if (_status != null) {
                                        status = _status;
@@ -1132,7 +1131,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                                });
                    } else {
                        ((SparkButton) v).playAnimation();
                        statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id)
                        statusesVM.favourite(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id)
                                .observe(PeertubeActivity.this, _status -> {
                                    if (_status != null) {
                                        status = _status;
@@ -1148,7 +1147,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
            if (status != null) {
                StatusesVM statusesVM = new ViewModelProvider(PeertubeActivity.this).get(StatusesVM.class);
                if (status.bookmarked) {
                    statusesVM.unBookmark(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id)
                    statusesVM.unBookmark(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id)
                            .observe(PeertubeActivity.this, _status -> {
                                if (_status != null) {
                                    status = _status;
@@ -1157,7 +1156,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
                            });
                } else {
                    ((SparkButton) v).playAnimation();
                    statusesVM.bookmark(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, status.id)
                    statusesVM.bookmark(HelperInstance.getLiveInstance(PeertubeActivity.this), HelperInstance.getToken(), status.id)
                            .observe(PeertubeActivity.this, _status -> {
                                if (_status != null) {
                                    status = _status;
+161 −128
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static app.fedilab.android.BaseMainActivity.mamageNewIntent;
import static app.fedilab.android.BaseMainActivity.manageDrawerMenu;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE_PEERTUBE_BROWSING;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN;
import static app.fedilab.android.mastodon.helper.Helper.addFragment;
@@ -34,11 +35,13 @@ import static app.fedilab.android.peertube.helper.SwitchAccountHelper.switchDial
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
@@ -96,7 +99,9 @@ import app.fedilab.android.peertube.fragment.FragmentLoginPickInstancePeertube;
import app.fedilab.android.peertube.helper.Helper;
import app.fedilab.android.peertube.helper.HelperInstance;
import app.fedilab.android.peertube.services.RetrieveInfoService;
import app.fedilab.android.peertube.sqlite.StoredInstanceDAO;
import app.fedilab.android.peertube.viewmodel.TimelineVM;
import app.fedilab.android.sqlite.Sqlite;


public class PeertubeMainActivity extends PeertubeBaseMainActivity {
@@ -165,13 +170,35 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
            if (extras != null && extras.containsKey(app.fedilab.android.mastodon.helper.Helper.ARG_PEERTUBE_NAV_REMOTE)) {
                if (extras.getBoolean(app.fedilab.android.mastodon.helper.Helper.ARG_PEERTUBE_NAV_REMOTE)) {
                    typeOfConnection = PeertubeMainActivity.TypeOfConnection.REMOTE_ACCOUNT;
                    intentActvity.removeExtra(app.fedilab.android.mastodon.helper.Helper.ARG_PEERTUBE_NAV_REMOTE);
                }
            }
        }
        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(PeertubeMainActivity.this);

        if (typeOfConnection == TypeOfConnection.REMOTE_ACCOUNT) {
            String defaultInstance = sharedpreferences.getString(PREF_USER_INSTANCE_PEERTUBE_BROWSING, null);
            Log.v(app.fedilab.android.mastodon.helper.Helper.TAG, "defaultInstance-->: " + defaultInstance);
            if (defaultInstance == null) {
                getSupportFragmentManager().setFragmentResultListener(PICK_INSTANCE, PeertubeMainActivity.this, (requestKey, result) -> {
                    new Thread(() -> {
                        String newInstance = result.getString(INSTANCE_ADDRESS);
                        InstanceData.AboutInstance aboutInstance = new RetrofitPeertubeAPI(PeertubeMainActivity.this, newInstance, null).getAboutInstance();
                        SQLiteDatabase db = Sqlite.getInstance(PeertubeMainActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
                        new StoredInstanceDAO(PeertubeMainActivity.this, db).insertInstance(aboutInstance, newInstance);
                    }).start();
                    getSupportFragmentManager().clearFragmentResultListener(PICK_INSTANCE);
                });
                addFragment(
                        getSupportFragmentManager(), android.R.id.content, new FragmentLoginPickInstancePeertube(),
                        null, null, FragmentLoginPickInstancePeertube.class.getName());
            }
            return;
        }

        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(PeertubeMainActivity.this);

        badgeCount = 0;
        headerMenuOpen = false;
@@ -207,6 +234,8 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {

        NavHeaderMainBinding headerMainBinding = NavHeaderMainBinding.inflate(getLayoutInflater());
        currentAccount = null;
        if (Helper.isLoggedIn()) {

            new Thread(() -> {
                try {
                    if (currentToken == null) {
@@ -278,30 +307,29 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
                            manageDrawerMenu(PeertubeMainActivity.this, binding.drawerNavView, headerMainBinding);
                        });
                    }

                if (Helper.isLoggedIn()) {
                    binding.navView.inflateMenu(R.menu.bottom_nav_menu_connected_peertube);
                    refreshToken();

                } else {
                    binding.navView.inflateMenu(R.menu.bottom_nav_menu);
                }
                };
                mainHandler.post(myRunnable);
            }).start();
        } else {
            binding.navView.inflateMenu(R.menu.bottom_nav_menu_peertube);
        }

        headerMainBinding.instanceInfo.setVisibility(View.GONE);

        headerMainBinding.headerOptionInfo.setOnClickListener(v -> headerOptionInfoClick(PeertubeMainActivity.this, headerMainBinding, getSupportFragmentManager()));

        if (Helper.isLoggedIn()) {
            binding.drawerNavView.addHeaderView(headerMainBinding.getRoot());

            binding.drawerNavView.setNavigationItemSelectedListener(item -> {
                if (item.getItemId() == R.id.action_settings) {
                    Intent intent = new Intent(PeertubeMainActivity.this, SettingsActivity.class);
                    startActivity(intent);
                } else if (item.getItemId() == R.id.action_account) {
                    Intent intent;
                if (typeOfConnection == TypeOfConnection.SURFING) {
                    if (typeOfConnection == TypeOfConnection.SURFING || typeOfConnection == TypeOfConnection.REMOTE_ACCOUNT) {
                        switchDialog(PeertubeMainActivity.this, false);
                    } else {
                        if (Helper.canMakeAction()) {
@@ -349,6 +377,10 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
                binding.drawerLayout.close();
                return false;
            });
        } else {
            binding.drawerNavView.setVisibility(View.GONE);
        }


        overviewFragment = new DisplayOverviewFragment();
        if (!Helper.isLoggedIn()) {
@@ -546,6 +578,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
                                case NORMAL:
                                    accountItem.setVisible(true);
                                    break;
                                case REMOTE_ACCOUNT:
                                case SURFING:
                                    accountItem.setVisible(false);
                                    break;
@@ -601,7 +634,6 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {

        MenuItem incognitoItem = menu.findItem(R.id.action_incognito);
        switch (typeOfConnection) {
            case REMOTE_ACCOUNT:
            case NORMAL:
                if (Helper.isLoggedIn()) {
                    incognitoItem.setVisible(true);
@@ -612,6 +644,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
                    incognitoItem.setVisible(false);
                }
                break;
            case REMOTE_ACCOUNT:
            case SURFING:
                incognitoItem.setVisible(false);
                break;
Loading