Merge pull request #4757 from vector-im/feature/fre/minor_code_enhancements
Some code enhancements
This commit is contained in:
commit
753d704c69
@ -152,6 +152,13 @@ class FlowSession(private val session: Session) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun liveUserAccountData(type: String): Flow<Optional<UserAccountDataEvent>> {
|
||||||
|
return session.accountDataService().getLiveUserAccountDataEvent(type).asFlow()
|
||||||
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
session.accountDataService().getUserAccountDataEvent(type).toOptional()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun liveRoomAccountData(types: Set<String>): Flow<List<RoomAccountDataEvent>> {
|
fun liveRoomAccountData(types: Set<String>): Flow<List<RoomAccountDataEvent>> {
|
||||||
return session.accountDataService().getLiveRoomAccountDataEvents(types).asFlow()
|
return session.accountDataService().getLiveRoomAccountDataEvents(types).asFlow()
|
||||||
.startWith(session.coroutineDispatchers.io) {
|
.startWith(session.coroutineDispatchers.io) {
|
||||||
|
@ -168,11 +168,8 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderCreationSuccess(roomId: String?) {
|
private fun renderCreationSuccess(roomId: String) {
|
||||||
// Navigate to freshly created room
|
navigator.openRoom(this, roomId)
|
||||||
if (roomId != null) {
|
|
||||||
navigator.openRoom(this, roomId)
|
|
||||||
}
|
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +53,10 @@ import timber.log.Timber
|
|||||||
class RoomListViewModel @AssistedInject constructor(
|
class RoomListViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: RoomListViewState,
|
@Assisted initialState: RoomListViewState,
|
||||||
private val session: Session,
|
private val session: Session,
|
||||||
private val stringProvider: StringProvider,
|
stringProvider: StringProvider,
|
||||||
private val appStateHandler: AppStateHandler,
|
appStateHandler: AppStateHandler,
|
||||||
private val vectorPreferences: VectorPreferences,
|
vectorPreferences: VectorPreferences,
|
||||||
private val autoAcceptInvites: AutoAcceptInvites
|
autoAcceptInvites: AutoAcceptInvites
|
||||||
) : VectorViewModel<RoomListViewState, RoomListAction, RoomListViewEvents>(initialState) {
|
) : VectorViewModel<RoomListViewState, RoomListAction, RoomListViewEvents>(initialState) {
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
|
@ -44,6 +44,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
|||||||
const val SETTINGS_HOME_SERVER_PREFERENCE_KEY = "SETTINGS_HOME_SERVER_PREFERENCE_KEY"
|
const val SETTINGS_HOME_SERVER_PREFERENCE_KEY = "SETTINGS_HOME_SERVER_PREFERENCE_KEY"
|
||||||
const val SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY = "SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY"
|
const val SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY = "SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY"
|
||||||
const val SETTINGS_DISCOVERY_PREFERENCE_KEY = "SETTINGS_DISCOVERY_PREFERENCE_KEY"
|
const val SETTINGS_DISCOVERY_PREFERENCE_KEY = "SETTINGS_DISCOVERY_PREFERENCE_KEY"
|
||||||
|
const val SETTINGS_EMAILS_AND_PHONE_NUMBERS_PREFERENCE_KEY = "SETTINGS_EMAILS_AND_PHONE_NUMBERS_PREFERENCE_KEY"
|
||||||
|
|
||||||
const val SETTINGS_CLEAR_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_CACHE_PREFERENCE_KEY"
|
const val SETTINGS_CLEAR_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_CACHE_PREFERENCE_KEY"
|
||||||
const val SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY"
|
const val SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY"
|
||||||
|
Loading…
Reference in New Issue
Block a user