mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 02:01:56 +00:00
Merge pull request #231 from HabitRPG/fix-issue-187
fixes #187 - Register / Login - Backbutton
This commit is contained in:
commit
21765c6e88
2 changed files with 11 additions and 6 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,10 +129,8 @@ public class MainActivity extends AppCompatActivity implements HabitRPGUserCallb
|
|||
Fabric.with(this, crashlytics);
|
||||
|
||||
this.hostConfig = PrefsActivity.fromContext(this);
|
||||
HabiticaApplication.checkUserAuthentication(this, hostConfig);
|
||||
|
||||
// Add uuid to crashes
|
||||
crashlytics.core.setString("uuid", hostConfig.getUser());
|
||||
if(!HabiticaApplication.checkUserAuthentication(this, hostConfig))
|
||||
return;
|
||||
|
||||
HabiticaApplication.ApiHelper = this.mAPIHelper = new APIHelper(this, hostConfig);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue