mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 19:07:40 +00:00
Add a global search (#834)
* feat: modifying search functionalities to include contacts * feat: add global search UI input layouts and color attributes * feat: add global search repository and model content * feat: adding diff callbacks and wiring up global search vm to views * feat: adding scroll to message, figuring out new query for recipient thread search * feat: messing with the search and highlighting functionality after wiring up bindings * fix: compile error from merge * fix: gradlew build errors * feat: filtering contacts by existing un-archived threads * refactor: prevent note to self breaking, update queries and logic in search repo to include member->group reverse searches * feat: adding home screen new redesigns for search * feat: replacing designs and adding new group subtitle text * feat: small design improvements and incrementing gradle build number to install on device * feat: add scrollbars for search * feat: replace isVisible for cancel button now that GlobalSearchInputLayout.kt replaces header * refactor: all queries are debounced not just all but 2 char * refactor: remove visibility modifiers for cancel icon * refactor: use simplified non-db and context related models in display, remove db get group members call from binding data * fix: use threadId instead of group's address * refactor: better close on cancel, removing only yourself from group member list in open groups * refactor: seed view back to inflated on create and visibility for empty placeholder and seed view text * refactor: fixing build issues and new designs for message list * refactor: use dynamic limit * refactor: include raw session ID string search for non-empty threads * fix: build lint errors * fix: build issues * feat: add in path to the settings activity * refactor: remove wildcard imports
This commit is contained in:
@@ -42,8 +42,17 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
||||
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
|
||||
testImplementation "junit:junit:3.8.2"
|
||||
testImplementation "org.assertj:assertj-core:1.7.1"
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||
testImplementation "org.mockito:mockito-inline:4.0.0"
|
||||
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
||||
testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
|
||||
testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
|
||||
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
|
||||
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'
|
||||
testImplementation 'androidx.test:core:1.3.0'
|
||||
testImplementation "androidx.arch.core:core-testing:2.1.0"
|
||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
|
||||
testImplementation "org.conscrypt:conscrypt-openjdk-uber:2.0.0"
|
||||
implementation 'org.greenrobot:eventbus:3.0.0'
|
||||
}
|
@@ -45,7 +45,7 @@ class BatchMessageReceiveJob(
|
||||
|
||||
fun executeAsync(): Promise<Unit, Exception> {
|
||||
return task {
|
||||
messages.forEach { messageParameters ->
|
||||
messages.iterator().forEach { messageParameters ->
|
||||
val (data, serverHash, openGroupMessageServerID) = messageParameters
|
||||
try {
|
||||
val (message, proto) = MessageReceiver.parse(data, openGroupMessageServerID)
|
||||
|
@@ -155,7 +155,7 @@ object MessageSender {
|
||||
var isSuccess = false
|
||||
val promiseCount = promises.size
|
||||
var errorCount = 0
|
||||
promises.forEach { promise: RawResponsePromise ->
|
||||
promises.iterator().forEach { promise: RawResponsePromise ->
|
||||
promise.success {
|
||||
if (isSuccess) { return@success } // Succeed as soon as the first promise succeeds
|
||||
isSuccess = true
|
||||
|
@@ -236,7 +236,7 @@ fun MessageReceiver.handleVisibleMessage(message: VisibleMessage, proto: SignalS
|
||||
val messageID = storage.persist(message, quoteModel, linkPreviews, message.groupPublicKey, openGroupID, attachments) ?: throw MessageReceiver.Error.DuplicateMessage
|
||||
// Parse & persist attachments
|
||||
// Start attachment downloads if needed
|
||||
storage.getAttachmentsForMessage(messageID).forEach { attachment ->
|
||||
storage.getAttachmentsForMessage(messageID).iterator().forEach { attachment ->
|
||||
attachment.attachmentId?.let { id ->
|
||||
val downloadJob = AttachmentDownloadJob(id.rowId, messageID)
|
||||
JobQueue.shared.add(downloadJob)
|
||||
|
@@ -52,7 +52,7 @@ object PushNotificationAPI {
|
||||
// Unsubscribe from all closed groups
|
||||
val allClosedGroupPublicKeys = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys()
|
||||
val userPublicKey = MessagingModuleConfiguration.shared.storage.getUserPublicKey()!!
|
||||
allClosedGroupPublicKeys.forEach { closedGroup ->
|
||||
allClosedGroupPublicKeys.iterator().forEach { closedGroup ->
|
||||
performOperation(ClosedGroupOperation.Unsubscribe, closedGroup, userPublicKey)
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ object PushNotificationAPI {
|
||||
}
|
||||
// Subscribe to all closed groups
|
||||
val allClosedGroupPublicKeys = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys()
|
||||
allClosedGroupPublicKeys.forEach { closedGroup ->
|
||||
allClosedGroupPublicKeys.iterator().forEach { closedGroup ->
|
||||
performOperation(ClosedGroupOperation.Subscribe, closedGroup, publicKey)
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ class ClosedGroupPollerV2 {
|
||||
fun start() {
|
||||
val storage = MessagingModuleConfiguration.shared.storage
|
||||
val allGroupPublicKeys = storage.getAllClosedGroupPublicKeys()
|
||||
allGroupPublicKeys.forEach { startPolling(it) }
|
||||
allGroupPublicKeys.iterator().forEach { startPolling(it) }
|
||||
}
|
||||
|
||||
fun startPolling(groupPublicKey: String) {
|
||||
@@ -51,7 +51,7 @@ class ClosedGroupPollerV2 {
|
||||
fun stop() {
|
||||
val storage = MessagingModuleConfiguration.shared.storage
|
||||
val allGroupPublicKeys = storage.getAllClosedGroupPublicKeys()
|
||||
allGroupPublicKeys.forEach { stopPolling(it) }
|
||||
allGroupPublicKeys.iterator().forEach { stopPolling(it) }
|
||||
}
|
||||
|
||||
fun stopPolling(groupPublicKey: String) {
|
||||
@@ -100,7 +100,7 @@ class ClosedGroupPollerV2 {
|
||||
}
|
||||
promise.success { envelopes ->
|
||||
if (!isPolling(groupPublicKey)) { return@success }
|
||||
envelopes.forEach { (envelope, serverHash) ->
|
||||
envelopes.iterator().forEach { (envelope, serverHash) ->
|
||||
val job = MessageReceiveJob(envelope.toByteArray(), serverHash)
|
||||
JobQueue.shared.add(job)
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.ThreadPoolExecutor
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.min
|
||||
|
||||
object Util {
|
||||
@Volatile
|
||||
@@ -216,7 +217,7 @@ object Util {
|
||||
val results: MutableList<List<T>> = LinkedList()
|
||||
var index = 0
|
||||
while (index < list.size) {
|
||||
val subListSize = Math.min(partitionSize, list.size - index)
|
||||
val subListSize = min(partitionSize, list.size - index)
|
||||
results.add(list.subList(index, index + subListSize))
|
||||
index += partitionSize
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<resources>
|
||||
|
||||
<string-array name="language_entries">
|
||||
<item>@string/preferences__default</item>
|
||||
<item>English</item>
|
||||
<item>Arabic العربية</item>
|
||||
<item>Azərbaycan</item>
|
||||
@@ -119,18 +118,6 @@
|
||||
<item>vi</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_led_color_entries">
|
||||
<item>@string/preferences__green</item>
|
||||
<item>@string/preferences__red</item>
|
||||
<item>@string/preferences__blue</item>
|
||||
<item>@string/preferences__orange</item>
|
||||
<item>@string/preferences__cyan</item>
|
||||
<item>@string/preferences__magenta</item>
|
||||
<item>@string/preferences__white</item>
|
||||
<item>@string/preferences__none</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string-array name="pref_led_color_values" translatable="false">
|
||||
<item>green</item>
|
||||
<item>red</item>
|
||||
@@ -142,27 +129,12 @@
|
||||
<item>none</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_led_blink_pattern_entries">
|
||||
<item>@string/preferences__fast</item>
|
||||
<item>@string/preferences__normal</item>
|
||||
<item>@string/preferences__slow</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_led_blink_pattern_values" translatable="false">
|
||||
<item>300,300</item>
|
||||
<item>500,2000</item>
|
||||
<item>3000,3000</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_repeat_alerts_entries">
|
||||
<item>@string/preferences__never</item>
|
||||
<item>@string/preferences__one_time</item>
|
||||
<item>@string/preferences__two_times</item>
|
||||
<item>@string/preferences__three_times</item>
|
||||
<item>@string/preferences__five_times</item>
|
||||
<item>@string/preferences__ten_times</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_repeat_alerts_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
@@ -177,25 +149,6 @@
|
||||
<item>custom</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="default_or_custom_entries">
|
||||
<item>@string/arrays__use_default</item>
|
||||
<item>@string/arrays__use_custom</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="mute_durations">
|
||||
<item>@string/arrays__mute_for_one_hour</item>
|
||||
<item>@string/arrays__mute_for_two_hours</item>
|
||||
<item>@string/arrays__mute_for_one_day</item>
|
||||
<item>@string/arrays__mute_for_seven_days</item>
|
||||
<item>@string/arrays__mute_for_one_year</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_notification_privacy_entries">
|
||||
<item>@string/arrays__name_and_message</item>
|
||||
<item>@string/arrays__name_only</item>
|
||||
<item>@string/arrays__no_name_or_message</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_notification_privacy_values">
|
||||
<item>all</item>
|
||||
<item>contact</item>
|
||||
@@ -247,12 +200,6 @@
|
||||
<item>#000000</item>
|
||||
</array>
|
||||
|
||||
<string-array name="pref_notification_priority_entries">
|
||||
<item>@string/arrays__default</item>
|
||||
<item>@string/arrays__high</item>
|
||||
<item>@string/arrays__max</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_notification_priority_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
|
Reference in New Issue
Block a user