mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Merge branch 'development' into notification-heart-rating
This commit is contained in:
commit
791190f681
4 changed files with 33 additions and 1 deletions
|
|
@ -5,6 +5,9 @@ import android.util.Log;
|
|||
import com.cappielloantonio.tempo.subsonic.RetrofitClient;
|
||||
import com.cappielloantonio.tempo.subsonic.Subsonic;
|
||||
import com.cappielloantonio.tempo.subsonic.base.ApiResponse;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import retrofit2.Call;
|
||||
|
||||
|
|
@ -21,7 +24,15 @@ public class SystemClient {
|
|||
|
||||
public Call<ApiResponse> ping() {
|
||||
Log.d(TAG, "ping()");
|
||||
return systemService.ping(subsonic.getParams());
|
||||
Call<ApiResponse> pingCall = systemService.ping(subsonic.getParams());
|
||||
if (Preferences.isInUseServerAddressLocal()) {
|
||||
pingCall.timeout()
|
||||
.timeout(1, TimeUnit.SECONDS);
|
||||
} else {
|
||||
pingCall.timeout()
|
||||
.timeout(3, TimeUnit.SECONDS);
|
||||
}
|
||||
return pingCall;
|
||||
}
|
||||
|
||||
public Call<ApiResponse> getLicense() {
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public class MainActivity extends BaseActivity {
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
pingServer();
|
||||
initService();
|
||||
}
|
||||
|
||||
|
|
@ -351,6 +352,7 @@ public class MainActivity extends BaseActivity {
|
|||
Preferences.switchInUseServerAddress();
|
||||
App.refreshSubsonicClient();
|
||||
pingServer();
|
||||
resetView();
|
||||
} else {
|
||||
Preferences.setOpenSubsonic(subsonicResponse.getOpenSubsonic() != null && subsonicResponse.getOpenSubsonic());
|
||||
}
|
||||
|
|
@ -361,6 +363,7 @@ public class MainActivity extends BaseActivity {
|
|||
Preferences.switchInUseServerAddress();
|
||||
App.refreshSubsonicClient();
|
||||
pingServer();
|
||||
resetView();
|
||||
} else {
|
||||
mainViewModel.ping().observe(this, subsonicResponse -> {
|
||||
if (subsonicResponse == null) {
|
||||
|
|
@ -376,6 +379,13 @@ public class MainActivity extends BaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void resetView() {
|
||||
resetViewModel();
|
||||
int id = Objects.requireNonNull(navController.getCurrentDestination()).getId();
|
||||
navController.popBackStack(id, true);
|
||||
navController.navigate(id);
|
||||
}
|
||||
|
||||
private void getOpenSubsonicExtensions() {
|
||||
if (Preferences.getToken() != null) {
|
||||
mainViewModel.getOpenSubsonicExtensions().observe(this, openSubsonicExtensions -> {
|
||||
|
|
|
|||
|
|
@ -312,6 +312,9 @@
|
|||
<string name="settings_github_link">https://github.com/eddyizm/tempo</string>
|
||||
<string name="settings_github_summary">Follow the development</string>
|
||||
<string name="settings_github_title">Github</string>
|
||||
<string name="settings_support_discussion_link">https://github.com/eddyizm/tempo/discussions</string>
|
||||
<string name="settings_support_summary">Join community discussions and support</string>
|
||||
<string name="settings_support_title">User support</string>
|
||||
<string name="settings_image_size">Set image resolution</string>
|
||||
<string name="settings_language">Language</string>
|
||||
<string name="settings_logout_title">Log out</string>
|
||||
|
|
|
|||
|
|
@ -376,6 +376,14 @@
|
|||
android:data="@string/settings_github_link" />
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
app:summary="@string/settings_support_summary"
|
||||
app:title="@string/settings_support_title">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="@string/settings_support_discussion_link" />
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
app:summary="@string/undraw_thanks"
|
||||
app:title="@string/undraw_page">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue