Show hint on WebXDC store
This commit is contained in:
parent
ad492d2848
commit
0eb1b40d28
4 changed files with 37 additions and 0 deletions
src/main
java
res/values
|
@ -2,6 +2,8 @@ package de.monocles.chat;
|
|||
|
||||
import static android.view.View.VISIBLE;
|
||||
import static eu.siacs.conversations.ui.ActionBarActivity.configureActionBar;
|
||||
import static eu.siacs.conversations.ui.SettingsActivity.HIDE_DONATION_SNACKBAR;
|
||||
import static eu.siacs.conversations.ui.SettingsActivity.HIDE_WEBXDC_STORE_HINT;
|
||||
import static eu.siacs.conversations.utils.AccountUtils.MANAGE_ACCOUNT_ACTIVITY;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
|
@ -9,10 +11,13 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.MenuItem;
|
||||
import android.webkit.DownloadListener;
|
||||
import android.webkit.URLUtil;
|
||||
|
@ -21,6 +26,7 @@ import android.webkit.WebView;
|
|||
import android.webkit.WebViewClient;
|
||||
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.services.ChannelDiscoveryService;
|
||||
import eu.siacs.conversations.ui.ConversationsActivity;
|
||||
import eu.siacs.conversations.ui.ShareWithActivity;
|
||||
import eu.siacs.conversations.ui.StartConversationActivity;
|
||||
|
@ -29,8 +35,10 @@ import eu.siacs.conversations.utils.MimeUtils;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
@ -119,6 +127,26 @@ public class WebXDCStore extends XmppActivity {
|
|||
recreate();
|
||||
}
|
||||
|
||||
// Show warning to use WebXDC unencrypted
|
||||
if (xmppConnectionService != null && !xmppConnectionService.getBooleanPreference("hide_webxdc_store_hint", R.bool.hide_webxdc_store_hint)) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.webxdc_store_hint_title);
|
||||
builder.setMessage(Html.fromHtml(getString(R.string.webxdc_store_hint_summary)));
|
||||
builder.setNegativeButton(R.string.ok, (dialog, which) -> finish());
|
||||
builder.setPositiveButton(R.string.hide_warning, (dialog, which) -> HideWarning());
|
||||
builder.setOnCancelListener(dialog -> finish());
|
||||
final AlertDialog dialog = builder.create();
|
||||
dialog.setOnShowListener(d -> {
|
||||
final TextView textView = dialog.findViewById(android.R.id.message);
|
||||
if (textView == null) {
|
||||
return;
|
||||
}
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
});
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
// Initialize and assign variable
|
||||
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
|
||||
|
||||
|
@ -171,4 +199,9 @@ public class WebXDCStore extends XmppActivity {
|
|||
protected void onBackendConnected() {
|
||||
|
||||
}
|
||||
|
||||
private void HideWarning() {
|
||||
SharedPreferences preferences = xmppConnectionService.getPreferences();
|
||||
preferences.edit().putBoolean(HIDE_WEBXDC_STORE_HINT, true).apply();
|
||||
}
|
||||
}
|
|
@ -91,6 +91,7 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
|
|||
public static final String WARN_UNENCRYPTED_CHAT = "warn_unencrypted_chat";
|
||||
public static final String HIDE_YOU_ARE_NOT_PARTICIPATING = "hide_you_are_not_participating";
|
||||
public static final String HIDE_DONATION_SNACKBAR = "hide_donation_snackbar";
|
||||
public static final String HIDE_WEBXDC_STORE_HINT = "hide_webxdc_store_hint";
|
||||
public static final String APP_IS_LOCKED = "app_is_locked";
|
||||
public static final String HIDE_MEMORY_WARNING = "hide_memory_warning";
|
||||
public static final String THEME = "theme";
|
||||
|
|
|
@ -16,4 +16,5 @@
|
|||
<bool name="app_lock_enabled">false</bool>
|
||||
<bool name="open_links_inapp">true</bool>
|
||||
<bool name="accept_invites_from_strangers">false</bool>
|
||||
<bool name="hide_webxdc_store_hint">false</bool>
|
||||
</resources>
|
|
@ -1467,4 +1467,6 @@
|
|||
<string name="server_info_bind2">XEP-0386: Bind 2</string>
|
||||
<string name="server_info_sasl2">XEP-0388: Extensible SASL Profile</string>
|
||||
<string name="server_info_login_mechanism">Login mechanism</string>
|
||||
<string name="webxdc_store_hint_title">WebXDC usage</string>
|
||||
<string name="webxdc_store_hint_summary">To use WebXDC apps you need to disable encryption when sending the WebXDC. Please enable encryption afterwards again.</string>
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Reference in a new issue