diff --git a/vector/src/main/java/im/vector/app/core/platform/GenericIdArgs.kt b/vector/src/main/java/im/vector/app/core/platform/GenericIdArgs.kt new file mode 100644 index 0000000000..0f22ae9136 --- /dev/null +++ b/vector/src/main/java/im/vector/app/core/platform/GenericIdArgs.kt @@ -0,0 +1,28 @@ +/* + * 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 diff --git a/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleActivity.kt b/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleActivity.kt index 1cc2203042..87f5356f6d 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleActivity.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleActivity.kt @@ -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() { @@ -57,7 +57,7 @@ class SpacePeopleActivity : VectorBaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val args = intent?.getParcelableExtra(MvRx.KEY_ARG) + val args = intent?.getParcelableExtra(MvRx.KEY_ARG) if (isFirstCreation()) { val simpleName = SpacePeopleFragment::class.java.simpleName if (supportFragmentManager.findFragmentByTag(simpleName) == null) { @@ -97,7 +97,7 @@ class SpacePeopleActivity : VectorBaseActivity() { 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)) } } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleViewState.kt b/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleViewState.kt index 094145f901..ea322e3fbd 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleViewState.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleViewState.kt @@ -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 = Uninitialized ) : MvRxState { - constructor(args: RoomProfileArgs) : this( - spaceId = args.roomId + constructor(args: GenericIdArgs) : this( + spaceId = args.id ) }