mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-29 11:15:51 +00:00
Add report issue to nav menu in beta releases
This commit is contained in:
parent
37af4aeaec
commit
d8b80cef9f
3 changed files with 33 additions and 21 deletions
|
@ -302,6 +302,15 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
}
|
||||
}));
|
||||
|
||||
if (BuildConfig.DEBUG && Helper.getIntentIssue(this).resolveActivity(pm) != null)
|
||||
extra.add(new NavMenuItem(R.drawable.baseline_warning_24, R.string.menu_issue, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
drawerLayout.closeDrawer(drawerContainer);
|
||||
onMenuIssue();
|
||||
}
|
||||
}));
|
||||
|
||||
if (Helper.getIntentPrivacy().resolveActivity(pm) != null)
|
||||
extra.add(new NavMenuItem(R.drawable.baseline_account_box_24, R.string.menu_privacy, new Runnable() {
|
||||
@Override
|
||||
|
@ -938,6 +947,10 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
Helper.view(this, this, Helper.getIntentFAQ());
|
||||
}
|
||||
|
||||
private void onMenuIssue() {
|
||||
startActivity(Helper.getIntentIssue(this));
|
||||
}
|
||||
|
||||
private void onMenuPrivacy() {
|
||||
Helper.view(this, this, Helper.getIntentPrivacy());
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@ import android.widget.TextView;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public class FragmentAbout extends FragmentBase {
|
||||
@Override
|
||||
@Nullable
|
||||
|
@ -65,9 +63,10 @@ public class FragmentAbout extends FragmentBase {
|
|||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
menu.findItem(R.id.menu_changelog).setVisible(
|
||||
!Helper.isPlayStoreInstall(getContext()) && getIntentChangelog().resolveActivity(pm) != null);
|
||||
!Helper.isPlayStoreInstall(getContext()) &&
|
||||
getIntentChangelog().resolveActivity(pm) != null);
|
||||
menu.findItem(R.id.menu_issue).setVisible(
|
||||
BuildConfig.BETA_RELEASE && getIntentIssue().resolveActivity(pm) != null);
|
||||
Helper.getIntentIssue(getContext()).resolveActivity(pm) != null);
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
@ -90,7 +89,7 @@ public class FragmentAbout extends FragmentBase {
|
|||
}
|
||||
|
||||
private void onMenuIssue() {
|
||||
startActivity(getIntentIssue());
|
||||
startActivity(Helper.getIntentIssue(getContext()));
|
||||
}
|
||||
|
||||
private Intent getIntentChangelog() {
|
||||
|
@ -98,20 +97,4 @@ public class FragmentAbout extends FragmentBase {
|
|||
intent.setData(Uri.parse(BuildConfig.CHANGELOG));
|
||||
return intent;
|
||||
}
|
||||
|
||||
private Intent getIntentIssue() {
|
||||
String version = BuildConfig.VERSION_NAME + "/" +
|
||||
(Helper.hasValidFingerprint(getContext()) ? "1" : "3") +
|
||||
(Helper.isPro(getContext()) ? "+" : "");
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setPackage(BuildConfig.APPLICATION_ID);
|
||||
intent.setType("text/plain");
|
||||
try {
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{Helper.myAddress().getAddress()});
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.title_issue_subject, version));
|
||||
return intent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,6 +230,22 @@ public class Helper {
|
|||
return intent;
|
||||
}
|
||||
|
||||
static Intent getIntentIssue(Context context) {
|
||||
String version = BuildConfig.VERSION_NAME + "/" +
|
||||
(Helper.hasValidFingerprint(context) ? "1" : "3") +
|
||||
(Helper.isPro(context) ? "+" : "");
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setPackage(BuildConfig.APPLICATION_ID);
|
||||
intent.setType("text/plain");
|
||||
try {
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{Helper.myAddress().getAddress()});
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.title_issue_subject, version));
|
||||
return intent;
|
||||
}
|
||||
|
||||
static int dp2pixels(Context context, int dp) {
|
||||
float scale = context.getResources().getDisplayMetrics().density;
|
||||
return Math.round(dp * scale);
|
||||
|
|
Loading…
Reference in a new issue