Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task 37] Remaining docs #165

Merged
merged 5 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

import com.courseproject.tindar.R;
import com.courseproject.tindar.databinding.FragmentHomeBinding;

/** This class implements the home screen fragment of the app */
public class HomeFragment extends Fragment {
/** FragmentHomeBinding instance to help display home page */
private FragmentHomeBinding binding;
/** ImageView of home screen */
ImageView home;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,43 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;

/** This class implements a second home view fragment in order to switch between profiles
* to like/unlike.
*/
public class SecondViewProfileFragment extends Fragment {
/** boolean to see if a user does like the other */
boolean doesLike;
/** current user id index */
private int currentViewProfileUserIdIndex;
/** the other users userId*/
private String otherUserId;

/** the current users userId */
private String userId;
/** a list containing all userIds */
private ArrayList<String> allUserIds;

/** FragmentHomeBinding instance to help display second view profile screen */
private FragmentSecondViewProfileBinding binding;
/** BlankViewModel instance for a blank view */
private BlankNavViewModel blankNavViewModel;

/** image of like button */
ImageButton likeButton;
/** text veiw of display name */
TextView displayNameView;
/** text view of preferred gender */
TextView genderView;
/** text view of birthdate */
TextView birthdateView;
/** text view of location */
TextView locationView;
/** text view of about me information*/
TextView aboutMeView;
/** profile photo image */
ImageView profilePic;
/** string link to profile */
String profileLink;

/** ViewProfilesController instance for methods*/
ViewProfilesController viewProfilesController;

/** instantiate a DateFormat to have a consistent date format */
private final DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy", Locale.CANADA );

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,43 @@
import java.util.ArrayList;
import java.util.Locale;
import java.util.concurrent.TimeUnit;

/** This class implements a home view fragment in order to switch between profiles
* to like/unlike.
*/
public class ViewProfileFragment extends Fragment {
/** boolean to see if a user does like the other */
boolean doesLike;
/** current user id index */
private int currentViewProfileUserIdIndex;
/** the other users userId*/
private String otherUserId;

/** the current users userId */
private String userId;
/** a list containing all userIds */
private ArrayList<String> allUserIds;

/** FragmentHomeBinding instance to help display second view profile screen */
private FragmentViewProfileBinding binding;
/** BlankViewModel instance for a blank view */
private BlankNavViewModel blankNavViewModel;

/** image of like button */
ImageButton likeButton;
/** text veiw of display name */
TextView displayNameView;
/** text view of preferred gender */
TextView genderView;
/** text view of birthdate */
TextView birthdateView;
/** text view of location */
TextView locationView;
/** text view of about me information*/
TextView aboutMeView;
/** profile photo image */
ImageView profilePic;
/** string link to profile */
String profileLink;

/** ViewProfilesController instance for methods*/
ViewProfilesController viewProfilesController;

/** instantiate a DateFormat to have a consistent date format */
private final DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy", Locale.CANADA );

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
import com.courseproject.tindar.usecases.login.LoginDsGateway;
import com.courseproject.tindar.usecases.login.LoginInteractor;

/** This class implements the Login Activity for the front end. Allows the user to see and manipulate
* the log-in actions */
public class LoginActivity extends AppCompatActivity {

/** edit email text box */
private EditText emailText;
/** edit password text box */
private EditText passwordText;

/** string containing the users email */
private String email;
/** string containing the users password */
private String password;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,25 @@
import com.courseproject.tindar.usecases.editaccount.EditAccountDsGateway;
import com.courseproject.tindar.usecases.editaccount.EditAccountInteractor;

/** This class implements the ability to change the users long-in email after creating an account
*/
public class ChangeEmailActivity extends AppCompatActivity {
// Button that sends user back to the settings screen.
/** Button that sends user back to the settings screen. */
ImageButton changeEmailBackButton;
// Button that submits changes to the email.
/** Button that submits changes to the email.*/
Button submitEmailChangeButton;
// Text box to put in new email.
/** Text box to put in new email.*/
EditText changeEmailText;
// Text box to put in new email again.
/** Text box to put in new email again.*/
EditText changeEmailRetype;
// Text box to put in the current password for validation.
/** Text box to put in the current password for validation.*/
EditText changeEmailPasswordValidation;
// userId of the account.
/*8 userId of the account.*/
String userId;

/**
* Creates the email change screen for the user to view.
*
* @param savedInstanceState the saved instance state
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
import com.courseproject.tindar.ds.DatabaseHelper;
import com.courseproject.tindar.usecases.editaccount.EditAccountDsGateway;
import com.courseproject.tindar.usecases.editaccount.EditAccountInteractor;

/** This class implements the ability to change the users password after creating an account
*/
public class ChangePasswordActivity extends AppCompatActivity {
// Button that sends the user back to the settings screen.
/** Button that sends the user back to the settings screen.*/
ImageButton changePasswordBackButton;
// Button that submits the changes to the password.
/** Button that submits the changes to the password.*/
Button submitPasswordChangeButton;
// Text box that contains the new password.
/** Text box that contains the new password.*/
EditText changePasswordText;
// Text box to type the new password a second time.
/** Text box to type the new password a second time.*/
EditText changePasswordRetype;
// Text box to type the current password for validation.
/** Text box to type the current password for validation.*/
EditText changePasswordValidation;
// The user id of the account.
/** The user id of the account.*/
String userId;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
import android.os.Bundle;
import com.courseproject.tindar.BlankNavActivity;
import com.courseproject.tindar.R;

/** This class implements settings activity that allows the user to change account information
* like email or password.
*/
public class SettingsActivity extends AppCompatActivity {
// Button that sends user to change email screen.
/** Button that sends user to change email screen.*/
Button changeEmailButton;
// Button that sends user to change password screen.
/** Button that sends user to change password screen.*/
Button changePasswordButton;
// Button that sends user back to the home screen.
/** Button that sends user back to the home screen.*/
ImageButton settingsBackButton;
// userId of the account.
/** userId of the account.*/
String userId;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
package com.courseproject.tindar.usecases.login;

/**
* This interface defines the gateway for accessing the data source related to user login
* information.
* It provides methods to read user IDs based on their email and password.
*/
public interface LoginDsGateway {

/**
* Retrieves the user ID associated with the given email and password.
*
* @param email The email address of the user.
* @param password The password of the user.
* @return The user ID if the email and password match; otherwise, null.
*/
String readUserId(String email, String password);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
package com.courseproject.tindar.usecases.login;

/**
* This interface defines the input boundary for the user login use case.
* It provides methods for checking user credentials and retrieving user IDs based on email
* and password.
*/
public interface LoginInputBoundary {

/**
* Checks whether the provided email and password match a user's credentials.
*
* @param email The email address of the user.
* @param password The password of the user.
* @return boolean True if the provided credentials are valid, otherwise
*/
Boolean checkUserPassword(String email, String password);

/**
* Retrieves the user ID associated with the given email and password.
*
* @param email The email address of the user.
* @param password The password of the user.
* @return The user ID if the email and password are valid, otherwise null
*/
String getUserId(String email, String password);
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
package com.courseproject.tindar.usecases.login;

/**
* This class implements the login use case's input boundary.
* It interacts with the data source gateway to authenticate users and retrieve user IDs.
*/
public class LoginInteractor implements LoginInputBoundary {

final LoginDsGateway loginDsGateway;

/**
* Constructs a new LoginInteractor with the specified LoginDsGateway.
*
* @param loginDsGateway The data source gateway for login-related operations.
*/
public LoginInteractor(LoginDsGateway loginDsGateway){
this.loginDsGateway = loginDsGateway;
}

/**
* Checks whether the provided email and password match a user's credentials.
*
* @param email The email address of the user.
* @param password The password of the user.
* @return Boolean if the provided credentials are valid, otherwise false
*/
@Override
public Boolean checkUserPassword(String email, String password){
return !(loginDsGateway.readUserId(email, password) == null);
}

/**
* Retrieves the user ID associated with the given email and password.
*
* @param email The email address of the user.
* @param password The password of the user.
* @return The user ID if the email and password are valid, otherwise null
*/
@Override
public String getUserId(String email, String password){
return loginDsGateway.readUserId(email, password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

import java.util.ArrayList;

/**
* This interface defines the gateway for accessing the data source related to user lists.
* It provides a method to retrieve a list of user IDs excluding the provided user's ID.
*/
public interface UserListDsGateway {

/**
* Retrieves a list of user IDs excluding the provided user's ID.
*
* @param userId The ID of the user for whom the list is being generated.
* @return An ArrayList containing the user IDs of other users, excluding the provided user's ID.
*/
ArrayList<String> getAllOtherUserIds(String userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

import java.util.ArrayList;

/**
* This interface defines the input boundary for the user list use case.
* It provides a method to retrieve a list of user IDs excluding the provided user's ID.
*/
public interface UserListInputBoundary {


/**
* Retrieves a list of user IDs excluding the provided user's ID.
*
* @param userId The ID of the user for whom the list is being generated.
* @return An ArrayList containing the user IDs of other users, excluding the provided user's ID.
*/
ArrayList<String> getAllOtherUserIds(String userId);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
package com.courseproject.tindar.usecases.userlist;

import java.util.ArrayList;

/**
* This class implements the user list use case's input boundary.
* It interacts with the data source gateway to retrieve a list of user IDs excluding the
* provided user's ID.
*/
public class UserListInteractor implements UserListInputBoundary{

final UserListDsGateway userListDsGateway;

/**
* Constructs a new UserListInteractor with the specified UserListDsGateway.
*
* @param userListDsGateway The data source gateway for user list-related operations.
*/
public UserListInteractor(UserListDsGateway userListDsGateway) {
this.userListDsGateway = userListDsGateway;
}

/**
* Retrieves a list of user IDs excluding the provided user's ID.
*
* @param userId The ID of the user for whom the list is being generated.
* @return An ArrayList containing the user IDs of other users, excluding the provided user's ID.
*/
public ArrayList<String> getAllOtherUserIds(String userId){
return userListDsGateway.getAllOtherUserIds(userId);
}
Expand Down