kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix localization of note to self string in search.
rodzic
e90074ffef
commit
cb01692a50
|
@ -43,7 +43,8 @@ class ContactSearchMediator(
|
||||||
repository = ContactSearchRepository(),
|
repository = ContactSearchRepository(),
|
||||||
performSafetyNumberChecks = performSafetyNumberChecks,
|
performSafetyNumberChecks = performSafetyNumberChecks,
|
||||||
arbitraryRepository = arbitraryRepository,
|
arbitraryRepository = arbitraryRepository,
|
||||||
searchRepository = SearchRepository(fragment.requireContext().getString(R.string.note_to_self))
|
searchRepository = SearchRepository(fragment.requireContext().getString(R.string.note_to_self)),
|
||||||
|
contactSearchPagedDataSourceRepository = ContactSearchPagedDataSourceRepository(fragment.requireContext())
|
||||||
)
|
)
|
||||||
)[ContactSearchViewModel::class.java]
|
)[ContactSearchViewModel::class.java]
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.thoughtcrime.securesms.contacts.paged.collections.StoriesSearchCollec
|
||||||
import org.thoughtcrime.securesms.database.model.DistributionListPrivacyMode
|
import org.thoughtcrime.securesms.database.model.DistributionListPrivacyMode
|
||||||
import org.thoughtcrime.securesms.database.model.GroupRecord
|
import org.thoughtcrime.securesms.database.model.GroupRecord
|
||||||
import org.thoughtcrime.securesms.database.model.ThreadRecord
|
import org.thoughtcrime.securesms.database.model.ThreadRecord
|
||||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
|
||||||
import org.thoughtcrime.securesms.keyvalue.StorySend
|
import org.thoughtcrime.securesms.keyvalue.StorySend
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient
|
import org.thoughtcrime.securesms.recipients.Recipient
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||||
|
@ -24,7 +23,7 @@ import java.util.concurrent.TimeUnit
|
||||||
*/
|
*/
|
||||||
class ContactSearchPagedDataSource(
|
class ContactSearchPagedDataSource(
|
||||||
private val contactConfiguration: ContactSearchConfiguration,
|
private val contactConfiguration: ContactSearchConfiguration,
|
||||||
private val contactSearchPagedDataSourceRepository: ContactSearchPagedDataSourceRepository = ContactSearchPagedDataSourceRepository(ApplicationDependencies.getApplication()),
|
private val contactSearchPagedDataSourceRepository: ContactSearchPagedDataSourceRepository,
|
||||||
private val arbitraryRepository: ArbitraryRepository? = null,
|
private val arbitraryRepository: ArbitraryRepository? = null,
|
||||||
private val searchRepository: SearchRepository? = null
|
private val searchRepository: SearchRepository? = null
|
||||||
) : PagedDataSource<ContactSearchKey, ContactSearchData> {
|
) : PagedDataSource<ContactSearchKey, ContactSearchData> {
|
||||||
|
|
|
@ -22,10 +22,11 @@ import org.thoughtcrime.securesms.recipients.RecipientId
|
||||||
* having to deal with database access.
|
* having to deal with database access.
|
||||||
*/
|
*/
|
||||||
open class ContactSearchPagedDataSourceRepository(
|
open class ContactSearchPagedDataSourceRepository(
|
||||||
private val context: Context
|
context: Context
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val contactRepository = ContactRepository(context, context.getString(R.string.note_to_self))
|
private val contactRepository = ContactRepository(context, context.getString(R.string.note_to_self))
|
||||||
|
private val context = context.applicationContext
|
||||||
|
|
||||||
open fun getLatestStorySends(activeStoryCutoffDuration: Long): List<StorySend> {
|
open fun getLatestStorySends(activeStoryCutoffDuration: Long): List<StorySend> {
|
||||||
return SignalStore.storyValues()
|
return SignalStore.storyValues()
|
||||||
|
|
|
@ -30,7 +30,8 @@ class ContactSearchViewModel(
|
||||||
private val performSafetyNumberChecks: Boolean,
|
private val performSafetyNumberChecks: Boolean,
|
||||||
private val safetyNumberRepository: SafetyNumberRepository = SafetyNumberRepository(),
|
private val safetyNumberRepository: SafetyNumberRepository = SafetyNumberRepository(),
|
||||||
private val arbitraryRepository: ArbitraryRepository?,
|
private val arbitraryRepository: ArbitraryRepository?,
|
||||||
private val searchRepository: SearchRepository
|
private val searchRepository: SearchRepository,
|
||||||
|
private val contactSearchPagedDataSourceRepository: ContactSearchPagedDataSourceRepository
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
private val disposables = CompositeDisposable()
|
private val disposables = CompositeDisposable()
|
||||||
|
@ -57,7 +58,12 @@ class ContactSearchViewModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setConfiguration(contactSearchConfiguration: ContactSearchConfiguration) {
|
fun setConfiguration(contactSearchConfiguration: ContactSearchConfiguration) {
|
||||||
val pagedDataSource = ContactSearchPagedDataSource(contactSearchConfiguration, arbitraryRepository = arbitraryRepository, searchRepository = searchRepository)
|
val pagedDataSource = ContactSearchPagedDataSource(
|
||||||
|
contactSearchConfiguration,
|
||||||
|
arbitraryRepository = arbitraryRepository,
|
||||||
|
searchRepository = searchRepository,
|
||||||
|
contactSearchPagedDataSourceRepository = contactSearchPagedDataSourceRepository
|
||||||
|
)
|
||||||
pagedData.value = PagedData.createForLiveData(pagedDataSource, pagingConfig)
|
pagedData.value = PagedData.createForLiveData(pagedDataSource, pagingConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +155,8 @@ class ContactSearchViewModel(
|
||||||
private val repository: ContactSearchRepository,
|
private val repository: ContactSearchRepository,
|
||||||
private val performSafetyNumberChecks: Boolean,
|
private val performSafetyNumberChecks: Boolean,
|
||||||
private val arbitraryRepository: ArbitraryRepository?,
|
private val arbitraryRepository: ArbitraryRepository?,
|
||||||
private val searchRepository: SearchRepository
|
private val searchRepository: SearchRepository,
|
||||||
|
private val contactSearchPagedDataSourceRepository: ContactSearchPagedDataSourceRepository
|
||||||
) : ViewModelProvider.Factory {
|
) : ViewModelProvider.Factory {
|
||||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||||
return modelClass.cast(
|
return modelClass.cast(
|
||||||
|
@ -158,7 +165,8 @@ class ContactSearchViewModel(
|
||||||
contactSearchRepository = repository,
|
contactSearchRepository = repository,
|
||||||
performSafetyNumberChecks = performSafetyNumberChecks,
|
performSafetyNumberChecks = performSafetyNumberChecks,
|
||||||
arbitraryRepository = arbitraryRepository,
|
arbitraryRepository = arbitraryRepository,
|
||||||
searchRepository = searchRepository
|
searchRepository = searchRepository,
|
||||||
|
contactSearchPagedDataSourceRepository = contactSearchPagedDataSourceRepository
|
||||||
)
|
)
|
||||||
) as T
|
) as T
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,15 @@ import org.signal.paging.ProxyPagingController
|
||||||
import org.thoughtcrime.securesms.contacts.paged.ContactSearchConfiguration
|
import org.thoughtcrime.securesms.contacts.paged.ContactSearchConfiguration
|
||||||
import org.thoughtcrime.securesms.contacts.paged.ContactSearchKey
|
import org.thoughtcrime.securesms.contacts.paged.ContactSearchKey
|
||||||
import org.thoughtcrime.securesms.contacts.paged.ContactSearchPagedDataSource
|
import org.thoughtcrime.securesms.contacts.paged.ContactSearchPagedDataSource
|
||||||
|
import org.thoughtcrime.securesms.contacts.paged.ContactSearchPagedDataSourceRepository
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||||
import org.thoughtcrime.securesms.stories.Stories
|
import org.thoughtcrime.securesms.stories.Stories
|
||||||
import org.thoughtcrime.securesms.util.rx.RxStore
|
import org.thoughtcrime.securesms.util.rx.RxStore
|
||||||
|
|
||||||
class StoriesPrivacySettingsViewModel : ViewModel() {
|
class StoriesPrivacySettingsViewModel(
|
||||||
|
private val contactSearchPagedDataSourceRepository: ContactSearchPagedDataSourceRepository
|
||||||
|
) : ViewModel() {
|
||||||
|
|
||||||
private val repository = StoriesPrivacySettingsRepository()
|
private val repository = StoriesPrivacySettingsRepository()
|
||||||
|
|
||||||
|
@ -49,7 +52,7 @@ class StoriesPrivacySettingsViewModel : ViewModel() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val pagedDataSource = ContactSearchPagedDataSource(configuration)
|
val pagedDataSource = ContactSearchPagedDataSource(configuration, contactSearchPagedDataSourceRepository)
|
||||||
val observablePagedData = PagedData.createForObservable(pagedDataSource, pagingConfig)
|
val observablePagedData = PagedData.createForObservable(pagedDataSource, pagingConfig)
|
||||||
|
|
||||||
pagingController.set(observablePagedData.controller)
|
pagingController.set(observablePagedData.controller)
|
||||||
|
|
Ładowanie…
Reference in New Issue