mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 04:39:04 +00:00
fix #187
This commit is contained in:
parent
3b6bb4439f
commit
32ba6ec14e
2 changed files with 12 additions and 3 deletions
|
|
@ -151,10 +151,17 @@ public class HabiticaApplication extends Application {
|
|||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void checkUserAuthentication(Context context, HostConfig hostConfig) {
|
||||
public static boolean checkUserAuthentication(Context context, HostConfig hostConfig) {
|
||||
if (hostConfig == null || hostConfig.getApi() == null || hostConfig.getApi().equals("") || hostConfig.getUser() == null || hostConfig.getUser().equals("")) {
|
||||
context.startActivity(new Intent(context, LoginActivity.class));
|
||||
Intent intent = new Intent(context, LoginActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
context.startActivity(intent);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
|
|
|||
|
|
@ -129,7 +129,9 @@ public class MainActivity extends AppCompatActivity implements HabitRPGUserCallb
|
|||
Fabric.with(this, crashlytics);
|
||||
|
||||
this.hostConfig = PrefsActivity.fromContext(this);
|
||||
HabiticaApplication.checkUserAuthentication(this, hostConfig);
|
||||
if(!HabiticaApplication.checkUserAuthentication(this, hostConfig))
|
||||
return;
|
||||
|
||||
HabiticaApplication.ApiHelper = this.mAPIHelper = new APIHelper(this, hostConfig);
|
||||
|
||||
new Select().from(HabitRPGUser.class).where(Condition.column("id").eq(hostConfig.getUser())).async().querySingle(userTransactionListener);
|
||||
|
|
|
|||
Loading…
Reference in a new issue