(Context context)
| 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 | } |
no test coverage detected