Browse Source

Auto logout process handled

pms_issue/31163_FaceVerification
Sumit Mandal 1 year ago
parent
commit
0ede79cbe7
5 changed files with 27 additions and 24 deletions
  1. +7
    -0
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java
  2. +10
    -14
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/Splashactivity.java
  3. +2
    -0
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java
  4. +0
    -1
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java
  5. +8
    -9
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java

+ 7
- 0
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java View File

@ -157,6 +157,9 @@ public class CheckInActivity extends AppCompatActivity {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
SharedPreferences.Editor editor = shared.edit();
editor.putBoolean("IsUserLogin",false);
editor.commit();
Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class); Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class);
startActivity(intent); startActivity(intent);
@ -186,6 +189,10 @@ public class CheckInActivity extends AppCompatActivity {
popup_log_out.setOnClickListener(new View.OnClickListener() { popup_log_out.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
SharedPreferences.Editor editor = shared.edit();
editor.putBoolean("IsUserLogin",false);
editor.commit();
Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class); Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class);
startActivity(intent); startActivity(intent);
finish(); finish();


+ 10
- 14
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/Splashactivity.java View File

@ -10,8 +10,10 @@ import android.os.Handler;
import android.view.WindowManager; import android.view.WindowManager;
import cn.pedant.SweetAlert.SweetAlertDialog; import cn.pedant.SweetAlert.SweetAlertDialog;
import ru.visionlab.femdemo.authentication.AuthSuccessActivity;
import ru.visionlab.femdemo.login.LoginActivity; import ru.visionlab.femdemo.login.LoginActivity;
import ru.visionlab.femdemo.login.LoginActivityNew; import ru.visionlab.femdemo.login.LoginActivityNew;
import ru.visionlab.femdemo.register.RegisterActivity;
public class Splashactivity extends AppCompatActivity { public class Splashactivity extends AppCompatActivity {
@ -29,26 +31,20 @@ public class Splashactivity extends AppCompatActivity {
// creating a new intent // creating a new intent
SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE); SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
boolean loggedBefore = sharedPreferences.getBoolean("loggedBefore",false); boolean loggedBefore = sharedPreferences.getBoolean("loggedBefore",false);
boolean IsUserLogin = sharedPreferences.getBoolean("IsUserLogin",false);
System.out.println("Value of loggedBefore "+ loggedBefore);
if(loggedBefore){
if(!IsUserLogin){
Intent i = new Intent(Splashactivity.this, LoginActivity.class); Intent i = new Intent(Splashactivity.this, LoginActivity.class);
startActivity(i); startActivity(i);
finish();
} }
else { else {
Intent i = new Intent(Splashactivity.this, LoginActivity.class); // on below line we are
// starting a new activity.
startActivity(i);
// on the below line we are finishing
// our current activity.
finish();
final Intent intent = new Intent(Splashactivity.this, CheckInActivity.class);
intent.putExtra("FromRegister", true);
intent.putExtra("checkinButtonFromRegister", true);
startActivity(intent);
finish();
} }
} }
}, 2000); }, 2000);
} }

+ 2
- 0
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java View File

@ -106,6 +106,7 @@ public class LoginActivity extends BaseActivity {
public void onClick(View view) { public void onClick(View view) {
Intent intent = new Intent(LoginActivity.this,LoginActivityNew.class); Intent intent = new Intent(LoginActivity.this,LoginActivityNew.class);
startActivity(intent); startActivity(intent);
finish();
} }
}); });
reg_new = findViewById(R.id.reg_new); reg_new = findViewById(R.id.reg_new);
@ -114,6 +115,7 @@ public class LoginActivity extends BaseActivity {
public void onClick(View view) { public void onClick(View view) {
Intent intent = new Intent(LoginActivity.this, RegisterActivityNew.class); Intent intent = new Intent(LoginActivity.this, RegisterActivityNew.class);
startActivity(intent); startActivity(intent);
finish();
} }
}); });


+ 0
- 1
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java View File

@ -557,7 +557,6 @@ public class LoginActivityNew extends AppCompatActivity {
if(statuscode.equals("200")) if(statuscode.equals("200"))
{ {
// preferences.setUsername(username);
SharedPreferences.Editor editor = shared.edit(); SharedPreferences.Editor editor = shared.edit();
editor.putString("RegisterUser",username); editor.putString("RegisterUser",username);
editor.putString("Employeeid",_employeeid); editor.putString("Employeeid",_employeeid);


+ 8
- 9
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java View File

@ -118,7 +118,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
private boolean goingSomewhere = false; private boolean goingSomewhere = false;
String valueFromApiCheckIn; String valueFromApiCheckIn;
SharedPreferences shared;
@SuppressLint("MissingInflatedId") @SuppressLint("MissingInflatedId")
@ -131,9 +131,9 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
//ButterKnife.bind(this); //ButterKnife.bind(this);
setToolbar(); setToolbar();
SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
String login = sharedPreferences.getString("login","");
String Descriptor = sharedPreferences.getString("Descriptor","");
shared = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
String login = shared.getString("login","");
String Descriptor = shared.getString("Descriptor","");
System.out.println("Value of login and Descriptor " + preferences.getUsername()+" "); System.out.println("Value of login and Descriptor " + preferences.getUsername()+" ");
Intent intent = getIntent(); Intent intent = getIntent();
@ -584,12 +584,13 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
} }
private void showSuccess() { private void showSuccess() {
SharedPreferences.Editor editor = shared.edit();
editor.putBoolean("IsUserLogin",true);
editor.commit();
final Intent intent = new Intent(RegisterActivity.this, CheckInActivity.class); final Intent intent = new Intent(RegisterActivity.this, CheckInActivity.class);
intent.putExtra(AuthSuccessActivity.LOGIN, login); intent.putExtra(AuthSuccessActivity.LOGIN, login);
System.out.println("login value "+ login); System.out.println("login value "+ login);
if (BuildConfig.IS_OFFLINE_VERSION) { if (BuildConfig.IS_OFFLINE_VERSION) {
intent.putExtra(AuthSuccessActivity.TIME, (int) (((double) (verifEndTime - verifStartTime)) / 1e6)); intent.putExtra(AuthSuccessActivity.TIME, (int) (((double) (verifEndTime - verifStartTime)) / 1e6));
intent.putExtra("FromRegister", true); intent.putExtra("FromRegister", true);
@ -597,9 +598,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
intent.putExtra("valueFromApiCheckIn", valueFromApiCheckIn); intent.putExtra("valueFromApiCheckIn", valueFromApiCheckIn);
intent.putExtra("UserName", login); intent.putExtra("UserName", login);
} }
startActivity(intent); startActivity(intent);
finish(); finish();
/*if (checkinButton) { /*if (checkinButton) {


Loading…
Cancel
Save