Add toast instead of crash if no email app installed.

This commit is contained in:
Alex Hart
2020-03-06 10:34:00 -04:00
committed by Greyson Parrelli
parent bf5331ba6e
commit 79fc33630b
4 changed files with 7 additions and 15 deletions

View File

@@ -298,7 +298,6 @@ public class ConversationListFragment extends MainFragment implements LoaderMana
case R.id.menu_mark_all_read: handleMarkAllRead(); return true;
case R.id.menu_invite: handleInvite(); return true;
case R.id.menu_insights: handleInsights(); return true;
case R.id.menu_help: handleHelp(); return true;
}
return false;
@@ -597,14 +596,6 @@ public class ConversationListFragment extends MainFragment implements LoaderMana
getNavigator().goToInsights();
}
private void handleHelp() {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://support.signal.org")));
} catch (ActivityNotFoundException e) {
Toast.makeText(requireActivity(), R.string.ConversationListActivity_there_is_no_browser_installed_on_your_device, Toast.LENGTH_LONG).show();
}
}
@SuppressLint("StaticFieldLeak")
private void handleArchiveAllSelected() {
Set<Long> selectedConversations = new HashSet<>(defaultAdapter.getBatchSelections());

View File

@@ -1,7 +1,6 @@
package org.thoughtcrime.securesms.help;
import android.content.Intent;
import android.content.pm.LabeledIntent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -157,7 +156,11 @@ public class HelpFragment extends Fragment {
intent.putExtra(Intent.EXTRA_SUBJECT, getEmailSubject());
intent.putExtra(Intent.EXTRA_TEXT, body.toString());
startActivity(intent);
if (IntentUtils.isResolvable(requireContext(), intent)) {
startActivity(intent);
} else {
Toast.makeText(requireContext(), R.string.HelpFragment__no_email_app_found, Toast.LENGTH_LONG).show();
}
}
private String getEmailSubject() {