Conditional always confirm

pull/210/head
M66B 2 years ago
parent 100cd710dc
commit 29698d3a92

@ -156,6 +156,7 @@ public class ActivityEML extends ActivityBase {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putParcelable("uri", uri); args.putParcelable("uri", uri);
args.putString("title", title); args.putString("title", title);
args.putBoolean("always_confirm", true);
FragmentDialogOpenLink fragment = new FragmentDialogOpenLink(); FragmentDialogOpenLink fragment = new FragmentDialogOpenLink();
fragment.setArguments(args); fragment.setArguments(args);

@ -5937,13 +5937,15 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
String scheme = guri.getScheme(); String scheme = guri.getScheme();
String host = guri.getHost(); String host = guri.getHost();
boolean sanitize_links = prefs.getBoolean("sanitize_links", false);
boolean confirm_link = boolean confirm_link =
!"https".equalsIgnoreCase(scheme) || TextUtils.isEmpty(host) || !"https".equalsIgnoreCase(scheme) || TextUtils.isEmpty(host) ||
prefs.getBoolean(host + ".confirm_link", true); prefs.getBoolean(host + ".confirm_link", true);
if (always_confirm || (confirm_links && confirm_link)) { if (always_confirm || sanitize_links || (confirm_links && confirm_link)) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putParcelable("uri", uri); args.putParcelable("uri", uri);
args.putString("title", title); args.putString("title", title);
args.putBoolean("always_confirm", always_confirm);
FragmentDialogOpenLink fragment = new FragmentDialogOpenLink(); FragmentDialogOpenLink fragment = new FragmentDialogOpenLink();
fragment.setArguments(args); fragment.setArguments(args);

@ -993,6 +993,7 @@ public class FragmentCompose extends FragmentBase {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putParcelable("uri", uri); args.putParcelable("uri", uri);
args.putString("title", title); args.putString("title", title);
args.putBoolean("always_confirm", true);
FragmentDialogOpenLink fragment = new FragmentDialogOpenLink(); FragmentDialogOpenLink fragment = new FragmentDialogOpenLink();
fragment.setArguments(args); fragment.setArguments(args);

@ -104,13 +104,15 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
Uri _uri = getArguments().getParcelable("uri"); Bundle a = getArguments();
String _title = getArguments().getString("title"); Uri _uri = a.getParcelable("uri");
String _title = a.getString("title");
if (_title != null) if (_title != null)
_title = _title.replace("\uFFFC", ""); // Object replacement character _title = _title.replace("\uFFFC", ""); // Object replacement character
if (TextUtils.isEmpty(_title)) if (TextUtils.isEmpty(_title))
_title = null; _title = null;
final String title = _title; final String title = _title;
final boolean always_confirm = a.getBoolean("always_confirm", false);
final Context context = getContext(); final Context context = getContext();
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
@ -580,7 +582,10 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
cbNotAgain.setText(context.getString(R.string.title_no_ask_for_again, uri.getHost())); cbNotAgain.setText(context.getString(R.string.title_no_ask_for_again, uri.getHost()));
cbNotAgain.setVisibility( cbNotAgain.setVisibility(
UriHelper.isSecure(uri) && !TextUtils.isEmpty(uri.getHost()) !always_confirm &&
!sanitize_links &&
UriHelper.isSecure(uri) &&
!TextUtils.isEmpty(uri.getHost())
? View.VISIBLE : View.GONE); ? View.VISIBLE : View.GONE);
setMore(false); setMore(false);

@ -228,6 +228,7 @@ public class ProtectedContent {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putParcelable("uri", uri); args.putParcelable("uri", uri);
args.putString("title", title); args.putString("title", title);
args.putBoolean("always_confirm", true);
FragmentDialogOpenLink fragment = new FragmentDialogOpenLink(); FragmentDialogOpenLink fragment = new FragmentDialogOpenLink();
fragment.setArguments(args); fragment.setArguments(args);

Loading…
Cancel
Save