Add settings item to allow location sharing.

This commit is contained in:
Onuray Sahin 2021-12-27 17:17:20 +03:00
parent 46c7c7421e
commit de809d6013
4 changed files with 14 additions and 0 deletions

View File

@ -1379,6 +1379,7 @@ class RoomDetailFragment @Inject constructor(
if (!::attachmentTypeSelector.isInitialized) {
attachmentTypeSelector = AttachmentTypeSelectorView(vectorBaseActivity, vectorBaseActivity.layoutInflater, this@RoomDetailFragment)
attachmentTypeSelector.setAttachmentVisibility(AttachmentTypeSelectorView.Type.POLL, vectorPreferences.labsEnablePolls())
attachmentTypeSelector.setAttachmentVisibility(AttachmentTypeSelectorView.Type.LOCATION, vectorPreferences.isLocationSharingEnabled())
}
attachmentTypeSelector.show(views.composerLayout.views.attachmentButton, keyboardStateUtils.isKeyboardShowing)
}

View File

@ -185,6 +185,9 @@ class VectorPreferences @Inject constructor(private val context: Context) {
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
private const val SETTINGS_PREF_ENABLE_LOCATION_SHARING = "SETTINGS_PREF_ENABLE_LOCATION_SHARING"
private const val MEDIA_SAVING_3_DAYS = 0
private const val MEDIA_SAVING_1_WEEK = 1
private const val MEDIA_SAVING_1_MONTH = 2
@ -990,4 +993,8 @@ class VectorPreferences @Inject constructor(private val context: Context) {
fun labsEnablePolls(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_ENABLE_POLLS, false)
}
fun isLocationSharingEnabled(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_PREF_ENABLE_LOCATION_SHARING, true)
}
}

View File

@ -3711,4 +3711,5 @@
<string name="location_not_available_dialog_title">Element could not access your location</string>
<string name="location_not_available_dialog_content">Element could not access your location. Please try again later.</string>
<string name="location_share_external">Open with</string>
<string name="settings_enable_location_sharing">Enable location sharing</string>
</resources>

View File

@ -28,6 +28,11 @@
android:persistent="false"
android:title="@string/font_size" />
<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="true"
android:key="SETTINGS_PREF_ENABLE_LOCATION_SHARING"
android:title="@string/settings_enable_location_sharing" />
</im.vector.app.core.preference.VectorPreferenceCategory>
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/spaces">