MCPcopy Create free account
hub / github.com/M66B/FairEmail / cleanup

Method cleanup

app/src/main/java/eu/faircode/email/Shortcuts.java:371–389  ·  view source on GitHub ↗
(Context context)

Source from the content-addressed store, hash-verified

369 }
370
371 static void cleanup(Context context) {
372 if (!BuildConfig.DEBUG)
373 return;
374
375 DB db = DB.getInstance(context);
376 List<ShortcutInfoCompat> pinned =
377 ShortcutManagerCompat.getShortcuts(context, ShortcutManagerCompat.FLAG_MATCH_PINNED);
378 for (ShortcutInfoCompat shortcut : pinned) {
379 String[] id = shortcut.getId().split(":");
380 if (id.length == 2 && "message".equals(id[0])) {
381 Intent intent = shortcut.getIntent();
382 long account = intent.getLongExtra("account", -1L);
383 String thread = intent.getStringExtra("thread");
384 List<EntityMessage> messages = db.message().getMessagesByThread(account, thread, null, null);
385 if (messages != null && messages.size() == 0)
386 ; // Delete the shortcut, if only this was possible ...
387 }
388 }
389 }
390}

Callers 1

cleanupMethod · 0.95

Calls 7

getInstanceMethod · 0.95
messageMethod · 0.95
getMessagesByThreadMethod · 0.80
sizeMethod · 0.65
getIdMethod · 0.45
equalsMethod · 0.45
getIntentMethod · 0.45

Tested by

no test coverage detected