"Add Matrix app" menu is now always visible (#1495)

This commit is contained in:
Benoit Marty 2020-06-17 18:13:09 +02:00
parent 1df3b4e18f
commit 86b4c9ac73
5 changed files with 25 additions and 3 deletions

View File

@ -5,7 +5,7 @@ Features ✨:
-
Improvements 🙌:
-
- "Add Matrix app" menu is now always visible (#1495)
Bugfix 🐛:
- Fix dark theme issue on login screen (#1097)

View File

@ -159,6 +159,7 @@ import im.vector.riotx.features.permalink.NavigationInterceptor
import im.vector.riotx.features.permalink.PermalinkHandler
import im.vector.riotx.features.reactions.EmojiReactionPickerActivity
import im.vector.riotx.features.settings.VectorPreferences
import im.vector.riotx.features.settings.VectorSettingsActivity
import im.vector.riotx.features.share.SharedData
import im.vector.riotx.features.themes.ThemeUtils
import im.vector.riotx.features.widgets.WidgetActivity
@ -469,13 +470,28 @@ class RoomDetailFragment @Inject constructor(
true
}
R.id.open_matrix_apps -> {
navigator.openIntegrationManager(requireContext(), roomDetailArgs.roomId, null, null)
if (session.integrationManagerService().isIntegrationEnabled()) {
navigator.openIntegrationManager(requireContext(), roomDetailArgs.roomId, null, null)
} else {
displayDisabledIntegrationDialog()
}
true
}
else -> super.onOptionsItemSelected(item)
}
}
private fun displayDisabledIntegrationDialog() {
AlertDialog.Builder(requireActivity())
.setTitle(R.string.disabled_integration_dialog_title)
.setMessage(R.string.disabled_integration_dialog_content)
.setPositiveButton(R.string.settings) { _, _ ->
navigator.openSettings(requireActivity(), VectorSettingsActivity.EXTRA_DIRECT_ACCESS_GENERAL)
}
.setNegativeButton(R.string.cancel, null)
.show()
}
private fun renderRegularMode(text: String) {
autoCompleter.exitSpecialMode()
composerLayout.collapse()

View File

@ -371,7 +371,7 @@ class RoomDetailViewModel @AssistedInject constructor(
timeline.pendingEventCount() > 0 && vectorPreferences.developerMode()
R.id.resend_all -> timeline.failedToDeliverEventCount() > 0
R.id.clear_all -> timeline.failedToDeliverEventCount() > 0
R.id.open_matrix_apps -> session.integrationManagerService().isIntegrationEnabled()
R.id.open_matrix_apps -> true
else -> false
}

View File

@ -59,6 +59,8 @@ class VectorSettingsActivity : VectorBaseActivity(),
if (isFirstCreation()) {
// display the fragment
when (intent.getIntExtra(EXTRA_DIRECT_ACCESS, EXTRA_DIRECT_ACCESS_ROOT)) {
EXTRA_DIRECT_ACCESS_GENERAL ->
replaceFragment(R.id.vector_settings_page, VectorSettingsGeneralFragment::class.java, null, FRAGMENT_TAG)
EXTRA_DIRECT_ACCESS_ADVANCED_SETTINGS ->
replaceFragment(R.id.vector_settings_page, VectorSettingsAdvancedSettingsFragment::class.java, null, FRAGMENT_TAG)
EXTRA_DIRECT_ACCESS_SECURITY_PRIVACY ->
@ -137,6 +139,7 @@ class VectorSettingsActivity : VectorBaseActivity(),
const val EXTRA_DIRECT_ACCESS_ADVANCED_SETTINGS = 1
const val EXTRA_DIRECT_ACCESS_SECURITY_PRIVACY = 2
const val EXTRA_DIRECT_ACCESS_SECURITY_PRIVACY_MANAGE_SESSIONS = 3
const val EXTRA_DIRECT_ACCESS_GENERAL = 4
private const val FRAGMENT_TAG = "VectorSettingsPreferencesFragment"
}

View File

@ -862,6 +862,9 @@
<string name="settings_integration_allow">Allow integrations</string>
<string name="settings_integration_manager">Integration Manager</string>
<string name="disabled_integration_dialog_title">Integrations are disabled</string>
<string name="disabled_integration_dialog_content">"Enable 'Allow integrations' in Settings to do this."</string>
<string name="settings_user_interface">User interface</string>
<string name="settings_interface_language">Language</string>
<string name="settings_select_language">Choose language</string>