kopia lustrzana https://github.com/ryukoposting/Signal-Android
				
				
				
			Do not include self in recents list for gift badging.
							rodzic
							
								
									b3086e595f
								
							
						
					
					
						commit
						25788ef751
					
				|  | @ -55,6 +55,7 @@ class GiftFlowRecipientSelectionFragment : Fragment(R.layout.gift_flow_recipient | |||
|       if (query.isNullOrEmpty()) { | ||||
|         addSection( | ||||
|           ContactSearchConfiguration.Section.Recents( | ||||
|             includeSelf = false, | ||||
|             includeHeader = true, | ||||
|             mode = ContactSearchConfiguration.Section.Recents.Mode.INDIVIDUALS | ||||
|           ) | ||||
|  |  | |||
|  | @ -188,7 +188,7 @@ public class ContactsCursorLoader extends AbstractContactsCursorLoader { | |||
|     ThreadDatabase threadDatabase = SignalDatabase.threads(); | ||||
| 
 | ||||
|     MatrixCursor recentConversations = ContactsCursorRows.createMatrixCursor(RECENT_CONVERSATION_MAX); | ||||
|     try (Cursor rawConversations = threadDatabase.getRecentConversationList(RECENT_CONVERSATION_MAX, flagSet(mode, DisplayMode.FLAG_INACTIVE_GROUPS), false, groupsOnly, hideGroupsV1(mode), !smsEnabled(mode))) { | ||||
|     try (Cursor rawConversations = threadDatabase.getRecentConversationList(RECENT_CONVERSATION_MAX, flagSet(mode, DisplayMode.FLAG_INACTIVE_GROUPS), false, groupsOnly, hideGroupsV1(mode), !smsEnabled(mode), false)) { | ||||
|       ThreadDatabase.Reader reader = threadDatabase.readerFor(rawConversations); | ||||
|       ThreadRecord          threadRecord; | ||||
|       while ((threadRecord = reader.getNext()) != null) { | ||||
|  |  | |||
|  | @ -34,6 +34,7 @@ class ContactSearchConfiguration private constructor( | |||
|       val includeInactiveGroups: Boolean = false, | ||||
|       val includeGroupsV1: Boolean = false, | ||||
|       val includeSms: Boolean = false, | ||||
|       val includeSelf: Boolean = false, | ||||
|       override val includeHeader: Boolean, | ||||
|       override val expandConfig: ExpandConfig? = null | ||||
|     ) : Section(SectionKey.RECENTS) { | ||||
|  |  | |||
|  | @ -45,7 +45,8 @@ open class ContactSearchPagedDataSourceRepository( | |||
|       section.mode == ContactSearchConfiguration.Section.Recents.Mode.INDIVIDUALS, | ||||
|       section.mode == ContactSearchConfiguration.Section.Recents.Mode.GROUPS, | ||||
|       !section.includeGroupsV1, | ||||
|       !section.includeSms | ||||
|       !section.includeSms, | ||||
|       !section.includeSelf | ||||
|     ) | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
|  | @ -594,10 +594,10 @@ public class ThreadDatabase extends Database { | |||
|   } | ||||
| 
 | ||||
|   public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean hideV1Groups) { | ||||
|     return getRecentConversationList(limit, includeInactiveGroups, false, false, hideV1Groups, false); | ||||
|     return getRecentConversationList(limit, includeInactiveGroups, false, false, hideV1Groups, false, false); | ||||
|   } | ||||
| 
 | ||||
|   public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean individualsOnly, boolean groupsOnly, boolean hideV1Groups, boolean hideSms) { | ||||
|   public Cursor getRecentConversationList(int limit, boolean includeInactiveGroups, boolean individualsOnly, boolean groupsOnly, boolean hideV1Groups, boolean hideSms, boolean hideSelf) { | ||||
|     SQLiteDatabase db    = databaseHelper.getSignalReadableDatabase(); | ||||
|     String         query = !includeInactiveGroups ? MEANINGFUL_MESSAGES + " != 0 AND (" + GroupDatabase.TABLE_NAME + "." + GroupDatabase.ACTIVE + " IS NULL OR " + GroupDatabase.TABLE_NAME + "." + GroupDatabase.ACTIVE + " = 1)" | ||||
|                                                   : MEANINGFUL_MESSAGES + " != 0"; | ||||
|  | @ -620,6 +620,10 @@ public class ThreadDatabase extends Database { | |||
|       query += " AND " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.FORCE_SMS_SELECTION + " = 0"; | ||||
|     } | ||||
| 
 | ||||
|     if (hideSelf) { | ||||
|       query += " AND " + RECIPIENT_ID + " != " + Recipient.self().getId().toLong(); | ||||
|     } | ||||
| 
 | ||||
|     query += " AND " + ARCHIVED + " = 0"; | ||||
| 
 | ||||
|     if (SignalStore.releaseChannelValues().getReleaseChannelRecipientId() != null) { | ||||
|  |  | |||
|  | @ -68,7 +68,7 @@ public class ConversationShortcutUpdateJob extends BaseJob { | |||
|     int             maxShortcuts   = ConversationUtil.getMaxShortcuts(context); | ||||
|     List<Recipient> ranked         = new ArrayList<>(maxShortcuts); | ||||
| 
 | ||||
|     try (ThreadDatabase.Reader reader = threadDatabase.readerFor(threadDatabase.getRecentConversationList(maxShortcuts, false, false, false, true, !Util.isDefaultSmsProvider(context)))) { | ||||
|     try (ThreadDatabase.Reader reader = threadDatabase.readerFor(threadDatabase.getRecentConversationList(maxShortcuts, false, false, false, true, !Util.isDefaultSmsProvider(context), false))) { | ||||
|       ThreadRecord record; | ||||
|       while ((record = reader.getNext()) != null) { | ||||
|         ranked.add(record.getRecipient().resolve()); | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Alex Hart
						Alex Hart