1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 01:36:55 +00:00

Added logging

This commit is contained in:
M66B 2020-09-26 07:43:07 +02:00
parent 9e00908a38
commit 0bfc63c490
2 changed files with 18 additions and 4 deletions

View file

@ -375,6 +375,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
@Override @Override
public void startActivity(Intent intent) { public void startActivity(Intent intent) {
try { try {
Log.i("Start intent=" + intent);
Log.logExtras(intent);
super.startActivity(intent); super.startActivity(intent);
} catch (ActivityNotFoundException ex) { } catch (ActivityNotFoundException ex) {
Log.w(ex); Log.w(ex);
@ -388,6 +390,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
@Override @Override
public void startActivityForResult(Intent intent, int requestCode) { public void startActivityForResult(Intent intent, int requestCode) {
try { try {
Log.i("Start intent=" + intent + " request=" + requestCode);
Log.logExtras(intent);
super.startActivityForResult(intent, requestCode); super.startActivityForResult(intent, requestCode);
} catch (ActivityNotFoundException ex) { } catch (ActivityNotFoundException ex) {
Log.w(ex); Log.w(ex);

View file

@ -140,6 +140,8 @@ public class FragmentBase extends Fragment {
@Override @Override
public void startActivity(Intent intent) { public void startActivity(Intent intent) {
try { try {
Log.i("Start intent=" + intent);
Log.logExtras(intent);
super.startActivity(intent); super.startActivity(intent);
} catch (ActivityNotFoundException ex) { } catch (ActivityNotFoundException ex) {
Log.w(ex); Log.w(ex);
@ -153,6 +155,8 @@ public class FragmentBase extends Fragment {
@Override @Override
public void startActivityForResult(Intent intent, int requestCode) { public void startActivityForResult(Intent intent, int requestCode) {
try { try {
Log.i("Start intent=" + intent + " request=" + requestCode);
Log.logExtras(intent);
super.startActivityForResult(intent, requestCode); super.startActivityForResult(intent, requestCode);
} catch (ActivityNotFoundException ex) { } catch (ActivityNotFoundException ex) {
Log.w(ex); Log.w(ex);
@ -382,26 +386,32 @@ public class FragmentBase extends Fragment {
private void onStoreAttachment(Intent intent) { private void onStoreAttachment(Intent intent) {
attachment = intent.getLongExtra("id", -1); attachment = intent.getLongExtra("id", -1);
Log.i("Save attachment id=" + attachment);
Intent create = new Intent(Intent.ACTION_CREATE_DOCUMENT); Intent create = new Intent(Intent.ACTION_CREATE_DOCUMENT);
create.addCategory(Intent.CATEGORY_OPENABLE); create.addCategory(Intent.CATEGORY_OPENABLE);
create.setType(intent.getStringExtra("type")); create.setType(intent.getStringExtra("type"));
create.putExtra(Intent.EXTRA_TITLE, intent.getStringExtra("name")); create.putExtra(Intent.EXTRA_TITLE, intent.getStringExtra("name"));
Helper.openAdvanced(create); Helper.openAdvanced(create);
PackageManager pm = getContext().getPackageManager(); PackageManager pm = getContext().getPackageManager();
if (create.resolveActivity(pm) == null) // system whitelisted if (create.resolveActivity(pm) == null) { // system whitelisted
Log.w("SAF missing");
ToastEx.makeText(getContext(), R.string.title_no_saf, Toast.LENGTH_LONG).show(); ToastEx.makeText(getContext(), R.string.title_no_saf, Toast.LENGTH_LONG).show();
else } else
startActivityForResult(Helper.getChooser(getContext(), create), REQUEST_ATTACHMENT); startActivityForResult(Helper.getChooser(getContext(), create), REQUEST_ATTACHMENT);
} }
private void onStoreAttachments(Intent intent) { private void onStoreAttachments(Intent intent) {
message = intent.getLongExtra("id", -1); message = intent.getLongExtra("id", -1);
Log.i("Save attachments message=" + message);
Intent tree = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); Intent tree = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
Helper.openAdvanced(tree); Helper.openAdvanced(tree);
PackageManager pm = getContext().getPackageManager(); PackageManager pm = getContext().getPackageManager();
if (tree.resolveActivity(pm) == null) // system whitelisted if (tree.resolveActivity(pm) == null) { // system whitelisted
Log.w("SAF missing");
ToastEx.makeText(getContext(), R.string.title_no_saf, Toast.LENGTH_LONG).show(); ToastEx.makeText(getContext(), R.string.title_no_saf, Toast.LENGTH_LONG).show();
else } else
startActivityForResult(Helper.getChooser(getContext(), tree), REQUEST_ATTACHMENTS); startActivityForResult(Helper.getChooser(getContext(), tree), REQUEST_ATTACHMENTS);
} }