mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Set LocusID on shortcut and notification for on device intelligence.
This commit is contained in:
@@ -7,6 +7,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.core.app.Person;
|
||||
import androidx.core.content.LocusIdCompat;
|
||||
import androidx.core.content.pm.ShortcutInfoCompat;
|
||||
import androidx.core.content.pm.ShortcutManagerCompat;
|
||||
|
||||
@@ -193,13 +194,14 @@ public final class ConversationUtil {
|
||||
@NonNull Recipient recipient,
|
||||
int rank)
|
||||
{
|
||||
Recipient resolved = recipient.resolve();
|
||||
Person[] persons = buildPersons(context, resolved);
|
||||
Long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(resolved.getId());
|
||||
String shortName = resolved.isSelf() ? context.getString(R.string.note_to_self) : resolved.getShortDisplayName(context);
|
||||
String longName = resolved.isSelf() ? context.getString(R.string.note_to_self) : resolved.getDisplayName(context);
|
||||
|
||||
return new ShortcutInfoCompat.Builder(context, getShortcutId(resolved))
|
||||
Recipient resolved = recipient.resolve();
|
||||
Person[] persons = buildPersons(context, resolved);
|
||||
Long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(resolved.getId());
|
||||
String shortName = resolved.isSelf() ? context.getString(R.string.note_to_self) : resolved.getShortDisplayName(context);
|
||||
String longName = resolved.isSelf() ? context.getString(R.string.note_to_self) : resolved.getDisplayName(context);
|
||||
String shortcutId = getShortcutId(resolved);
|
||||
|
||||
return new ShortcutInfoCompat.Builder(context, shortcutId)
|
||||
.setLongLived(true)
|
||||
.setIntent(ConversationIntents.createBuilder(context, resolved.getId(), threadId != null ? threadId : -1).build())
|
||||
.setShortLabel(shortName)
|
||||
@@ -209,6 +211,7 @@ public final class ConversationUtil {
|
||||
.setCategories(Collections.singleton(CATEGORY_SHARE_TARGET))
|
||||
.setActivity(new ComponentName(context, "org.thoughtcrime.securesms.RoutingActivity"))
|
||||
.setRank(rank)
|
||||
.setLocusId(new LocusIdCompat(shortcutId))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user