Add Device Support Information to Feedback Intent #2494 (#2499)

* Add Device Support Information to Feedback Intent #2494

* Update Device Support Information for Feedback Intent #2494

* Update Device Support Information and used common method for Feedback Intent #2494

* Optimise code for Device Support Information for Feedback Intent #2494
This commit is contained in:
Madhur Gupta 2019-02-27 01:49:59 +05:30 committed by Vivek Maskara
parent ad4c444c92
commit 5a9cce0f79
4 changed files with 58 additions and 16 deletions

View file

@ -34,12 +34,13 @@ import fr.free.nrw.commons.R;
import fr.free.nrw.commons.WelcomeActivity;
import fr.free.nrw.commons.achievements.AchievementsActivity;
import fr.free.nrw.commons.auth.LoginActivity;
import fr.free.nrw.commons.auth.SessionManager;
import fr.free.nrw.commons.bookmarks.BookmarksActivity;
import fr.free.nrw.commons.category.CategoryImagesActivity;
import fr.free.nrw.commons.contributions.MainActivity;
import fr.free.nrw.commons.kvstore.BasicKvStore;
import fr.free.nrw.commons.logging.CommonsLogSender;
import fr.free.nrw.commons.settings.SettingsActivity;
import fr.free.nrw.commons.utils.ConfigUtils;
import timber.log.Timber;
public abstract class NavigationBaseActivity extends BaseActivity
@ -55,6 +56,7 @@ public abstract class NavigationBaseActivity extends BaseActivity
@BindView(R.id.drawer_layout)
DrawerLayout drawerLayout;
@Inject @Named("application_preferences") BasicKvStore applicationKvStore;
@Inject CommonsLogSender commonsLogSender;
private ActionBarDrawerToggle toggle;
@ -187,14 +189,18 @@ public abstract class NavigationBaseActivity extends BaseActivity
return true;
case R.id.action_feedback:
drawerLayout.closeDrawer(navigationView);
String technicalInfo = commonsLogSender.getExtraInfo();
Intent feedbackIntent = new Intent(Intent.ACTION_SENDTO);
feedbackIntent.setType("message/rfc822");
feedbackIntent.setData(Uri.parse("mailto:"));
feedbackIntent.putExtra(Intent.EXTRA_EMAIL,
new String[]{CommonsApplication.FEEDBACK_EMAIL});
feedbackIntent.putExtra(Intent.EXTRA_SUBJECT,
String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT,
ConfigUtils.getVersionNameWithSha(getApplicationContext())));
CommonsApplication.FEEDBACK_EMAIL_SUBJECT);
feedbackIntent.putExtra(Intent.EXTRA_TEXT, String.format(
"\n\n%s\n%s", CommonsApplication.FEEDBACK_EMAIL_TEMPLATE_HEADER, technicalInfo));
try {
startActivity(feedbackIntent);
} catch (ActivityNotFoundException e) {