mirror of
https://codeberg.org/gitnex/GitNex
synced 2024-12-24 01:23:41 +01:00
Merge branch '207-move-version-to-main-activity' of gitnex/GitNex into master
This commit is contained in:
commit
0daf0d1110
@ -389,7 +389,6 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
|
||||
assert version != null;
|
||||
|
||||
VersionCheck vt = VersionCheck.check(getString(R.string.versionLow), getString(R.string.versionHigh), version.getVersion());
|
||||
tinyDb.putString("giteaVersion", version.getVersion());
|
||||
|
||||
switch (vt) {
|
||||
case UNSUPPORTED_NEW:
|
||||
|
@ -30,6 +30,7 @@ import org.mian.gitnex.fragments.StarredRepositoriesFragment;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.GiteaVersion;
|
||||
import org.mian.gitnex.models.UserInfo;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
@ -217,6 +218,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
} else {
|
||||
|
||||
displayUserInfo(instanceUrl, instanceToken, loginUid);
|
||||
giteaVersion(instanceUrl);
|
||||
tinyDb.putBoolean("noConnection", false);
|
||||
|
||||
}
|
||||
@ -311,6 +313,42 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
|
||||
}
|
||||
|
||||
private void giteaVersion(final String instanceUrl) {
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
|
||||
Call<GiteaVersion> callVersion = RetrofitClient
|
||||
.getInstance(instanceUrl, getApplicationContext())
|
||||
.getApiInterface()
|
||||
.getGiteaVersion();
|
||||
|
||||
callVersion.enqueue(new Callback<GiteaVersion>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull final Call<GiteaVersion> callVersion, @NonNull retrofit2.Response<GiteaVersion> responseVersion) {
|
||||
|
||||
if (responseVersion.code() == 200) {
|
||||
|
||||
GiteaVersion version = responseVersion.body();
|
||||
assert version != null;
|
||||
|
||||
tinyDb.putString("giteaVersion", version.getVersion());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<GiteaVersion> callVersion, Throwable t) {
|
||||
|
||||
Log.e("onFailure-version", t.toString());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void displayUserInfo(String instanceUrl, String token, String loginUid) {
|
||||
|
||||
final TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
|
Loading…
Reference in New Issue
Block a user