mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 13:35:33 +03: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
3 changed files with 13 additions and 6 deletions
|
@ -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(),
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue