Skip to content

Commit

Permalink
Fixed ids for user.
Browse files Browse the repository at this point in the history
  • Loading branch information
Celedric committed Oct 30, 2016
1 parent 3da9c6a commit aacf752
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added BCrypt/BCrypt.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions BCrypt/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('BCrypt.jar'))
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ dependencies {
testCompile 'junit:junit:4.12'
compile 'com.reimaginebanking.api:nessie-android-sdk:1.0.4'
compile 'com.amazonaws:aws-java-sdk:1.11.49'
compile project(':BCrypt')
}
24 changes: 13 additions & 11 deletions app/src/main/java/hacknc/com/poolit/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
*/

public class User {
private List<User> friends;
private List<Long> friends;
private String name;
private List<Event> events;
private int score;
private String userID;
private long userID;
private String accountID;

public User(String name) {
friends = new ArrayList<User>();
friends = new ArrayList<Long>();
this.name = name;
events = new ArrayList<Event>();
score = 0;
}

public User(Item i) {
this.name = (String) i.get("name");
this.friends = (List<User>) i.get("friends");
this.friends = (List<Long>) i.get("friends");
this.events = (List<Event>) i.get("events");
this.score = (int) i.get("score");
this.userID = (String) i.get("userId");
this.userID = (long) i.get("userId");
this.accountID = (String) i.get("account");

}
Expand All @@ -39,14 +39,15 @@ public User(Item i) {
* Returns the list of friends associated with this user
* @return The friends attached to this account
*/
public List<User> getFriends() { return friends; }
public List<Long> getFriends() { return friends; }

/**
* Adds a new friend to this user given a name
* @param friend The name of the account you want to add
*/
public void addFriend(User friend) {
friends.add(friend);
long id = friend.getID();
friends.add(id);
}

public String getName() { return name; }
Expand All @@ -66,7 +67,7 @@ public void addEvent(String name, String info, double target, Date date, User[]

public void incrementScore(int i) { score += i; }

public String getID() { return userID; }
public long getID() { return userID; }

public void sync() {
// Find server's copy of this User, sync values
Expand All @@ -77,9 +78,10 @@ public String getAccountID(){
}

public void removeFriend(User friend){
for(User u: friends){
if(friend == u){
friends.remove(u);
long id = friend.getID();
for(long i: friends){
if(id == i){
friends.remove(i);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':app'
include ':app', ':BCrypt'

0 comments on commit aacf752

Please sign in to comment.