Merge pull request #3490 from vector-im/feature/bca/fix_3485

Add warning to private space creation flow
This commit is contained in:
Benoit Marty 2021-06-16 14:47:12 +02:00 committed by GitHub
commit b5cc023fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 132 additions and 28 deletions

View File

@ -0,0 +1 @@
Add beta warning to private space creation flow

View File

@ -53,7 +53,6 @@ class SpaceCreationActivity : SimpleFragmentActivity(), CreateSpaceViewModel.Fac
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
if (isFirstCreation()) { if (isFirstCreation()) {
when (withState(viewModel) { it.step }) { when (withState(viewModel) { it.step }) {
CreateSpaceState.Step.ChooseType -> { CreateSpaceState.Step.ChooseType -> {

View File

@ -0,0 +1,46 @@
/*
* 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.features.spaces.create
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.setFragmentResult
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
import im.vector.app.databinding.BottomSheetSpaceCreatePrivateWarningBinding
class BetaWarningBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetSpaceCreatePrivateWarningBinding>() {
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?) =
BottomSheetSpaceCreatePrivateWarningBinding.inflate(inflater, container, false)
override val showExpanded = true
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
views.continueButton.debouncedClicks {
setFragmentResult(REQUEST_KEY, Bundle.EMPTY)
dismiss()
}
}
companion object {
const val REQUEST_KEY = "BetaWarningBottomSheet"
}
}

View File

@ -20,6 +20,7 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.setFragmentResultListener
import com.airbnb.mvrx.activityViewModel import com.airbnb.mvrx.activityViewModel
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.epoxy.onClick import im.vector.app.core.epoxy.onClick
@ -38,6 +39,13 @@ class ChoosePrivateSpaceTypeFragment @Inject constructor(
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?) = override fun getBinding(inflater: LayoutInflater, container: ViewGroup?) =
FragmentSpaceCreateChoosePrivateModelBinding.inflate(layoutInflater, container, false) FragmentSpaceCreateChoosePrivateModelBinding.inflate(layoutInflater, container, false)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setFragmentResultListener(BetaWarningBottomSheet.REQUEST_KEY) { _, _ ->
sharedViewModel.handle(CreateSpaceAction.SetSpaceTopology(SpaceTopology.MeAndTeammates))
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
@ -46,7 +54,7 @@ class ChoosePrivateSpaceTypeFragment @Inject constructor(
} }
views.teammatesButton.onClick { views.teammatesButton.onClick {
sharedViewModel.handle(CreateSpaceAction.SetSpaceTopology(SpaceTopology.MeAndTeammates)) BetaWarningBottomSheet().show(parentFragmentManager, "warning")
} }
sharedViewModel.subscribe { state -> sharedViewModel.subscribe { state ->

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurface"
android:orientation="vertical"
android:padding="16dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:layout_marginBottom="12dp"
android:importantForAccessibility="no"
android:src="@drawable/ic_beta_pill" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="12dp"
android:gravity="center"
android:text="@string/teammate_spaces_arent_quite_ready"
android:textColor="?vctr_content_primary"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="@string/teammate_spaces_might_not_join"
android:textColor="?vctr_content_secondary"
android:textSize="16sp" />
<Button
android:id="@+id/continueButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_vertical_margin"
android:text="@string/continue_anyway"
android:textAllCaps="true" />
</LinearLayout>

View File

@ -771,6 +771,7 @@
<string name="yes">YES</string> <string name="yes">YES</string>
<string name="no">NO</string> <string name="no">NO</string>
<string name="_continue">Continue</string> <string name="_continue">Continue</string>
<string name="continue_anyway">Continue Anyway</string>
<!-- Actions --> <!-- Actions -->
<string name="remove">Remove</string> <string name="remove">Remove</string>
@ -3399,4 +3400,7 @@
<string name="this_space_has_no_rooms_admin">Some rooms may be hidden because theyre private and you need an invite.</string> <string name="this_space_has_no_rooms_admin">Some rooms may be hidden because theyre private and you need an invite.</string>
<string name="unnamed_room">Unnamed Room</string> <string name="unnamed_room">Unnamed Room</string>
<string name="teammate_spaces_arent_quite_ready">"Teammate spaces arent quite ready but you can still give them a try"</string>
<string name="teammate_spaces_might_not_join">"At the moment people might not be able to join any private rooms you make.\n\nWell be improving this as part of the beta, but just wanted to let you know."</string>
</resources> </resources>