@@ -1045,6 +1045,10 @@ class ConversationsListActivity :
10451045 binding.chatListConnectionLost.visibility = if (show) View .VISIBLE else View .GONE
10461046 }
10471047
1048+ private fun showMaintenanceModeWarning (show : Boolean ) {
1049+ binding.chatListMaintenanceWarning.visibility = if (show) View .VISIBLE else View .GONE
1050+ }
1051+
10481052 private fun handleUI (show : Boolean ) {
10491053 binding.floatingActionButton.isEnabled = show
10501054 binding.searchText.isEnabled = show
@@ -1133,6 +1137,8 @@ class ConversationsListActivity :
11331137 private fun prepareViews () {
11341138 hideLogoForBrandedClients()
11351139
1140+ showMaintenanceModeWarning(false )
1141+
11361142 layoutManager = SmoothScrollLinearLayoutManager (this )
11371143 binding.recyclerView.layoutManager = layoutManager
11381144 binding.recyclerView.setHasFixedSize(true )
@@ -1156,6 +1162,7 @@ class ConversationsListActivity :
11561162 false
11571163 }
11581164 binding.swipeRefreshLayoutView.setOnRefreshListener {
1165+ showMaintenanceModeWarning(false )
11591166 fetchRooms()
11601167 fetchPendingInvitations()
11611168 }
@@ -1931,44 +1938,7 @@ class ConversationsListActivity :
19311938
19321939 private fun showServiceUnavailableDialog (httpException : HttpException ) {
19331940 if (httpException.response()?.headers()?.get(MAINTENANCE_MODE_HEADER_KEY ) == " 1" ) {
1934- binding.floatingActionButton.let {
1935- val dialogBuilder = MaterialAlertDialogBuilder (it.context)
1936- .setIcon(
1937- viewThemeUtils.dialog.colorMaterialAlertDialogIcon(
1938- context,
1939- R .drawable.ic_info_white_24dp
1940- )
1941- )
1942- .setTitle(R .string.nc_dialog_maintenance_mode)
1943- .setMessage(R .string.nc_dialog_maintenance_mode_description)
1944- .setCancelable(false )
1945- .setNegativeButton(R .string.nc_settings_remove_account) { _, _ ->
1946- deleteUserAndRestartApp()
1947- }
1948-
1949- if (resources!! .getBoolean(R .bool.multiaccount_support) && userManager.users.blockingGet().size > 1 ) {
1950- dialogBuilder.setPositiveButton(R .string.nc_switch_account) { _, _ ->
1951- val newFragment: DialogFragment = ChooseAccountDialogFragment .newInstance()
1952- newFragment.show(supportFragmentManager, ChooseAccountDialogFragment .TAG )
1953- }
1954- }
1955-
1956- if (resources!! .getBoolean(R .bool.multiaccount_support)) {
1957- dialogBuilder.setNeutralButton(R .string.nc_account_chooser_add_account) { _, _ ->
1958- val intent = Intent (this , ServerSelectionActivity ::class .java)
1959- intent.putExtra(ADD_ADDITIONAL_ACCOUNT , true )
1960- startActivity(intent)
1961- }
1962- }
1963-
1964- viewThemeUtils.dialog.colorMaterialAlertDialogBackground(it.context, dialogBuilder)
1965- val dialog = dialogBuilder.show()
1966- viewThemeUtils.platform.colorTextButtons(
1967- dialog.getButton(AlertDialog .BUTTON_POSITIVE ),
1968- dialog.getButton(AlertDialog .BUTTON_NEGATIVE ),
1969- dialog.getButton(AlertDialog .BUTTON_NEUTRAL )
1970- )
1971- }
1941+ showMaintenanceModeWarning(true )
19721942 } else {
19731943 showErrorDialog()
19741944 }
0 commit comments