kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix some issues with avatar syncing.
- We weren't falling back to system avatars when no profile was present - We weren't triggering a sync when the setting changedfork-5.53.8
rodzic
d8256013a3
commit
70db617229
|
@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.components.settings.app.chats
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||||
|
import org.thoughtcrime.securesms.jobs.MultiDeviceContactUpdateJob
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||||
import org.thoughtcrime.securesms.util.ConversationUtil
|
import org.thoughtcrime.securesms.util.ConversationUtil
|
||||||
|
@ -35,6 +37,7 @@ class ChatsSettingsViewModel(private val repository: ChatsSettingsRepository) :
|
||||||
store.update { it.copy(useAddressBook = enabled) }
|
store.update { it.copy(useAddressBook = enabled) }
|
||||||
SignalStore.settings().isPreferSystemContactPhotos = enabled
|
SignalStore.settings().isPreferSystemContactPhotos = enabled
|
||||||
refreshDebouncer.publish { ConversationUtil.refreshRecipientShortcuts() }
|
refreshDebouncer.publish { ConversationUtil.refreshRecipientShortcuts() }
|
||||||
|
ApplicationDependencies.getJobManager().add(MultiDeviceContactUpdateJob(true))
|
||||||
StorageSyncHelper.scheduleSyncForDataChange()
|
StorageSyncHelper.scheduleSyncForDataChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,17 +275,23 @@ public class MultiDeviceContactUpdateJob extends BaseJob {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<SignalServiceAttachmentStream> getAvatar(@NonNull RecipientId recipientId, @Nullable Uri uri) {
|
private Optional<SignalServiceAttachmentStream> getAvatar(@NonNull RecipientId recipientId, @Nullable Uri uri) {
|
||||||
Optional<SignalServiceAttachmentStream> avatarStream = Optional.absent();
|
Optional<SignalServiceAttachmentStream> stream;
|
||||||
|
|
||||||
if (SignalStore.settings().isPreferSystemContactPhotos()) {
|
if (SignalStore.settings().isPreferSystemContactPhotos()) {
|
||||||
avatarStream = getSystemAvatar(uri);
|
stream = getSystemAvatar(uri);
|
||||||
|
|
||||||
|
if (!stream.isPresent()) {
|
||||||
|
stream = getProfileAvatar(recipientId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stream = getProfileAvatar(recipientId);
|
||||||
|
|
||||||
|
if (!stream.isPresent()) {
|
||||||
|
stream = getSystemAvatar(uri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avatarStream.isPresent()) {
|
return stream;
|
||||||
return avatarStream;
|
|
||||||
} else {
|
|
||||||
return getProfileAvatar(recipientId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<SignalServiceAttachmentStream> getProfileAvatar(@NonNull RecipientId recipientId) {
|
private Optional<SignalServiceAttachmentStream> getProfileAvatar(@NonNull RecipientId recipientId) {
|
||||||
|
|
Ładowanie…
Reference in New Issue