Add a warning when the server version is (almost) EOL

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-05-04 09:39:08 +02:00 committed by Andy Scherzinger
parent a6ff0186d1
commit 01b760f97e
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
4 changed files with 31 additions and 2 deletions

View File

@ -144,6 +144,8 @@ public class SettingsController extends BaseController {
EmojiTextView displayNameTextView;
@BindView(R.id.base_url_text)
TextView baseUrlTextView;
@BindView(R.id.server_age_warning_text)
TextView serverAgeTextView;
@BindView(R.id.settings_call_sound)
MaterialStandardPreference settingsCallSound;
@BindView(R.id.settings_message_sound)
@ -551,6 +553,18 @@ public class SettingsController extends BaseController {
baseUrlTextView.setText(Uri.parse(currentUser.getBaseUrl()).getHost());
if (!currentUser.hasSpreedFeatureCapability("no-ping")) {
// Talk 4+
serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkRed));
serverAgeTextView.setText(R.string.nc_settings_server_eol);
} else if (!currentUser.hasSpreedFeatureCapability("chat-replies")) {
// Talk 8+
serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkYellow));
serverAgeTextView.setText(R.string.nc_settings_server_almost_eol);
} else {
serverAgeTextView.setVisibility(View.GONE);
}
reauthorizeButton.addPreferenceClickListener(view14 -> {
getRouter().pushController(RouterTransaction.with(
new WebViewLoginController(currentUser.getBaseUrl(), true))

View File

@ -71,7 +71,17 @@
android:layout_centerHorizontal="true"
android:layout_margin="4dp"
android:textColor="@color/medium_emphasis_text"
tools:text="jane@nextcloud.com" />
tools:text="nextcloud.com" />
<TextView
android:id="@+id/server_age_warning_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/base_url_text"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/standard_margin"
android:textColor="@color/nc_darkRed"
tools:text="@string/nc_settings_server_almost_eol" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/avatar_image"
@ -87,7 +97,7 @@
android:id="@+id/settings_switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/base_url_text"
android:layout_below="@id/server_age_warning_text"
android:tag="switchAccountButton"
apc:mp_title="@string/nc_settings_switch_account" />

View File

@ -50,6 +50,7 @@
<color name="conversation_unread_bubble_text">#222222</color>
<color name="nc_darkRed">#D32F2F</color>
<color name="nc_darkYellow">#FF9800</color>
<color name="nc_darkGreen">#006400</color>
<color name="controller_chat_separator">#E8E8E8</color>
<color name="grey_600">#757575</color>

View File

@ -85,6 +85,10 @@
<string name="nc_settings_remove_confirmation">Please confirm your intent to remove the current account.</string>
<string name="nc_settings_remove_account">Remove account</string>
<string name="nc_settings_add_account">Add a new account</string>
<string name="nc_settings_server_eol">The server version is too old and not supported by this version of the
Android app</string>
<string name="nc_settings_server_almost_eol">The server version is very old and will not be supported in the next
release!</string>
<string name="nc_add">Add</string>
<string name="nc_settings_wrong_account">Only current account can be reauthorized</string>
<string name="nc_settings_no_talk_installed">Talk app is not installed on the server you tried to authenticate against</string>