mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 18:27:43 +00:00
Use intent type to target right process receiver
This commit is contained in:
parent
4342362c6f
commit
beee8574fd
2 changed files with 16 additions and 6 deletions
|
@ -94,11 +94,17 @@ public class EntityOperation {
|
||||||
operation.args = jsonArray.toString();
|
operation.args = jsonArray.toString();
|
||||||
operation.id = dao.insertOperation(operation);
|
operation.id = dao.insertOperation(operation);
|
||||||
|
|
||||||
|
Intent intent = new Intent();
|
||||||
|
if (SEND.equals(name))
|
||||||
|
intent.setAction(ServiceSynchronize.ACTION_PROCESS_OUTBOX);
|
||||||
|
else {
|
||||||
|
intent.setType("account/" + message.account);
|
||||||
|
intent.setAction(ServiceSynchronize.ACTION_PROCESS_FOLDER);
|
||||||
|
}
|
||||||
|
intent.putExtra("folder", message.folder);
|
||||||
|
|
||||||
synchronized (queue) {
|
synchronized (queue) {
|
||||||
queue.add(new Intent(SEND.equals(name)
|
queue.add(intent);
|
||||||
? ServiceSynchronize.ACTION_PROCESS_OUTBOX
|
|
||||||
: ServiceSynchronize.ACTION_PROCESS_FOLDER)
|
|
||||||
.putExtra("folder", message.folder));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(Helper.TAG, "Queued op=" + operation.id + "/" + name +
|
Log.i(Helper.TAG, "Queued op=" + operation.id + "/" + name +
|
||||||
|
|
|
@ -392,12 +392,16 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IntentFilter f = new IntentFilter(ACTION_PROCESS_FOLDER);
|
||||||
|
f.addDataType("account/" + account.id);
|
||||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(ServiceSynchronize.this);
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(ServiceSynchronize.this);
|
||||||
lbm.registerReceiver(processReceiver, new IntentFilter(ACTION_PROCESS_FOLDER));
|
lbm.registerReceiver(processReceiver, f);
|
||||||
Log.i(Helper.TAG, "listen process folder");
|
Log.i(Helper.TAG, "listen process folder");
|
||||||
for (final EntityFolder folder : db.folder().getFolders(account.id))
|
for (final EntityFolder folder : db.folder().getFolders(account.id))
|
||||||
if (!EntityFolder.TYPE_OUTBOX.equals(folder.type))
|
if (!EntityFolder.TYPE_OUTBOX.equals(folder.type))
|
||||||
lbm.sendBroadcast(new Intent(ACTION_PROCESS_FOLDER).putExtra("folder", folder.id));
|
lbm.sendBroadcast(new Intent(ACTION_PROCESS_FOLDER)
|
||||||
|
.setType("account/" + account.id)
|
||||||
|
.putExtra("folder", folder.id));
|
||||||
|
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(Helper.TAG, account.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
Log.e(Helper.TAG, account.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||||
|
|
Loading…
Reference in a new issue