diff --git a/CHANGES.md b/CHANGES.md index abac591140..897d6cbcde 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,7 @@ Features ✨: - Improvements 🙌: - - + - "Add Matrix app" menu is now always visible (#1495) Bugfix 🐛: - Fix dark theme issue on login screen (#1097) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt index dbb26377f6..bf386d15a2 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt @@ -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() diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt index 69a6429efb..1785151af5 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt @@ -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 } diff --git a/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsActivity.kt b/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsActivity.kt index 0c73c0f5d3..bbe6358bd9 100755 --- a/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsActivity.kt @@ -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" } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 19afc120cb..931a7896eb 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -862,6 +862,9 @@ Allow integrations Integration Manager + Integrations are disabled + "Enable 'Allow integrations' in Settings to do this." + User interface Language Choose language