mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
Add dedicated methods for the EOL version checks
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
37dc7d1df0
commit
1f8905394e
@ -270,8 +270,7 @@ public class ConversationsListController extends BaseController implements Searc
|
|||||||
currentUser = userUtils.getCurrentUser();
|
currentUser = userUtils.getCurrentUser();
|
||||||
|
|
||||||
if (currentUser != null) {
|
if (currentUser != null) {
|
||||||
if (!currentUser.hasSpreedFeatureCapability("no-ping")) {
|
if (currentUser.isServerEOL()) {
|
||||||
// Talk 4+
|
|
||||||
new LovelyStandardDialog(getActivity(), LovelyStandardDialog.ButtonLayout.HORIZONTAL)
|
new LovelyStandardDialog(getActivity(), LovelyStandardDialog.ButtonLayout.HORIZONTAL)
|
||||||
.setTopColorRes(R.color.nc_darkRed)
|
.setTopColorRes(R.color.nc_darkRed)
|
||||||
.setIcon(DisplayUtils.getTintedDrawable(context.getResources(),
|
.setIcon(DisplayUtils.getTintedDrawable(context.getResources(),
|
||||||
|
@ -553,12 +553,10 @@ public class SettingsController extends BaseController {
|
|||||||
|
|
||||||
baseUrlTextView.setText(Uri.parse(currentUser.getBaseUrl()).getHost());
|
baseUrlTextView.setText(Uri.parse(currentUser.getBaseUrl()).getHost());
|
||||||
|
|
||||||
if (!currentUser.hasSpreedFeatureCapability("no-ping")) {
|
if (currentUser.isServerEOL()) {
|
||||||
// Talk 4+
|
|
||||||
serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkRed));
|
serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkRed));
|
||||||
serverAgeTextView.setText(R.string.nc_settings_server_eol);
|
serverAgeTextView.setText(R.string.nc_settings_server_eol);
|
||||||
} else if (!currentUser.hasSpreedFeatureCapability("chat-replies")) {
|
} else if (currentUser.isServerAlmostEOL()) {
|
||||||
// Talk 8+
|
|
||||||
serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkYellow));
|
serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkYellow));
|
||||||
serverAgeTextView.setText(R.string.nc_settings_server_almost_eol);
|
serverAgeTextView.setText(R.string.nc_settings_server_almost_eol);
|
||||||
} else {
|
} else {
|
||||||
|
@ -92,6 +92,16 @@ public interface User extends Parcelable, Persistable, Serializable {
|
|||||||
return false;
|
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) {
|
default boolean hasSpreedFeatureCapability(String capabilityName) {
|
||||||
if (getCapabilities() != null) {
|
if (getCapabilities() != null) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user