mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 06:05:42 +03:00
show outdated server warning for server <NC12
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
0bc7924232
commit
6af04fc424
5 changed files with 36 additions and 1 deletions
|
@ -1418,6 +1418,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|||
// 4. we got the authentication method required by the server
|
||||
mServerInfo = (GetServerInfoOperation.ServerInfo) (result.getData().get(0));
|
||||
|
||||
// show outdated warning
|
||||
if (mServerInfo.mVersion.compareTo(OwnCloudVersion.nextcloud_12) < 0) {
|
||||
DisplayUtils.showServerOutdatedSnackbar(this);
|
||||
}
|
||||
|
||||
webViewLoginMethod = mServerInfo.mVersion.isWebLoginSupported() && !forceOldLoginMethod;
|
||||
|
||||
if (webViewUser != null && !webViewUser.isEmpty() &&
|
||||
|
|
|
@ -69,6 +69,7 @@ import android.widget.ImageView;
|
|||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.datamodel.VirtualFolderType;
|
||||
|
@ -85,6 +86,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo
|
|||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.lib.resources.shares.OCShare;
|
||||
import com.owncloud.android.lib.resources.shares.ShareType;
|
||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
||||
import com.owncloud.android.media.MediaService;
|
||||
import com.owncloud.android.media.MediaServiceBinder;
|
||||
import com.owncloud.android.operations.CopyFileOperation;
|
||||
|
@ -301,6 +303,7 @@ public class FileDisplayActivity extends HookActivity
|
|||
// always AFTER setContentView(...) in onCreate(); to work around bug in its implementation
|
||||
|
||||
upgradeNotificationForInstantUpload();
|
||||
checkOutdatedServer();
|
||||
}
|
||||
|
||||
private Activity getActivity() {
|
||||
|
@ -353,6 +356,24 @@ public class FileDisplayActivity extends HookActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void checkOutdatedServer() {
|
||||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
|
||||
Account account = getAccount();
|
||||
|
||||
int lastSeenVersion = arbitraryDataProvider.getIntegerValue(account, WhatsNewActivity.KEY_LAST_SEEN_VERSION_CODE);
|
||||
|
||||
if (MainApp.getVersionCode() > lastSeenVersion) {
|
||||
OwnCloudVersion serverVersion = AccountUtils.getServerVersionForAccount(account, this);
|
||||
|
||||
if (serverVersion.compareTo(OwnCloudVersion.nextcloud_12) < 0) {
|
||||
DisplayUtils.showServerOutdatedSnackbar(this);
|
||||
}
|
||||
|
||||
arbitraryDataProvider.storeOrUpdateKeyValue(account.name, WhatsNewActivity.KEY_LAST_SEEN_VERSION_CODE,
|
||||
String.valueOf(MainApp.getVersionCode()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
|
||||
@NonNull int[] grantResults) {
|
||||
|
|
|
@ -182,7 +182,7 @@ public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPa
|
|||
editor.apply();
|
||||
}
|
||||
|
||||
static private int getLastSeenVersionCode() {
|
||||
static public int getLastSeenVersionCode() {
|
||||
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(MainApp.getAppContext());
|
||||
return pref.getInt(KEY_LAST_SEEN_VERSION_CODE, 0);
|
||||
}
|
||||
|
|
|
@ -767,4 +767,11 @@ public class DisplayUtils {
|
|||
}
|
||||
}
|
||||
|
||||
static public void showServerOutdatedSnackbar(Activity activity) {
|
||||
Snackbar.make(activity.findViewById(android.R.id.content),
|
||||
R.string.outdated_server, Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(R.string.dismiss, v -> {
|
||||
})
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -801,4 +801,6 @@
|
|||
<string name="new_version_was_created">New version was created</string>
|
||||
<string name="file_version_restored_successfully">Successfully restored file version.</string>
|
||||
<string name="file_version_restored_error">Error restoring file version!</string>
|
||||
<string name="outdated_server">The server has reached end of life, please upgrade!</string>
|
||||
<string name="dismiss">Dismiss</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue