fix LiveData nullability issues (#2181)
This commit is contained in:
parent
3091db8c27
commit
e032d38d56
|
@ -67,7 +67,7 @@ class AnnouncementsViewModel @Inject constructor(
|
||||||
appDatabase.instanceDao().insertOrReplace(it)
|
appDatabase.instanceDao().insertOrReplace(it)
|
||||||
}
|
}
|
||||||
.subscribe({
|
.subscribe({
|
||||||
emojisMutable.postValue(it.emojiList)
|
emojisMutable.postValue(it.emojiList.orEmpty())
|
||||||
}, {
|
}, {
|
||||||
Log.w(TAG, "Failed to get custom emojis.", it)
|
Log.w(TAG, "Failed to get custom emojis.", it)
|
||||||
})
|
})
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ConversationsRepository @Inject constructor(val mastodonApi: MastodonApi,
|
||||||
// we are using a mutable live data to trigger refresh requests which eventually calls
|
// we are using a mutable live data to trigger refresh requests which eventually calls
|
||||||
// refresh method and gets a new live data. Each refresh request by the user becomes a newly
|
// refresh method and gets a new live data. Each refresh request by the user becomes a newly
|
||||||
// dispatched data in refreshTrigger
|
// dispatched data in refreshTrigger
|
||||||
val refreshTrigger = MutableLiveData<Unit>()
|
val refreshTrigger = MutableLiveData<Unit?>()
|
||||||
val refreshState = Transformations.switchMap(refreshTrigger) {
|
val refreshState = Transformations.switchMap(refreshTrigger) {
|
||||||
refresh(accountId, true)
|
refresh(accountId, true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ class ReportViewModel @Inject constructor(
|
||||||
private val eventHub: EventHub,
|
private val eventHub: EventHub,
|
||||||
private val statusesRepository: StatusesRepository) : RxAwareViewModel() {
|
private val statusesRepository: StatusesRepository) : RxAwareViewModel() {
|
||||||
|
|
||||||
private val navigationMutable = MutableLiveData<Screen>()
|
private val navigationMutable = MutableLiveData<Screen?>()
|
||||||
val navigation: LiveData<Screen> = navigationMutable
|
val navigation: LiveData<Screen?> = navigationMutable
|
||||||
|
|
||||||
private val muteStateMutable = MutableLiveData<Resource<Boolean>>()
|
private val muteStateMutable = MutableLiveData<Resource<Boolean>>()
|
||||||
val muteState: LiveData<Resource<Boolean>> = muteStateMutable
|
val muteState: LiveData<Resource<Boolean>> = muteStateMutable
|
||||||
|
@ -49,8 +49,8 @@ class ReportViewModel @Inject constructor(
|
||||||
private val reportingStateMutable = MutableLiveData<Resource<Boolean>>()
|
private val reportingStateMutable = MutableLiveData<Resource<Boolean>>()
|
||||||
var reportingState: LiveData<Resource<Boolean>> = reportingStateMutable
|
var reportingState: LiveData<Resource<Boolean>> = reportingStateMutable
|
||||||
|
|
||||||
private val checkUrlMutable = MutableLiveData<String>()
|
private val checkUrlMutable = MutableLiveData<String?>()
|
||||||
val checkUrl: LiveData<String> = checkUrlMutable
|
val checkUrl: LiveData<String?> = checkUrlMutable
|
||||||
|
|
||||||
private val repoResult = MutableLiveData<BiListing<Status>>()
|
private val repoResult = MutableLiveData<BiListing<Status>>()
|
||||||
val statuses: LiveData<PagedList<Status>> = Transformations.switchMap(repoResult) { it.pagedList }
|
val statuses: LiveData<PagedList<Status>> = Transformations.switchMap(repoResult) { it.pagedList }
|
||||||
|
|
Loading…
Reference in New Issue