|
@@ -1,7 +1,6 @@
|
|
|
package com.sharix.sportsmanfriend.view;
|
|
|
|
|
|
import android.content.Intent;
|
|
|
-import android.content.SharedPreferences;
|
|
|
import android.os.Bundle;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
@@ -10,6 +9,7 @@ import android.widget.Toast;
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
|
|
import com.sharix.sportsmanfriend.R;
|
|
|
+import com.sharix.sportsmanfriend.SharedPreferencesHelperClass;
|
|
|
import com.sharix.sportsmanfriend.requests.HTTPRequest;
|
|
|
|
|
|
import java.util.Objects;
|
|
@@ -18,8 +18,6 @@ public class SingInSingUpActivity extends AppCompatActivity {
|
|
|
|
|
|
private Button btnSingIn;
|
|
|
private EditText EDPhone, EDPassword;
|
|
|
- private SharedPreferences sharedPreferences;
|
|
|
- private SharedPreferences.Editor editor;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -30,8 +28,6 @@ public class SingInSingUpActivity extends AppCompatActivity {
|
|
|
EDPhone = findViewById(R.id.phoneED);
|
|
|
EDPassword = findViewById(R.id.passwordED);
|
|
|
|
|
|
- sharedPreferences = getSharedPreferences("Data", MODE_PRIVATE);
|
|
|
-
|
|
|
EDPhone.setText("99999999999");
|
|
|
EDPassword.setText("password");
|
|
|
|
|
@@ -41,9 +37,8 @@ public class SingInSingUpActivity extends AppCompatActivity {
|
|
|
if (Objects.equals(response, "Ошибка")){
|
|
|
Toast.makeText(getApplicationContext(), "Не правильный логин или пароль", Toast.LENGTH_LONG).show();
|
|
|
} else {
|
|
|
- editor = sharedPreferences.edit();
|
|
|
- editor.putBoolean("userIsLoggedIn", true);
|
|
|
- editor.apply();
|
|
|
+ SharedPreferencesHelperClass.setBoolVar(getApplicationContext(), "userIsLoggedIn", true);
|
|
|
+ SharedPreferencesHelperClass.setStringVar(getApplicationContext(), "token", response);
|
|
|
Intent intent = new Intent(SingInSingUpActivity.this, MainActivity.class);
|
|
|
startActivity(intent);
|
|
|
finish();
|