From 53bc5db0c544059800f0efcf7c711ab09a43dbeb Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 27 Jan 2019 12:35:23 +0000 Subject: [PATCH] Added report issue --- .../java/eu/faircode/email/ActivityView.java | 69 +++++++++++++------ .../drawable/baseline_report_problem_24.xml | 10 +++ app/src/main/res/values/strings.xml | 8 ++- 3 files changed, 63 insertions(+), 24 deletions(-) create mode 100644 app/src/main/res/drawable/baseline_report_problem_24.xml diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 0b4dbe3c6e..b3cc927cdc 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -71,6 +71,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; +import java.io.UnsupportedEncodingException; import java.net.URL; import java.text.Collator; import java.util.ArrayList; @@ -189,30 +190,35 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB case R.string.menu_operations: onMenuOperations(); break; - case R.string.menu_pro: - onMenuPro(); - break; case R.string.menu_setup: onMenuSetup(); break; + case R.string.menu_legend: onMenuLegend(); break; case R.string.menu_faq: onMenuFAQ(); break; + case R.string.menu_issue: + onMenuIssue(); + break; case R.string.menu_privacy: onMenuPrivacy(); break; case R.string.menu_about: onMenuAbout(); break; - case R.string.menu_rate: - onMenuRate(); + + case R.string.menu_pro: + onMenuPro(); break; case R.string.menu_invite: onMenuInvite(); break; + case R.string.menu_rate: + onMenuRate(); + break; case R.string.menu_other: onMenuOtherApps(); break; @@ -314,6 +320,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB if (Helper.getIntentFAQ().resolveActivity(getPackageManager()) != null) drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_question_answer_24, R.string.menu_faq)); + if (!BuildConfig.PLAY_STORE_RELEASE) + drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_report_problem_24, R.string.menu_issue)); + if (Helper.getIntentPrivacy().resolveActivity(getPackageManager()) != null) drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_account_box_24, R.string.menu_privacy)); @@ -802,13 +811,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB sm.setDynamicShortcuts(shortcuts); } - private Intent getIntentRate() { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + BuildConfig.APPLICATION_ID)); - if (intent.resolveActivity(getPackageManager()) == null) - intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID)); - return intent; - } - private Intent getIntentInvite() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); @@ -817,6 +819,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB return intent; } + private Intent getIntentRate() { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + BuildConfig.APPLICATION_ID)); + if (intent.resolveActivity(getPackageManager()) == null) + intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID)); + return intent; + } + private Intent getIntentOtherApps() { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("https://play.google.com/store/apps/dev?id=8420080860664580239")); @@ -897,6 +906,22 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB Helper.view(this, this, Helper.getIntentFAQ()); } + private void onMenuIssue() { + try { + String version = BuildConfig.VERSION_NAME + "/" + + (Helper.hasValidFingerprint(this) ? "1" : "3") + + (Helper.isPro(this) ? "+" : ""); + Intent issue = new Intent(Intent.ACTION_SEND); + issue.setPackage(BuildConfig.APPLICATION_ID); + issue.setType("text/plain"); + issue.putExtra(Intent.EXTRA_EMAIL, new String[]{Helper.myAddress().getAddress()}); + issue.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.title_issue_subject, version)); + startActivity(issue); + } catch (UnsupportedEncodingException ex) { + Helper.unexpectedError(this, this, ex); + } + } + private void onMenuPrivacy() { Helper.view(this, this, Helper.getIntentPrivacy()); } @@ -907,6 +932,16 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB fragmentTransaction.commit(); } + private void onMenuPro() { + FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); + fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro"); + fragmentTransaction.commit(); + } + + private void onMenuInvite() { + startActivity(getIntentInvite()); + } + private void onMenuRate() { Intent faq = Helper.getIntentFAQ(); if (faq.resolveActivity(getPackageManager()) == null) @@ -930,16 +965,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB } } - private void onMenuPro() { - FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); - fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro"); - fragmentTransaction.commit(); - } - - private void onMenuInvite() { - startActivity(getIntentInvite()); - } - private void onMenuOtherApps() { Helper.view(this, this, getIntentOtherApps()); } diff --git a/app/src/main/res/drawable/baseline_report_problem_24.xml b/app/src/main/res/drawable/baseline_report_problem_24.xml new file mode 100644 index 0000000000..c18093a7fc --- /dev/null +++ b/app/src/main/res/drawable/baseline_report_problem_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6d4c4408b4..ac39487114 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,14 +54,17 @@ \'%1$s\' failed - Setup Templates Operations + Setup + Legend Support - Pro features + Report issue Privacy About + + Pro features Invite Rate this app Other apps @@ -492,6 +495,7 @@ Debug info Please describe the problem and indicate the time of the problem: Please describe what you were doing when the app crashed: + FairEmail %1$s issue 16 KB