mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
* 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:
parent
ad4c444c92
commit
5a9cce0f79
4 changed files with 58 additions and 16 deletions
|
|
@ -70,10 +70,12 @@ public class CommonsApplication extends Application {
|
|||
|
||||
public static final String FEEDBACK_EMAIL = "commons-app-android@googlegroups.com";
|
||||
|
||||
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App (%s) Feedback";
|
||||
public static final String FEEDBACK_EMAIL_SUBJECT = "Commons Android App Feedback";
|
||||
|
||||
public static final String NOTIFICATION_CHANNEL_ID_ALL = "CommonsNotificationAll";
|
||||
|
||||
public static final String FEEDBACK_EMAIL_TEMPLATE_HEADER = "-- Technical information --";
|
||||
|
||||
/**
|
||||
* Constants End
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -42,32 +42,50 @@ public class CommonsLogSender extends LogsSender {
|
|||
* @return String with extra meta information useful for debugging
|
||||
*/
|
||||
@Override
|
||||
protected String getExtraInfo() {
|
||||
public String getExtraInfo() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("App Version Name: ")
|
||||
.append(ConfigUtils.getVersionNameWithSha(context))
|
||||
|
||||
// Getting API Level
|
||||
builder.append("API level: ")
|
||||
.append(DeviceInfoUtil.getAPILevel())
|
||||
.append("\n");
|
||||
|
||||
builder.append("User Name: ")
|
||||
.append(sessionManager.getUserName())
|
||||
.append("\n");
|
||||
|
||||
builder.append("Network Type: ")
|
||||
.append(DeviceInfoUtil.getConnectionType(context))
|
||||
// Getting Android Version
|
||||
builder.append("Android version: ")
|
||||
.append(DeviceInfoUtil.getAndroidVersion())
|
||||
.append("\n");
|
||||
|
||||
// Getting Device Manufacturer
|
||||
builder.append("Device manufacturer: ")
|
||||
.append(DeviceInfoUtil.getDeviceManufacturer())
|
||||
.append("\n");
|
||||
|
||||
// Getting Device Model
|
||||
builder.append("Device model: ")
|
||||
.append(DeviceInfoUtil.getDeviceModel())
|
||||
.append("\n");
|
||||
|
||||
builder.append("Android Version: ")
|
||||
.append(DeviceInfoUtil.getAndroidVersion())
|
||||
// Getting Device Name
|
||||
builder.append("Device: ")
|
||||
.append(DeviceInfoUtil.getDevice())
|
||||
.append("\n");
|
||||
|
||||
// Getting Network Type
|
||||
builder.append("Network type: ")
|
||||
.append(DeviceInfoUtil.getConnectionType(context))
|
||||
.append("\n");
|
||||
|
||||
// Getting App Version
|
||||
builder.append("App version name: ")
|
||||
.append(ConfigUtils.getVersionNameWithSha(context))
|
||||
.append("\n");
|
||||
|
||||
// Getting Username
|
||||
builder.append("User name: ")
|
||||
.append(sessionManager.getUserName())
|
||||
.append("\n");
|
||||
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class DeviceInfoUtil {
|
|||
* @return
|
||||
*/
|
||||
public static String getDeviceModel() {
|
||||
return Build.DEVICE;
|
||||
return Build.MODEL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,4 +72,20 @@ public class DeviceInfoUtil {
|
|||
public static String getAndroidVersion() {
|
||||
return Build.VERSION.RELEASE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get API Level. Eg. 26
|
||||
* @return
|
||||
*/
|
||||
public static String getAPILevel() {
|
||||
return Build.VERSION.SDK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Device.
|
||||
* @return
|
||||
*/
|
||||
public static String getDevice() {
|
||||
return Build.DEVICE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue