mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Merge pull request #1315 from gupta-meghna64/logClientFix
Removes unsupported clients while sharing log
This commit is contained in:
commit
d15e1d90e0
1 changed files with 19 additions and 9 deletions
|
|
@ -3,10 +3,13 @@ package fr.free.nrw.commons.settings;
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ResolveInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
@ -21,6 +24,8 @@ import android.support.v4.content.FileProvider;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
@ -141,19 +146,24 @@ public class SettingsFragment extends PreferenceFragment {
|
||||||
appLogsFile
|
appLogsFile
|
||||||
);
|
);
|
||||||
|
|
||||||
Intent feedbackIntent = new Intent(Intent.ACTION_SEND);
|
//initialize the emailSelectorIntent
|
||||||
feedbackIntent.setType("message/rfc822");
|
Intent emailSelectorIntent = new Intent(Intent.ACTION_SENDTO);
|
||||||
feedbackIntent.putExtra(Intent.EXTRA_EMAIL,
|
emailSelectorIntent.setData(Uri.parse("mailto:"));
|
||||||
new String[]{CommonsApplication.LOGS_PRIVATE_EMAIL});
|
//initialize the emailIntent
|
||||||
feedbackIntent.putExtra(Intent.EXTRA_SUBJECT,
|
final Intent emailIntent = new Intent(Intent.ACTION_SEND);
|
||||||
String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT,
|
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{CommonsApplication.FEEDBACK_EMAIL});
|
||||||
BuildConfig.VERSION_NAME));
|
emailIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT, BuildConfig.VERSION_NAME));
|
||||||
feedbackIntent.putExtra(Intent.EXTRA_STREAM,appLogsFilePath);
|
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
emailIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||||
|
emailIntent.setSelector( emailSelectorIntent );
|
||||||
|
//adding the attachment to the intent
|
||||||
|
emailIntent.putExtra(Intent.EXTRA_STREAM, appLogsFilePath);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startActivity(feedbackIntent);
|
startActivity(Intent.createChooser(emailIntent, "Send mail.."));
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Toast.makeText(getActivity(), R.string.no_email_client, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), R.string.no_email_client, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue