Add toast instead of crash if no email app installed.

master
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() {

View File

@ -20,7 +20,4 @@
android:id="@+id/menu_insights"
android:visible="false" />
<item android:title="@string/text_secure_normal__help"
android:id="@+id/menu_help"/>
</menu>

View File

@ -1450,7 +1450,7 @@
<string name="HelpFragment__emoji_3" translatable="false">emoji_3</string>
<string name="HelpFragment__emoji_2" translatable="false">emoji_2</string>
<string name="HelpFragment__emoji_1" translatable="false">emoji_1</string>
<string name="HelpFragment__link__debug_info" translatable="false">https://support.signal.org/hc/en-us/articles/360007318591-Debug-Logs-and-Crash-Reports</string>
<string name="HelpFragment__link__debug_info" translatable="false">https://support.signal.org/hc/articles/360007318591</string>
<string name="HelpFragment__link__faq" translatable="false">https://support.signal.org</string>
<string name="HelpFragment__support_info">Support Info</string>
<string name="HelpFragment__subject">Subject:</string>
@ -1464,6 +1464,7 @@
<string name="HelpFragment__could_not_upload_logs">Could not upload logs</string>
<string name="HelpFragment__signal_support">Signal Support</string>
<string name="HelpFragment__please_be_as_descriptive_as_possible">Please be as descriptive as possible to help us understand the issue.</string>
<string name="HelpFragment__no_email_app_found">No email app found.</string>
<!-- arrays.xml -->
<string name="arrays__import_export">Import</string>