mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 12:49:02 +00:00
Fix network error on first startup
This commit is contained in:
parent
af2be913c4
commit
3bca8be3f4
2 changed files with 7 additions and 2 deletions
|
|
@ -342,6 +342,10 @@ public class APIHelper implements Action1<Throwable> {
|
|||
return taskList;
|
||||
}
|
||||
|
||||
public boolean hasAuthenticationKeys() {
|
||||
return this.hostConfig.getUser() != null;
|
||||
}
|
||||
|
||||
public class ErrorResponse{
|
||||
public String message;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,8 +192,9 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!HabiticaApplication.checkUserAuthentication(this, hostConfig))
|
||||
if (!HabiticaApplication.checkUserAuthentication(this, hostConfig)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Check if reminder alarm is set
|
||||
scheduleReminder(this);
|
||||
|
|
@ -232,7 +233,7 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
|
|||
|
||||
//resync, if last sync was more than 10 minutes ago
|
||||
if (this.lastSync == null || (new Date().getTime() - this.lastSync.getTime()) > 180000) {
|
||||
if (this.apiHelper != null) {
|
||||
if (this.apiHelper != null && this.apiHelper.hasAuthenticationKeys()) {
|
||||
this.apiHelper.retrieveUser(true)
|
||||
.compose(apiHelper.configureApiCallObserver())
|
||||
.subscribe(new HabitRPGUserCallback(this), throwable -> {});
|
||||
|
|
|
|||
Loading…
Reference in a new issue