mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-14 01:45:55 -07:00
feat: check and save usable OpenSubsonic APIs
This commit is contained in:
parent
234c9a10d2
commit
b9462d7374
5 changed files with 65 additions and 7 deletions
|
|
@ -70,6 +70,7 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
init();
|
||||
checkConnectionType();
|
||||
getOpenSubsonicExtensions();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -334,11 +335,25 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
private void pingServer() {
|
||||
if (Preferences.getToken() != null) {
|
||||
mainViewModel.ping().observe(this, isPingSuccessfull -> {
|
||||
if (!isPingSuccessfull && Preferences.showServerUnreachableDialog()) {
|
||||
mainViewModel.ping().observe(this, subsonicResponse -> {
|
||||
if (subsonicResponse == null && Preferences.showServerUnreachableDialog()) {
|
||||
ServerUnreachableDialog dialog = new ServerUnreachableDialog();
|
||||
dialog.show(getSupportFragmentManager(), null);
|
||||
}
|
||||
|
||||
if (subsonicResponse != null) {
|
||||
Preferences.setOpenSubsonic(subsonicResponse.getOpenSubsonic() != null && subsonicResponse.getOpenSubsonic());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void getOpenSubsonicExtensions() {
|
||||
if (Preferences.getToken() != null) {
|
||||
mainViewModel.getOpenSubsonicExtensions().observe(this, openSubsonicExtensions -> {
|
||||
if (openSubsonicExtensions != null) {
|
||||
Preferences.setOpenSubsonicExtensions(openSubsonicExtensions);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue