diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java index de9c9b43b..9a6fefeae 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java @@ -270,8 +270,7 @@ public class ConversationsListController extends BaseController implements Searc currentUser = userUtils.getCurrentUser(); if (currentUser != null) { - if (!currentUser.hasSpreedFeatureCapability("no-ping")) { - // Talk 4+ + if (currentUser.isServerEOL()) { new LovelyStandardDialog(getActivity(), LovelyStandardDialog.ButtonLayout.HORIZONTAL) .setTopColorRes(R.color.nc_darkRed) .setIcon(DisplayUtils.getTintedDrawable(context.getResources(), diff --git a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java index bf85b1a88..b8f44629e 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java @@ -553,12 +553,10 @@ public class SettingsController extends BaseController { baseUrlTextView.setText(Uri.parse(currentUser.getBaseUrl()).getHost()); - if (!currentUser.hasSpreedFeatureCapability("no-ping")) { - // Talk 4+ + if (currentUser.isServerEOL()) { serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkRed)); serverAgeTextView.setText(R.string.nc_settings_server_eol); - } else if (!currentUser.hasSpreedFeatureCapability("chat-replies")) { - // Talk 8+ + } else if (currentUser.isServerAlmostEOL()) { serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkYellow)); serverAgeTextView.setText(R.string.nc_settings_server_almost_eol); } else { diff --git a/app/src/main/java/com/nextcloud/talk/models/database/User.java b/app/src/main/java/com/nextcloud/talk/models/database/User.java index 1d02b0e9a..7e599f782 100644 --- a/app/src/main/java/com/nextcloud/talk/models/database/User.java +++ b/app/src/main/java/com/nextcloud/talk/models/database/User.java @@ -92,6 +92,16 @@ public interface User extends Parcelable, Persistable, Serializable { return false; } + default boolean isServerEOL() { + // Capability is available since Talk 4 => Nextcloud 14 => Autmn 2018 + return !hasSpreedFeatureCapability("no-ping"); + } + + default boolean isServerAlmostEOL() { + // Capability is available since Talk 8 => Nextcloud 18 => January 2020 + return !hasSpreedFeatureCapability("chat-replies"); + } + default boolean hasSpreedFeatureCapability(String capabilityName) { if (getCapabilities() != null) { try {