From d663bea5bc135fed25e78e8126ec60690a1876db Mon Sep 17 00:00:00 2001 From: Jacocococo Date: Mon, 16 Oct 2023 15:52:52 +0200 Subject: [PATCH 1/3] Hide privacy settings on Akkoma --- .../android/fragments/settings/SettingsMainFragment.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsMainFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsMainFragment.java index 673df63403..f5a9ca1eca 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsMainFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsMainFragment.java @@ -55,7 +55,6 @@ public void onCreate(Bundle savedInstanceState){ onDataLoaded(List.of( new ListItem<>(R.string.settings_behavior, 0, R.drawable.ic_fluent_settings_24_regular, this::onBehaviorClick), new ListItem<>(R.string.settings_display, 0, R.drawable.ic_fluent_color_24_regular, this::onDisplayClick), - new ListItem<>(R.string.settings_privacy, 0, R.drawable.ic_fluent_shield_24_regular, this::onPrivacyClick), new ListItem<>(R.string.settings_notifications, 0, R.drawable.ic_fluent_alert_24_regular, this::onNotificationsClick), new ListItem<>(R.string.sk_settings_instance, 0, R.drawable.ic_fluent_server_24_regular, this::onInstanceClick), new ListItem<>(getString(R.string.about_app, getString(R.string.sk_app_name)), null, R.drawable.ic_fluent_info_24_regular, this::onAboutClick, null, 0, true), @@ -63,8 +62,10 @@ public void onCreate(Bundle savedInstanceState){ )); Instance instance = AccountSessionManager.getInstance().getInstanceInfo(account.domain); - if (!instance.isAkkoma()) - data.add(3, new ListItem<>(R.string.settings_filters, 0, R.drawable.ic_fluent_filter_24_regular, this::onFiltersClick)); + if (!instance.isAkkoma()){ + data.add(2, new ListItem<>(R.string.settings_filters, 0, R.drawable.ic_fluent_filter_24_regular, this::onFiltersClick)); + data.add(2, new ListItem<>(R.string.settings_privacy, 0, R.drawable.ic_fluent_shield_24_regular, this::onPrivacyClick)); + } if(BuildConfig.DEBUG || BuildConfig.BUILD_TYPE.equals("appcenterPrivateBeta")){ data.add(0, new ListItem<>("Debug settings", null, R.drawable.ic_fluent_wrench_screwdriver_24_regular, ()->Nav.go(getActivity(), SettingsDebugFragment.class, makeFragmentArgs()), null, 0, true)); From 299c2f47198921c868bac32add8f0218de7d20b7 Mon Sep 17 00:00:00 2001 From: Jacocococo Date: Mon, 16 Oct 2023 17:58:19 +0200 Subject: [PATCH 2/3] Fix Akkoma skipping discovery --- .../java/org/joinmastodon/android/fragments/HomeFragment.java | 4 ---- .../android/fragments/discover/DiscoverFragment.java | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java index 0ce9645972..17ff081973 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java @@ -32,7 +32,6 @@ import org.joinmastodon.android.events.StatusDisplaySettingsChangedEvent; import org.joinmastodon.android.fragments.discover.DiscoverFragment; import org.joinmastodon.android.model.Account; -import org.joinmastodon.android.model.Instance; import org.joinmastodon.android.model.Notification; import org.joinmastodon.android.model.PaginatedResponse; import org.joinmastodon.android.ui.AccountSwitcherSheet; @@ -71,14 +70,12 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene private TextView notificationsBadge; private String accountID; - private boolean isAkkoma; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); accountID=getArguments().getString("account"); setTitle(R.string.sk_app_name); - isAkkoma = getInstance().map(Instance::isAkkoma).orElse(false); if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.N) setRetainInstance(true); @@ -89,7 +86,6 @@ public void onCreate(Bundle savedInstanceState){ homeTabFragment=new HomeTabFragment(); homeTabFragment.setArguments(args); args=new Bundle(args); - args.putBoolean("disableDiscover", isAkkoma); args.putBoolean("noAutoLoad", true); discoverFragment=new DiscoverFragment(); discoverFragment.setArguments(args); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java index b1d356364e..366e8fe5c4 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java @@ -13,8 +13,10 @@ import android.widget.TextView; import org.joinmastodon.android.R; +import org.joinmastodon.android.api.session.AccountSessionManager; import org.joinmastodon.android.fragments.IsOnTop; import org.joinmastodon.android.fragments.ScrollableToTop; +import org.joinmastodon.android.model.Instance; import org.joinmastodon.android.model.SearchResult; import org.joinmastodon.android.ui.OutlineProviders; import org.joinmastodon.android.ui.SimpleViewHolder; @@ -155,7 +157,7 @@ public void onTabReselected(TabLayout.Tab tab){ } }); - disableDiscover=getArguments().getBoolean("disableDiscover"); + disableDiscover=AccountSessionManager.get(accountID).getInstance().map(Instance::isAkkoma).orElse(false); searchView=view.findViewById(R.id.search_fragment); if(searchFragment==null){ searchFragment=new SearchFragment(); From e570ed43c26dbd5a546afe1ba07eef77d30d1a71 Mon Sep 17 00:00:00 2001 From: Jacocococo Date: Mon, 16 Oct 2023 18:03:34 +0200 Subject: [PATCH 3/3] Make settings order more clear in the code --- .../android/fragments/settings/SettingsMainFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsMainFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsMainFragment.java index f5a9ca1eca..adfe5f778c 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsMainFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsMainFragment.java @@ -63,8 +63,8 @@ public void onCreate(Bundle savedInstanceState){ Instance instance = AccountSessionManager.getInstance().getInstanceInfo(account.domain); if (!instance.isAkkoma()){ - data.add(2, new ListItem<>(R.string.settings_filters, 0, R.drawable.ic_fluent_filter_24_regular, this::onFiltersClick)); data.add(2, new ListItem<>(R.string.settings_privacy, 0, R.drawable.ic_fluent_shield_24_regular, this::onPrivacyClick)); + data.add(3, new ListItem<>(R.string.settings_filters, 0, R.drawable.ic_fluent_filter_24_regular, this::onFiltersClick)); } if(BuildConfig.DEBUG || BuildConfig.BUILD_TYPE.equals("appcenterPrivateBeta")){