Skip to content

Commit

Permalink
fixed login issue. now works normal
Browse files Browse the repository at this point in the history
  • Loading branch information
AvielCo committed Jun 11, 2020
1 parent cdf6bfe commit 118223d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_email_password);
bundle = getIntent().getExtras();

if (getIntent() != null && bundle != null) { //if not testing
User currentUser;
initElements();
currentUser = (User) bundle.getSerializable("current_user");

User currentUser = (User) bundle.getSerializable("current_user");
SharedPreferences preferences = getSharedPreferences("remember_me", MODE_PRIVATE);
checkbox = preferences.getString("remember", "");
if (checkbox.equals("true") && currentUser != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ protected void onResume() {

@Override
public void onBackPressed() {
if (isFirebaseProcessRunning) {
showInfoToast(R.string.please_wait);
return;
}
if (checkBoxRememberMe) {
setResult(RESULT_OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@

public class SplashScreenActivity extends BaseActivity {

private Bundle bundle;

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
loadLocale(this);
super.onCreate(savedInstanceState);

//Create a bundle to pass to the next activity
Bundle bundle = new Bundle();
bundle = new Bundle();

db = FirebaseFirestore.getInstance();
mAuth = FirebaseAuth.getInstance();
Expand All @@ -41,19 +43,23 @@ public void onComplete(@NonNull Task<DocumentSnapshot> task) {
User user = task.getResult().toObject(User.class);
//if user is logged in, put the permission into bundle
//else, do nothing
bundle.putSerializable("current_user", user);
EasySplashScreen config = new EasySplashScreen(SplashScreenActivity.this)
.withFullScreen()
.withTargetActivity(LoginActivity.class) //go to main activity
.withBundleExtras(bundle) //send bundle, either user logged in or nah
.withBackgroundColor(Color.parseColor("#e1f5fe"))
.withLogo(R.mipmap.app_logo1_foreground); //TODO: adjust logo dimensions

View easySplashScreen = config.create();
setContentView(easySplashScreen);
startMain(user);
}
}
});
}
} else startMain(null);

}

private void startMain(User user) {
bundle.putSerializable("current_user", user);
EasySplashScreen config = new EasySplashScreen(SplashScreenActivity.this)
.withFullScreen()
.withTargetActivity(LoginActivity.class) //go to main activity
.withBundleExtras(bundle) //send bundle, either user logged in or nah
.withBackgroundColor(Color.parseColor("#e1f5fe"))
.withLogo(R.mipmap.app_logo1_foreground); //TODO: adjust logo dimensions
View easySplashScreen = config.create();
setContentView(easySplashScreen);
}
}

0 comments on commit 118223d

Please sign in to comment.