Skip to content

Commit

Permalink
Add toast instead of crash if no email app installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal authored and greyson-signal committed Mar 7, 2020
1 parent bf5331b commit 79fc336
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
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;
Expand Down Expand Up @@ -597,14 +596,6 @@ private void handleInsights() {
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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -157,7 +156,11 @@ private void submitFormWithDebugLog(@Nullable String debugLog) {
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() {
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/menu/text_secure_normal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit 79fc336

Please sign in to comment.