Commit cdb3d7c3 authored by Benoit Marty's avatar Benoit Marty
Browse files

Create a GenericIdArgs instead of using unrelated GenericIdArgs

parent ea3abee6
/*
* Copyright (c) 2021 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.app.core.platform
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
/**
* Generic argument with one String. Can be an id (ex: roomId, spaceId, callId, etc.), or anything else
*/
@Parcelize
data class GenericIdArgs(
val id: String
) : Parcelable
......@@ -25,9 +25,9 @@ import com.airbnb.mvrx.MvRx
import im.vector.app.R
import im.vector.app.core.extensions.commitTransaction
import im.vector.app.core.extensions.hideKeyboard
import im.vector.app.core.platform.GenericIdArgs
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleLoadingBinding
import im.vector.app.features.roomprofile.RoomProfileArgs
import im.vector.app.features.spaces.ShareSpaceBottomSheet
class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
......@@ -57,7 +57,7 @@ class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val args = intent?.getParcelableExtra<RoomProfileArgs>(MvRx.KEY_ARG)
val args = intent?.getParcelableExtra<GenericIdArgs>(MvRx.KEY_ARG)
if (isFirstCreation()) {
val simpleName = SpacePeopleFragment::class.java.simpleName
if (supportFragmentManager.findFragmentByTag(simpleName) == null) {
......@@ -97,7 +97,7 @@ class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
companion object {
fun newIntent(context: Context, spaceId: String): Intent {
return Intent(context, SpacePeopleActivity::class.java).apply {
putExtra(MvRx.KEY_ARG, RoomProfileArgs(spaceId))
putExtra(MvRx.KEY_ARG, GenericIdArgs(spaceId))
}
}
}
......
......@@ -19,13 +19,13 @@ package im.vector.app.features.spaces.people
import com.airbnb.mvrx.Async
import com.airbnb.mvrx.MvRxState
import com.airbnb.mvrx.Uninitialized
import im.vector.app.features.roomprofile.RoomProfileArgs
import im.vector.app.core.platform.GenericIdArgs
data class SpacePeopleViewState(
val spaceId: String,
val createAndInviteState: Async<String> = Uninitialized
) : MvRxState {
constructor(args: RoomProfileArgs) : this(
spaceId = args.roomId
constructor(args: GenericIdArgs) : this(
spaceId = args.id
)
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment