2019-05-29 14:52:00 +02:00
|
|
|
package lu.circl.mispbump.activities;
|
2019-05-27 16:06:07 +02:00
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.os.Bundle;
|
2019-06-17 09:49:09 +02:00
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
2019-05-27 16:06:07 +02:00
|
|
|
|
|
|
|
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
2019-06-19 20:01:49 +02:00
|
|
|
import lu.circl.mispbump.models.restModels.User;
|
2019-05-27 16:06:07 +02:00
|
|
|
|
|
|
|
public class StartUpActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
if (isUserLoggedIn()) {
|
|
|
|
Intent home = new Intent(this, HomeActivity.class);
|
|
|
|
startActivity(home);
|
|
|
|
} else {
|
|
|
|
Intent login = new Intent(this, LoginActivity.class);
|
|
|
|
startActivity(login);
|
|
|
|
}
|
|
|
|
|
2019-05-29 14:52:00 +02:00
|
|
|
// closes the activity to prevent going back to this (empty) activity
|
2019-05-27 16:06:07 +02:00
|
|
|
finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean isUserLoggedIn() {
|
|
|
|
PreferenceManager preferenceManager = PreferenceManager.getInstance(this);
|
|
|
|
User user = preferenceManager.getUserInfo();
|
|
|
|
return user != null;
|
|
|
|
}
|
|
|
|
}
|