Create a GenericIdArgs instead of using unrelated GenericIdArgs
This commit is contained in:
parent
ea3abee63a
commit
cdb3d7c308
@ -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
|
@ -25,9 +25,9 @@ import com.airbnb.mvrx.MvRx
|
|||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.extensions.commitTransaction
|
import im.vector.app.core.extensions.commitTransaction
|
||||||
import im.vector.app.core.extensions.hideKeyboard
|
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.core.platform.VectorBaseActivity
|
||||||
import im.vector.app.databinding.ActivitySimpleLoadingBinding
|
import im.vector.app.databinding.ActivitySimpleLoadingBinding
|
||||||
import im.vector.app.features.roomprofile.RoomProfileArgs
|
|
||||||
import im.vector.app.features.spaces.ShareSpaceBottomSheet
|
import im.vector.app.features.spaces.ShareSpaceBottomSheet
|
||||||
|
|
||||||
class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
|
class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
|
||||||
@ -57,7 +57,7 @@ class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
val args = intent?.getParcelableExtra<RoomProfileArgs>(MvRx.KEY_ARG)
|
val args = intent?.getParcelableExtra<GenericIdArgs>(MvRx.KEY_ARG)
|
||||||
if (isFirstCreation()) {
|
if (isFirstCreation()) {
|
||||||
val simpleName = SpacePeopleFragment::class.java.simpleName
|
val simpleName = SpacePeopleFragment::class.java.simpleName
|
||||||
if (supportFragmentManager.findFragmentByTag(simpleName) == null) {
|
if (supportFragmentManager.findFragmentByTag(simpleName) == null) {
|
||||||
@ -97,7 +97,7 @@ class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
|
|||||||
companion object {
|
companion object {
|
||||||
fun newIntent(context: Context, spaceId: String): Intent {
|
fun newIntent(context: Context, spaceId: String): Intent {
|
||||||
return Intent(context, SpacePeopleActivity::class.java).apply {
|
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.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MvRxState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import im.vector.app.features.roomprofile.RoomProfileArgs
|
import im.vector.app.core.platform.GenericIdArgs
|
||||||
|
|
||||||
data class SpacePeopleViewState(
|
data class SpacePeopleViewState(
|
||||||
val spaceId: String,
|
val spaceId: String,
|
||||||
val createAndInviteState: Async<String> = Uninitialized
|
val createAndInviteState: Async<String> = Uninitialized
|
||||||
) : MvRxState {
|
) : MvRxState {
|
||||||
constructor(args: RoomProfileArgs) : this(
|
constructor(args: GenericIdArgs) : this(
|
||||||
spaceId = args.roomId
|
spaceId = args.id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user