Delabs polls.

This commit is contained in:
Onuray Sahin 2022-01-24 14:32:27 +03:00
parent b0b92c062e
commit 749194b27c
5 changed files with 3 additions and 22 deletions

View file

@ -48,8 +48,4 @@ class UserPreferencesProvider @Inject constructor(private val vectorPreferences:
fun shouldShowAvatarDisplayNameChanges(): Boolean { fun shouldShowAvatarDisplayNameChanges(): Boolean {
return vectorPreferences.showAvatarDisplayNameChangeMessages() return vectorPreferences.showAvatarDisplayNameChangeMessages()
} }
fun shouldShowPolls(): Boolean {
return vectorPreferences.labsEnablePolls()
}
} }

View file

@ -1373,7 +1373,6 @@ class RoomDetailFragment @Inject constructor(
override fun onAddAttachment() { override fun onAddAttachment() {
if (!::attachmentTypeSelector.isInitialized) { if (!::attachmentTypeSelector.isInitialized) {
attachmentTypeSelector = AttachmentTypeSelectorView(vectorBaseActivity, vectorBaseActivity.layoutInflater, this@RoomDetailFragment) attachmentTypeSelector = AttachmentTypeSelectorView(vectorBaseActivity, vectorBaseActivity.layoutInflater, this@RoomDetailFragment)
attachmentTypeSelector.setAttachmentVisibility(AttachmentTypeSelectorView.Type.POLL, vectorPreferences.labsEnablePolls())
} }
attachmentTypeSelector.show(views.composerLayout.views.attachmentButton) attachmentTypeSelector.show(views.composerLayout.views.attachmentButton)
} }

View file

@ -119,8 +119,6 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen
val diff = computeMembershipDiff() val diff = computeMembershipDiff()
if ((diff.isJoin || diff.isPart) && !userPreferencesProvider.shouldShowJoinLeaves()) return true if ((diff.isJoin || diff.isPart) && !userPreferencesProvider.shouldShowJoinLeaves()) return true
if ((diff.isAvatarChange || diff.isDisplaynameChange) && !userPreferencesProvider.shouldShowAvatarDisplayNameChanges()) return true if ((diff.isAvatarChange || diff.isDisplaynameChange) && !userPreferencesProvider.shouldShowAvatarDisplayNameChanges()) return true
} else if (root.getClearType() == EventType.POLL_START && !userPreferencesProvider.shouldShowPolls()) {
return true
} }
return false return false
} }

View file

@ -196,8 +196,6 @@ class VectorPreferences @Inject constructor(private val context: Context) {
private const val TAKE_PHOTO_VIDEO_MODE = "TAKE_PHOTO_VIDEO_MODE" private const val TAKE_PHOTO_VIDEO_MODE = "TAKE_PHOTO_VIDEO_MODE"
private const val SETTINGS_LABS_ENABLE_POLLS = "SETTINGS_LABS_ENABLE_POLLS"
// Possible values for TAKE_PHOTO_VIDEO_MODE // Possible values for TAKE_PHOTO_VIDEO_MODE
const val TAKE_PHOTO_VIDEO_MODE_ALWAYS_ASK = 0 const val TAKE_PHOTO_VIDEO_MODE_ALWAYS_ASK = 0
const val TAKE_PHOTO_VIDEO_MODE_PHOTO = 1 const val TAKE_PHOTO_VIDEO_MODE_PHOTO = 1
@ -991,8 +989,4 @@ class VectorPreferences @Inject constructor(private val context: Context) {
putInt(TAKE_PHOTO_VIDEO_MODE, mode) putInt(TAKE_PHOTO_VIDEO_MODE, mode)
} }
} }
fun labsEnablePolls(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_ENABLE_POLLS, false)
}
} }

View file

@ -51,16 +51,10 @@
android:title="@string/labs_enable_latex_maths" /> android:title="@string/labs_enable_latex_maths" />
<!--</im.vector.app.core.preference.VectorPreferenceCategory>--> <!--</im.vector.app.core.preference.VectorPreferenceCategory>-->
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_LABS_ENABLE_POLLS"
android:title="@string/labs_enable_polls" />
<im.vector.app.core.preference.VectorSwitchPreference <im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="SETTINGS_LABS_AUTO_REPORT_UISI" android:key="SETTINGS_LABS_AUTO_REPORT_UISI"
android:title="@string/labs_auto_report_uisi" android:summary="@string/labs_auto_report_uisi_desc"
android:summary="@string/labs_auto_report_uisi_desc"/> android:title="@string/labs_auto_report_uisi" />
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>