mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 15:11:03 +00:00
Added task breadcrumbs
This commit is contained in:
parent
4a3d266318
commit
da65d6f264
3 changed files with 23 additions and 8 deletions
|
@ -799,7 +799,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
|
||||
}
|
||||
}.execute(context, owner, aargs, "message:avatar");
|
||||
}.setLog(false).execute(context, owner, aargs, "message:avatar");
|
||||
} else
|
||||
bindContactInfo(info, message);
|
||||
|
||||
|
@ -1122,7 +1122,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
|
||||
}
|
||||
}.execute(context, owner, sargs, "message:actions");
|
||||
}.setLog(false).execute(context, owner, sargs, "message:actions");
|
||||
|
||||
// Message text
|
||||
pbBody.setVisibility(suitable || message.content ? View.VISIBLE : View.GONE);
|
||||
|
@ -1309,7 +1309,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
|
||||
}
|
||||
}.execute(context, owner, args, "message:calendar");
|
||||
}.setLog(false).execute(context, owner, args, "message:calendar");
|
||||
}
|
||||
|
||||
private void onActionCalendar(TupleMessageEx message, int action) {
|
||||
|
@ -2379,7 +2379,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
args.putBoolean("show_images", show_images);
|
||||
args.putBoolean("show_quotes", show_quotes);
|
||||
args.putInt("zoom", zoom);
|
||||
bodyTask.setCount(false).execute(context, owner, args, "message:body");
|
||||
bodyTask.setLog(false).setCount(false).execute(context, owner, args, "message:body");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3044,7 +3044,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getFragmentManager(), ex);
|
||||
}
|
||||
}.execute(this, args, "messages:navigation");
|
||||
}.setLog(false).execute(this, args, "messages:navigation");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -3118,7 +3118,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(getFragmentManager(), ex);
|
||||
}
|
||||
}.execute(this, args, "messages:expand");
|
||||
}.setLog(false).execute(this, args, "messages:expand");
|
||||
}
|
||||
|
||||
private void handleAutoClose() {
|
||||
|
|
|
@ -35,7 +35,9 @@ import androidx.lifecycle.OnLifecycleEvent;
|
|||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
@ -44,6 +46,7 @@ import java.util.concurrent.Executors;
|
|||
// Results will not be delivered to destroyed fragments
|
||||
|
||||
public abstract class SimpleTask<T> implements LifecycleObserver {
|
||||
private boolean log = true;
|
||||
private boolean count = true;
|
||||
private int executing = 0;
|
||||
|
||||
|
@ -54,6 +57,11 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
|
||||
static final String ACTION_TASK_COUNT = BuildConfig.APPLICATION_ID + ".ACTION_TASK_COUNT";
|
||||
|
||||
public SimpleTask<T> setLog(boolean log) {
|
||||
this.log = log;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SimpleTask<T> setCount(boolean count) {
|
||||
this.count = count;
|
||||
return this;
|
||||
|
@ -158,9 +166,16 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
|||
Log.e(ex);
|
||||
} finally {
|
||||
try {
|
||||
if (ex == null)
|
||||
if (ex == null) {
|
||||
if (log && BuildConfig.BETA_RELEASE) {
|
||||
Log.i("Crumb " + name);
|
||||
Map<String, String> crumb = new HashMap<>();
|
||||
crumb.put("name", name);
|
||||
Log.breadcrumb("task", crumb);
|
||||
}
|
||||
|
||||
onExecuted(args, (T) data);
|
||||
else
|
||||
} else
|
||||
onException(args, ex);
|
||||
} catch (Throwable ex) {
|
||||
onException(args, ex);
|
||||
|
|
Loading…
Reference in a new issue