mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 02:38:47 +00:00
Merge pull request #100 from ClaytonWWilson/aaron-branch-2
Aaron branch 2
This commit is contained in:
commit
222dbda627
@ -68,6 +68,11 @@ public class AuthManager {
|
|||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void nullify() {
|
||||||
|
email = null;
|
||||||
|
password = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAuthSession(AuthSession toSet) {
|
public void setAuthSession(AuthSession toSet) {
|
||||||
authSession = (AWSCognitoAuthSession) toSet;
|
authSession = (AWSCognitoAuthSession) toSet;
|
||||||
waiting = false;
|
waiting = false;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
Button decrQuan;
|
Button decrQuan;
|
||||||
Button removeItem;
|
Button removeItem;
|
||||||
Button clearAll;
|
Button clearAll;
|
||||||
//Button shareList;
|
Button shareList;
|
||||||
|
|
||||||
TextView tvTotalPrice;
|
TextView tvTotalPrice;
|
||||||
ProgressBar loadingListItems;
|
ProgressBar loadingListItems;
|
||||||
@ -109,7 +109,7 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*shareList = (Button) findViewById(R.id.buttonShare);
|
shareList = (Button) findViewById(R.id.buttonShare);
|
||||||
shareList.setOnClickListener(new View.OnClickListener() {
|
shareList.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -139,7 +139,7 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
AlertDialog dialog = builder.create();
|
AlertDialog dialog = builder.create();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -36,6 +36,15 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
private AppBarConfiguration mAppBarConfiguration;
|
private AppBarConfiguration mAppBarConfiguration;
|
||||||
public static AuthManager am = new AuthManager();
|
public static AuthManager am = new AuthManager();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
String prev = getIntent().getStringExtra("prev");
|
||||||
|
|
||||||
|
if (prev == null) {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -48,7 +57,6 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
public void run() {
|
public void run() {
|
||||||
Intent intent = new Intent(MainActivity.this, SplashActivity.class);
|
Intent intent = new Intent(MainActivity.this, SplashActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
@ -198,7 +206,6 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
am.signOutUser();
|
am.signOutUser();
|
||||||
Intent intent = new Intent(MainActivity.this, com.example.listify.ui.LoginPage.class);
|
Intent intent = new Intent(MainActivity.this, com.example.listify.ui.LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
|
|||||||
@ -10,6 +10,9 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
public class SplashActivity extends AppCompatActivity {
|
public class SplashActivity extends AppCompatActivity {
|
||||||
public static boolean showSplash = true;
|
public static boolean showSplash = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -20,8 +23,8 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
public void run() {
|
public void run() {
|
||||||
showSplash = false;
|
showSplash = false;
|
||||||
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||||
|
intent.putExtra("prev", "Splash");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,16 +23,20 @@ public class ForgotPasswordPage extends AppCompatActivity {
|
|||||||
String newPassword;
|
String newPassword;
|
||||||
String confirmNewPassword;
|
String confirmNewPassword;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
String prev = getIntent().getStringExtra("prev");
|
||||||
|
|
||||||
|
if (prev != null && (prev.equals("Sign up") || prev.equals("Log in"))) {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_forgotpswd);
|
setContentView(R.layout.activity_forgotpswd);
|
||||||
|
|
||||||
if(am.getEmail() != null) {
|
|
||||||
Intent intent = new Intent(ForgotPasswordPage.this, MainActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
button1 = (Button) findViewById(R.id.button1);
|
button1 = (Button) findViewById(R.id.button1);
|
||||||
button1.setOnClickListener(new View.OnClickListener() {
|
button1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -55,6 +59,7 @@ public class ForgotPasswordPage extends AppCompatActivity {
|
|||||||
am.changePassword(email);
|
am.changePassword(email);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
am.nullify();
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
TextView invalidCred = findViewById(R.id.textView6);
|
TextView invalidCred = findViewById(R.id.textView6);
|
||||||
invalidCred.setText("Password criteria not met. Please try again.");
|
invalidCred.setText("Password criteria not met. Please try again.");
|
||||||
@ -74,10 +79,11 @@ public class ForgotPasswordPage extends AppCompatActivity {
|
|||||||
try {
|
try {
|
||||||
am.confirmPasswordReset(newPassword, code);
|
am.confirmPasswordReset(newPassword, code);
|
||||||
Intent intent = new Intent(ForgotPasswordPage.this, LoginPage.class);
|
Intent intent = new Intent(ForgotPasswordPage.this, LoginPage.class);
|
||||||
|
intent.putExtra("prev", "Forgot password");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
am.nullify();
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,21 +20,26 @@ public class LoginPage extends AppCompatActivity {
|
|||||||
private Button button2; //Forgot password button
|
private Button button2; //Forgot password button
|
||||||
private Button button3; //Log in button
|
private Button button3; //Log in button
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
String prev = getIntent().getStringExtra("prev");
|
||||||
|
|
||||||
|
if (prev != null && (prev.equals("Sign up") || prev.equals("Forgot password"))) {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_login);
|
setContentView(R.layout.activity_login);
|
||||||
|
|
||||||
if(am.getEmail() != null) {
|
|
||||||
Intent intent = new Intent(LoginPage.this, MainActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
button1 = (Button) findViewById(R.id.button1);
|
button1 = (Button) findViewById(R.id.button1);
|
||||||
button1.setOnClickListener(new View.OnClickListener() {
|
button1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(LoginPage.this, SignupPage.class);
|
Intent intent = new Intent(LoginPage.this, SignupPage.class);
|
||||||
|
intent.putExtra("prev", "Log in");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -44,6 +49,7 @@ public class LoginPage extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(LoginPage.this, ForgotPasswordPage.class);
|
Intent intent = new Intent(LoginPage.this, ForgotPasswordPage.class);
|
||||||
|
intent.putExtra("prev", "Log in");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -61,10 +67,11 @@ public class LoginPage extends AppCompatActivity {
|
|||||||
try {
|
try {
|
||||||
am.signIn(email, password);
|
am.signIn(email, password);
|
||||||
Intent intent = new Intent(LoginPage.this, MainActivity.class);
|
Intent intent = new Intent(LoginPage.this, MainActivity.class);
|
||||||
|
intent.putExtra("prev", "Login");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
|
am.nullify();
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
TextView invalidCred = findViewById(R.id.textView5);
|
TextView invalidCred = findViewById(R.id.textView5);
|
||||||
invalidCred.setText("Incorrect email or password. Please try again.");
|
invalidCred.setText("Incorrect email or password. Please try again.");
|
||||||
|
|||||||
@ -32,21 +32,26 @@ public class SignupPage extends AppCompatActivity {
|
|||||||
String password;
|
String password;
|
||||||
String confirmPassword;
|
String confirmPassword;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
String prev = getIntent().getStringExtra("prev");
|
||||||
|
|
||||||
|
if (prev != null && (prev.equals("Log in") || prev.equals("Forgot password"))) {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_signup);
|
setContentView(R.layout.activity_signup);
|
||||||
|
|
||||||
if(am.getEmail() != null) {
|
|
||||||
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
button1 = (Button) findViewById(R.id.button1);
|
button1 = (Button) findViewById(R.id.button1);
|
||||||
button1.setOnClickListener(new View.OnClickListener() {
|
button1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(SignupPage.this, LoginPage.class);
|
Intent intent = new Intent(SignupPage.this, LoginPage.class);
|
||||||
|
intent.putExtra("prev", "Sign up");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -73,6 +78,7 @@ public class SignupPage extends AppCompatActivity {
|
|||||||
am.startSignUp(email, password);
|
am.startSignUp(email, password);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
am.nullify();
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
TextView invalidCred = findViewById(R.id.textView3);
|
TextView invalidCred = findViewById(R.id.textView3);
|
||||||
invalidCred.setText("Invalid credentials. Please try again.");
|
invalidCred.setText("Invalid credentials. Please try again.");
|
||||||
@ -93,10 +99,11 @@ public class SignupPage extends AppCompatActivity {
|
|||||||
am.confirmSignUp(code);
|
am.confirmSignUp(code);
|
||||||
am.signIn(email, password);
|
am.signIn(email, password);
|
||||||
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
||||||
|
intent.putExtra("prev", "Sign up");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
am.nullify();
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.example.listify.ui.home;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -11,6 +12,7 @@ import android.widget.Button;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@ -21,6 +23,7 @@ import com.example.listify.AuthManager;
|
|||||||
import com.example.listify.MainActivity;
|
import com.example.listify.MainActivity;
|
||||||
import com.example.listify.R;
|
import com.example.listify.R;
|
||||||
import com.example.listify.Requestor;
|
import com.example.listify.Requestor;
|
||||||
|
import com.example.listify.ui.ForgotPasswordPage;
|
||||||
import com.example.listify.ui.LoginPage;
|
import com.example.listify.ui.LoginPage;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@ -57,10 +60,35 @@ public class HomeFragment extends Fragment {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
|
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
|
||||||
|
|
||||||
|
try {
|
||||||
|
am.changePassword(am.getEmail());
|
||||||
|
}
|
||||||
|
catch (Exception e) {}
|
||||||
|
/*try {
|
||||||
|
am.confirmPasswordReset("", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] TO = {am.getEmail()};
|
||||||
|
Intent emailIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
emailIntent.setData(Uri.parse("mailto:"));
|
||||||
|
emailIntent.setType("text/plain");
|
||||||
|
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
|
||||||
|
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Listify account deleted");
|
||||||
|
emailIntent.putExtra(Intent.EXTRA_TEXT, "Hello, this email is to confirm that you have deleted your Listify account.");
|
||||||
|
try {
|
||||||
|
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
|
||||||
|
Log.i("Finished sending email...", "");
|
||||||
|
System.out.println("A");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("B");
|
||||||
|
}*/
|
||||||
|
|
||||||
am.deleteUser(requestor);
|
am.deleteUser(requestor);
|
||||||
|
am.nullify();
|
||||||
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
getActivity().finish();
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
|
|||||||
@ -26,14 +26,14 @@
|
|||||||
android:text="Clear All"
|
android:text="Clear All"
|
||||||
android:textSize="10sp"/>
|
android:textSize="10sp"/>
|
||||||
|
|
||||||
<!--<Button
|
<Button
|
||||||
android:id="@+id/buttonShare"
|
android:id="@+id/buttonShare"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="26dp"
|
android:layout_marginStart="1dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="1dp"
|
||||||
android:text="Share"
|
android:text="Share"
|
||||||
android:textSize="10sp"/>-->
|
android:textSize="10sp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user