removed proxy warning

This commit is contained in:
nuclearfog 2024-02-04 19:42:01 +01:00
parent 3e13b834fe
commit 83c66b73d8
No known key found for this signature in database
GPG Key ID: 43E45B82006BC9D5
5 changed files with 13 additions and 74 deletions

View File

@ -90,7 +90,6 @@ public class GlobalSettings {
private static final String PROXY_PORT = "proxy_port";
private static final String PROXY_USER = "proxy_user";
private static final String PROXY_PASS = "proxy_pass";
private static final String PROXY_WARNING = "proxy_warning";
private static final String ENABLE_LIKE = "like_enable";
private static final String FILTER_RESULTS = "filter_results";
private static final String PUBLIC_TIMELINE = "public_timeline";
@ -156,7 +155,6 @@ public class GlobalSettings {
private boolean push_enabled;
private boolean isProxyEnabled;
private boolean isProxyAuthSet;
private boolean proxyWarning;
private boolean toolbarOverlap;
private boolean showStatusIcons;
private boolean filterResults;
@ -811,9 +809,6 @@ public class GlobalSettings {
edit.putString(PROXY_PASS, proxyPass);
edit.apply();
if (!proxyWarning) {
setProxyWarning(true);
}
notifySettingsChange();
}
@ -840,19 +835,6 @@ public class GlobalSettings {
notifySettingsChange();
}
/**
* enable/disable proxy warning
*
* @param enable true to enable proxy warning
*/
public void setProxyWarning(boolean enable) {
proxyWarning = enable;
Editor edit = settings.edit();
edit.putBoolean(PROXY_WARNING, enable);
edit.apply();
}
/**
* set proxy authentication enabled
*
@ -941,13 +923,6 @@ public class GlobalSettings {
return isProxyAuthSet;
}
/**
* check if proxy warning should be shown when trying to open external link
*/
public boolean isProxyWarningEnabled() {
return proxyWarning;
}
/**
* Check if current user is logged in
*
@ -1056,7 +1031,6 @@ public class GlobalSettings {
enableLike = settings.getBoolean(ENABLE_LIKE, false);
hideSensitive = settings.getBoolean(HIDE_SENSITIVE, true);
floatingEnabled = settings.getBoolean(FLOATING_BUTTON, true);
proxyWarning = settings.getBoolean(PROXY_WARNING, true);
publicTimeline = settings.getString(PUBLIC_TIMELINE, TIMELINE_COMBINED);
showAllAnnouncements = settings.getBoolean(ANNOUNCEMENTS_SHOW_ALL, false);
chrologicalTimeline = settings.getBoolean(CHRONOLOGICAL_TIMELINE, false);

View File

@ -137,7 +137,6 @@ public class ProfileActivity extends AppCompatActivity implements OnClickListene
private Relation relation;
@Nullable
private User user;
private String urlToRedirect;
@Override
@ -435,18 +434,16 @@ public class ProfileActivity extends AppCompatActivity implements OnClickListene
@Override
public void onTagClick(String text) {
public void onTagClick(String tag) {
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.KEY_QUERY, text);
intent.putExtra(SearchActivity.KEY_QUERY, tag);
startActivity(intent);
}
@Override
public void onLinkClick(String tag) {
if (ConfirmDialog.show(this, ConfirmDialog.CONTINUE_BROWSER, null)) {
urlToRedirect = tag;
}
public void onLinkClick(String link) {
LinkUtils.redirectToBrowser(this, link);
}
@ -471,9 +468,7 @@ public class ProfileActivity extends AppCompatActivity implements OnClickListene
// open link added to profile
else if (v.getId() == R.id.page_profile_links) {
if (!user.getProfileUrl().isEmpty()) {
if (ConfirmDialog.show(this, ConfirmDialog.CONTINUE_BROWSER, null)) {
urlToRedirect = user.getProfileUrl();
}
LinkUtils.redirectToBrowser(this, user.getProfileUrl());
}
}
// open profile image
@ -529,11 +524,6 @@ public class ProfileActivity extends AppCompatActivity implements OnClickListene
DomainAction.Param param = new DomainAction.Param(DomainAction.Param.MODE_BLOCK, url);
domainAction.execute(param, domainCallback);
}
// confirmed redirect to browser
else if (type == ConfirmDialog.CONTINUE_BROWSER) {
settings.setProxyWarning(!remember);
LinkUtils.redirectToBrowser(this, urlToRedirect);
}
}
}

View File

@ -683,7 +683,9 @@ public class StatusActivity extends AppCompatActivity implements OnClickListener
@Override
public void onCardClick(Card card, int type) {
if (type == OnCardClickListener.TYPE_LINK) {
//LinkUtils.openLink(this, card.getUrl());
if (!card.getUrl().isEmpty()) {
LinkUtils.redirectToBrowser(this, card.getUrl());
}
} else if (type == OnCardClickListener.TYPE_IMAGE) {
String imageUrl = card.getImageUrl();
if (!imageUrl.isEmpty()) {

View File

@ -133,11 +133,6 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener {
*/
public static final int FILTER_REMOVE = 626;
/**
* show notification when opening an external link while proxy is enabled
*/
public static final int CONTINUE_BROWSER = 627;
/**
* show 'unfollow tag' dialog
*/
@ -175,7 +170,7 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener {
*/
private static final String KEY_MESSAGE = "dialog-message";
private TextView title, message, remember_label;
private TextView title, message;
private Button confirm, cancel;
private CompoundButton remember;
@ -199,7 +194,6 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener {
title = view.findViewById(R.id.confirm_title);
message = view.findViewById(R.id.confirm_message);
remember = view.findViewById(R.id.confirm_remember);
remember_label = view.findViewById(R.id.confirm_remember_label);
GlobalSettings settings = GlobalSettings.get(requireContext());
if (savedInstanceState == null)
@ -385,14 +379,6 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener {
messageRes = R.string.confirm_remove_filter;
break;
case CONTINUE_BROWSER:
titleVis = View.VISIBLE;
remember_label.setVisibility(View.VISIBLE);
remember.setVisibility(View.VISIBLE);
titleRes = R.string.confirm_warning;
messageRes = R.string.confirm_proxy_bypass;
break;
case UNFOLLOW_TAG:
messageRes = R.string.confirm_tag_unfollow;
break;

View File

@ -15,15 +15,13 @@ import org.nuclearfog.twidda.backend.utils.LinkUtils;
import org.nuclearfog.twidda.model.lists.Fields;
import org.nuclearfog.twidda.ui.adapter.recyclerview.FieldAdapter;
import org.nuclearfog.twidda.ui.adapter.recyclerview.FieldAdapter.OnLinkClickListener;
import org.nuclearfog.twidda.ui.dialogs.ConfirmDialog;
import org.nuclearfog.twidda.ui.dialogs.ConfirmDialog.OnConfirmListener;
/**
* User field list fragment
*
* @author nuclearfog
*/
public class FieldFragment extends ListFragment implements OnLinkClickListener, OnConfirmListener, AsyncCallback<UserLoader.Result> {
public class FieldFragment extends ListFragment implements OnLinkClickListener, AsyncCallback<UserLoader.Result> {
public static final String KEY_ID = "user-id";
@ -33,7 +31,6 @@ public class FieldFragment extends ListFragment implements OnLinkClickListener,
private FieldAdapter adapter;
private long id;
private String urlToRedirect;
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
@ -82,8 +79,9 @@ public class FieldFragment extends ListFragment implements OnLinkClickListener,
@Override
public void onLinkClick(String url) {
if (!isRefreshing()) {
if (ConfirmDialog.show(this, ConfirmDialog.CONTINUE_BROWSER, null)) {
urlToRedirect = url;
Activity parent = getActivity();
if (parent != null) {
LinkUtils.redirectToBrowser(parent, url);
}
}
}
@ -105,17 +103,6 @@ public class FieldFragment extends ListFragment implements OnLinkClickListener,
}
@Override
public void onConfirm(int type, boolean remember) {
if (type == ConfirmDialog.CONTINUE_BROWSER) {
Activity parent = getActivity();
if (parent != null) {
LinkUtils.redirectToBrowser(parent, urlToRedirect);
}
}
}
@Override
public void onResult(@NonNull UserLoader.Result result) {
if (result.mode == UserLoader.Result.ONLINE) {