Merge branch 'hotfix/fix_crash_invite_user'
This commit is contained in:
commit
ee1d5faf0d
|
@ -1,3 +1,9 @@
|
|||
Changes in Element 1.0.4 (2020-08-03)
|
||||
===================================================
|
||||
|
||||
Bugfix 🐛:
|
||||
- Fix Crash when opening invite to room user screen
|
||||
|
||||
Changes in Element 1.0.3 (2020-07-31)
|
||||
===================================================
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ androidExtensions {
|
|||
// Note: 2 digits max for each value
|
||||
ext.versionMajor = 1
|
||||
ext.versionMinor = 0
|
||||
ext.versionPatch = 3
|
||||
ext.versionPatch = 4
|
||||
|
||||
static def getGitTimestamp() {
|
||||
def cmd = 'git show -s --format=%ct'
|
||||
|
|
|
@ -38,14 +38,6 @@ class CreateDirectRoomViewModel @AssistedInject constructor(@Assisted
|
|||
fun create(initialState: CreateDirectRoomViewState): CreateDirectRoomViewModel
|
||||
}
|
||||
|
||||
init {
|
||||
setState {
|
||||
copy(
|
||||
hsAdminHasDisabledE2E = !session.getHomeServerCapabilities().adminE2EByDefault
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object : MvRxViewModelFactory<CreateDirectRoomViewModel, CreateDirectRoomViewState> {
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -21,6 +21,5 @@ import com.airbnb.mvrx.MvRxState
|
|||
import com.airbnb.mvrx.Uninitialized
|
||||
|
||||
data class CreateDirectRoomViewState(
|
||||
val createAndInviteState: Async<String> = Uninitialized,
|
||||
val hsAdminHasDisabledE2E: Boolean = false
|
||||
val createAndInviteState: Async<String> = Uninitialized
|
||||
) : MvRxState
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.riotx.features.homeserver
|
||||
|
||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
||||
import com.airbnb.mvrx.ViewModelContext
|
||||
import im.vector.matrix.android.api.session.homeserver.HomeServerCapabilities
|
||||
import im.vector.riotx.core.di.HasScreenInjector
|
||||
import im.vector.riotx.core.platform.EmptyAction
|
||||
import im.vector.riotx.core.platform.EmptyViewEvents
|
||||
import im.vector.riotx.core.platform.VectorViewModel
|
||||
|
||||
class HomeServerCapabilitiesViewModel(initialState: HomeServerCapabilitiesViewState)
|
||||
: VectorViewModel<HomeServerCapabilitiesViewState, EmptyAction, EmptyViewEvents>(initialState) {
|
||||
|
||||
companion object : MvRxViewModelFactory<HomeServerCapabilitiesViewModel, HomeServerCapabilitiesViewState> {
|
||||
|
||||
override fun initialState(viewModelContext: ViewModelContext): HomeServerCapabilitiesViewState? {
|
||||
val session = (viewModelContext.activity as HasScreenInjector).injector().activeSessionHolder().getSafeActiveSession()
|
||||
return HomeServerCapabilitiesViewState(
|
||||
capabilities = session?.getHomeServerCapabilities() ?: HomeServerCapabilities()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun handle(action: EmptyAction) {}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2020 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.riotx.features.homeserver
|
||||
|
||||
import com.airbnb.mvrx.MvRxState
|
||||
import im.vector.matrix.android.api.session.homeserver.HomeServerCapabilities
|
||||
|
||||
data class HomeServerCapabilitiesViewState(
|
||||
val capabilities: HomeServerCapabilities = HomeServerCapabilities()
|
||||
) : MvRxState
|
|
@ -25,6 +25,7 @@ import androidx.core.view.forEach
|
|||
import androidx.core.view.isVisible
|
||||
import com.airbnb.mvrx.activityViewModel
|
||||
import com.airbnb.mvrx.args
|
||||
import com.airbnb.mvrx.fragmentViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import com.google.android.material.chip.Chip
|
||||
import com.jakewharton.rxbinding3.widget.textChanges
|
||||
|
@ -36,8 +37,7 @@ import im.vector.riotx.core.extensions.hideKeyboard
|
|||
import im.vector.riotx.core.extensions.setupAsSearch
|
||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||
import im.vector.riotx.core.utils.DimensionConverter
|
||||
import im.vector.riotx.features.createdirect.CreateDirectRoomViewModel
|
||||
import im.vector.riotx.features.createdirect.CreateDirectRoomViewState
|
||||
import im.vector.riotx.features.homeserver.HomeServerCapabilitiesViewModel
|
||||
import kotlinx.android.synthetic.main.fragment_known_users.*
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -54,7 +54,7 @@ class KnownUsersFragment @Inject constructor(
|
|||
override fun getMenuRes() = args.menuResId
|
||||
|
||||
private val viewModel: UserDirectoryViewModel by activityViewModel()
|
||||
private val createDMViewModel: CreateDirectRoomViewModel by activityViewModel()
|
||||
private val homeServerCapabilitiesViewModel: HomeServerCapabilitiesViewModel by fragmentViewModel()
|
||||
|
||||
private lateinit var sharedActionViewModel: UserDirectorySharedActionViewModel
|
||||
|
||||
|
@ -70,8 +70,8 @@ class KnownUsersFragment @Inject constructor(
|
|||
setupAddFromPhoneBookView()
|
||||
setupCloseView()
|
||||
|
||||
createDMViewModel.selectSubscribe(this, CreateDirectRoomViewState::hsAdminHasDisabledE2E) {
|
||||
knownUsersE2EbyDefaultDisabled.isVisible = it
|
||||
homeServerCapabilitiesViewModel.subscribe {
|
||||
knownUsersE2EbyDefaultDisabled.isVisible = !it.capabilities.adminE2EByDefault
|
||||
}
|
||||
|
||||
viewModel.selectSubscribe(this, UserDirectoryViewState::pendingInvitees) {
|
||||
|
|
Loading…
Reference in New Issue