diff --git a/changelog.d/4315.misc b/changelog.d/4315.misc new file mode 100644 index 0000000000..ff1271a604 --- /dev/null +++ b/changelog.d/4315.misc @@ -0,0 +1 @@ +Removed spaces restricted search hint dialogs \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/core/di/MavericksViewModelModule.kt b/vector/src/main/java/im/vector/app/core/di/MavericksViewModelModule.kt index 7bc703cb97..2cd7136ffc 100644 --- a/vector/src/main/java/im/vector/app/core/di/MavericksViewModelModule.kt +++ b/vector/src/main/java/im/vector/app/core/di/MavericksViewModelModule.kt @@ -39,7 +39,6 @@ import im.vector.app.features.discovery.DiscoverySettingsViewModel import im.vector.app.features.discovery.change.SetIdentityServerViewModel import im.vector.app.features.home.HomeActivityViewModel import im.vector.app.features.home.HomeDetailViewModel -import im.vector.app.features.home.PromoteRestrictedViewModel import im.vector.app.features.home.UnknownDeviceDetectorSharedViewModel import im.vector.app.features.home.UnreadMessagesSharedViewModel import im.vector.app.features.home.UserColorAccountDataViewModel @@ -241,11 +240,6 @@ interface MavericksViewModelModule { @MavericksViewModelKey(SharedSecureStorageViewModel::class) fun sharedSecureStorageViewModelFactory(factory: SharedSecureStorageViewModel.Factory): MavericksAssistedViewModelFactory<*, *> - @Binds - @IntoMap - @MavericksViewModelKey(PromoteRestrictedViewModel::class) - fun promoteRestrictedViewModelFactory(factory: PromoteRestrictedViewModel.Factory): MavericksAssistedViewModelFactory<*, *> - @Binds @IntoMap @MavericksViewModelKey(UserListViewModel::class) diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt index b083b74c53..25ff0fe08c 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt @@ -66,7 +66,6 @@ import im.vector.app.features.rageshake.ReportType import im.vector.app.features.rageshake.VectorUncaughtExceptionHandler import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.settings.VectorSettingsActivity -import im.vector.app.features.spaces.RestrictedPromoBottomSheet import im.vector.app.features.spaces.SpaceCreationActivity import im.vector.app.features.spaces.SpacePreviewActivity import im.vector.app.features.spaces.SpaceSettingsMenuBottomSheet @@ -111,7 +110,6 @@ class HomeActivity : private val userColorAccountDataViewModel: UserColorAccountDataViewModel by viewModel() private val serverBackupStatusViewModel: ServerBackupStatusViewModel by viewModel() - private val promoteRestrictedViewModel: PromoteRestrictedViewModel by viewModel() @Inject lateinit var activeSessionHolder: ActiveSessionHolder @Inject lateinit var vectorUncaughtExceptionHandler: VectorUncaughtExceptionHandler @@ -267,21 +265,6 @@ class HomeActivity : shortcutsHandler.observeRoomsAndBuildShortcuts(lifecycleScope) - if (!vectorPreferences.didPromoteNewRestrictedFeature()) { - promoteRestrictedViewModel.onEach { - if (it.activeSpaceSummary != null && !it.activeSpaceSummary.isPublic && - it.activeSpaceSummary.otherMemberIds.isNotEmpty()) { - // It's a private space with some members show this once - if (it.canUserManageSpace && !popupAlertManager.hasAlertsToShow()) { - if (!vectorPreferences.didPromoteNewRestrictedFeature()) { - vectorPreferences.setDidPromoteNewRestrictedFeature() - RestrictedPromoBottomSheet().show(supportFragmentManager, "RestrictedPromoBottomSheet") - } - } - } - } - } - if (isFirstCreation()) { handleIntent(intent) } diff --git a/vector/src/main/java/im/vector/app/features/home/PromoteRestrictedViewModel.kt b/vector/src/main/java/im/vector/app/features/home/PromoteRestrictedViewModel.kt deleted file mode 100644 index 5c66e7c52d..0000000000 --- a/vector/src/main/java/im/vector/app/features/home/PromoteRestrictedViewModel.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.home - -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModelFactory -import dagger.assisted.Assisted -import dagger.assisted.AssistedFactory -import dagger.assisted.AssistedInject -import im.vector.app.AppStateHandler -import im.vector.app.RoomGroupingMethod -import im.vector.app.core.di.ActiveSessionHolder -import im.vector.app.core.di.MavericksAssistedViewModelFactory -import im.vector.app.core.di.hiltMavericksViewModelFactory -import im.vector.app.core.platform.EmptyAction -import im.vector.app.core.platform.EmptyViewEvents -import im.vector.app.core.platform.VectorViewModel -import kotlinx.coroutines.flow.distinctUntilChanged -import org.matrix.android.sdk.api.query.QueryStringValue -import org.matrix.android.sdk.api.session.events.model.EventType -import org.matrix.android.sdk.api.session.events.model.toModel -import org.matrix.android.sdk.api.session.room.model.PowerLevelsContent -import org.matrix.android.sdk.api.session.room.model.RoomSummary -import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper - -data class ActiveSpaceViewState( - val isInSpaceMode: Boolean = false, - val activeSpaceSummary: RoomSummary? = null, - val canUserManageSpace: Boolean = false -) : MavericksState - -class PromoteRestrictedViewModel @AssistedInject constructor( - @Assisted initialState: ActiveSpaceViewState, - private val activeSessionHolder: ActiveSessionHolder, - appStateHandler: AppStateHandler -) : VectorViewModel(initialState) { - - init { - appStateHandler.selectedRoomGroupingFlow.distinctUntilChanged().execute { state -> - val groupingMethod = state.invoke()?.orNull() - val isSpaceMode = groupingMethod is RoomGroupingMethod.BySpace - val currentSpace = (groupingMethod as? RoomGroupingMethod.BySpace)?.spaceSummary - val canManage = currentSpace?.roomId?.let { roomId -> - activeSessionHolder.getSafeActiveSession() - ?.getRoom(roomId) - ?.getStateEvent(EventType.STATE_ROOM_POWER_LEVELS, QueryStringValue.NoCondition) - ?.content?.toModel()?.let { - PowerLevelsHelper(it).isUserAllowedToSend(activeSessionHolder.getActiveSession().myUserId, true, EventType.STATE_SPACE_CHILD) - } ?: false - } ?: false - - copy( - isInSpaceMode = isSpaceMode, - activeSpaceSummary = currentSpace, - canUserManageSpace = canManage - ) - } - } - - @AssistedFactory - interface Factory : MavericksAssistedViewModelFactory { - override fun create(initialState: ActiveSpaceViewState): PromoteRestrictedViewModel - } - - companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() - - override fun handle(action: EmptyAction) {} -} diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt index 1903b3776a..f248882211 100755 --- a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt @@ -185,7 +185,6 @@ class VectorPreferences @Inject constructor(private val context: Context) { private const val SETTINGS_DISPLAY_ALL_EVENTS_KEY = "SETTINGS_DISPLAY_ALL_EVENTS_KEY" private const val DID_ASK_TO_ENABLE_SESSION_PUSH = "DID_ASK_TO_ENABLE_SESSION_PUSH" - private const val DID_PROMOTE_NEW_RESTRICTED_JOIN_RULE = "DID_PROMOTE_NEW_RESTRICTED_JOIN_RULE" // Location Sharing const val SETTINGS_PREF_ENABLE_LOCATION_SHARING = "SETTINGS_PREF_ENABLE_LOCATION_SHARING" @@ -356,16 +355,6 @@ class VectorPreferences @Inject constructor(private val context: Context) { } } - fun didPromoteNewRestrictedFeature(): Boolean { - return defaultPrefs.getBoolean(DID_PROMOTE_NEW_RESTRICTED_JOIN_RULE, false) - } - - fun setDidPromoteNewRestrictedFeature() { - defaultPrefs.edit { - putBoolean(DID_PROMOTE_NEW_RESTRICTED_JOIN_RULE, true) - } - } - /** * Tells if we have already asked the user to disable battery optimisations on android >= M devices. * diff --git a/vector/src/main/java/im/vector/app/features/spaces/RestrictedPromoBottomSheet.kt b/vector/src/main/java/im/vector/app/features/spaces/RestrictedPromoBottomSheet.kt deleted file mode 100644 index dbea6807ce..0000000000 --- a/vector/src/main/java/im/vector/app/features/spaces/RestrictedPromoBottomSheet.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.core.view.isVisible -import im.vector.app.R -import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment -import im.vector.app.databinding.BottomSheetSpaceAdvertiseRestrictedBinding - -class RestrictedPromoBottomSheet : VectorBaseBottomSheetDialogFragment() { - - override fun getBinding(inflater: LayoutInflater, container: ViewGroup?) = - BottomSheetSpaceAdvertiseRestrictedBinding.inflate(inflater, container, false) - - override val showExpanded = true - - var learnMoreMode: Boolean = false - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - render() - views.skipButton.debouncedClicks { - dismiss() - } - - views.learnMore.debouncedClicks { - if (learnMoreMode) { - dismiss() - } else { - learnMoreMode = true - render() - } - } - } - - private fun render() { - if (learnMoreMode) { - views.title.text = getString(R.string.new_let_people_in_spaces_find_and_join) - views.topDescription.text = getString(R.string.to_help_space_members_find_and_join) - views.imageHint.isVisible = true - views.bottomDescription.isVisible = true - views.bottomDescription.text = getString(R.string.this_makes_it_easy_for_rooms_to_stay_private_to_a_space) - views.skipButton.isVisible = false - views.learnMore.text = getString(R.string.ok) - } else { - views.title.text = getString(R.string.help_space_members) - views.topDescription.text = getString(R.string.help_people_in_spaces_find_and_join) - views.imageHint.isVisible = false - views.bottomDescription.isVisible = false - views.skipButton.isVisible = true - views.learnMore.text = getString(R.string.learn_more) - } - } -} diff --git a/vector/src/main/res/drawable-nodpi/room_settings.png b/vector/src/main/res/drawable-nodpi/room_settings.png deleted file mode 100644 index 2e3fb404fa..0000000000 Binary files a/vector/src/main/res/drawable-nodpi/room_settings.png and /dev/null differ diff --git a/vector/src/main/res/layout/bottom_sheet_space_advertise_restricted.xml b/vector/src/main/res/layout/bottom_sheet_space_advertise_restricted.xml deleted file mode 100644 index 7cc243ee75..0000000000 --- a/vector/src/main/res/layout/bottom_sheet_space_advertise_restricted.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - -