forked from github/wulkanowy-mirror
Fix session handling (#67)
This commit is contained in:
parent
83b4f359bc
commit
c9bdac6a66
@ -16,6 +16,7 @@ import io.github.wulkanowy.data.RepositoryContract;
|
||||
import io.github.wulkanowy.di.component.ApplicationComponent;
|
||||
import io.github.wulkanowy.di.component.DaggerApplicationComponent;
|
||||
import io.github.wulkanowy.di.modules.ApplicationModule;
|
||||
import io.github.wulkanowy.utils.LogUtils;
|
||||
|
||||
public class WulkanowyApp extends Application {
|
||||
|
||||
@ -37,6 +38,17 @@ public class WulkanowyApp extends Application {
|
||||
enableDebugLog();
|
||||
}
|
||||
initializeFabric();
|
||||
initializeUserSession();
|
||||
}
|
||||
|
||||
private void initializeUserSession() {
|
||||
if (repository.getCurrentUserId() != 0) {
|
||||
try {
|
||||
repository.initLastUser();
|
||||
} catch (Exception e) {
|
||||
LogUtils.error("An error occurred when the application was started", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void enableDebugLog() {
|
||||
|
@ -37,7 +37,7 @@ public class GradesSubItem
|
||||
return grade;
|
||||
}
|
||||
|
||||
public void setSubjectAlertImage(View subjectAlertImage) {
|
||||
void setSubjectAlertImage(View subjectAlertImage) {
|
||||
this.subjectAlertImage = subjectAlertImage;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import javax.inject.Inject;
|
||||
|
||||
import io.github.wulkanowy.data.RepositoryContract;
|
||||
import io.github.wulkanowy.ui.base.BasePresenter;
|
||||
import io.github.wulkanowy.utils.LogUtils;
|
||||
|
||||
public class SplashPresenter extends BasePresenter<SplashContract.View>
|
||||
implements SplashContract.Presenter {
|
||||
@ -24,12 +23,7 @@ public class SplashPresenter extends BasePresenter<SplashContract.View>
|
||||
if (getRepository().getCurrentUserId() == 0) {
|
||||
getView().openLoginActivity();
|
||||
} else {
|
||||
try {
|
||||
getRepository().initLastUser();
|
||||
getView().openMainActivity();
|
||||
} catch (Exception e) {
|
||||
LogUtils.error("An error occurred when the application was started", e);
|
||||
}
|
||||
getView().openMainActivity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user