diff --git a/Habitica/assets/migrations/Habitica/2.sql b/Habitica/assets/migrations/Habitica/2.sql
index e69de29bb..725b4aa5a 100644
--- a/Habitica/assets/migrations/Habitica/2.sql
+++ b/Habitica/assets/migrations/Habitica/2.sql
@@ -0,0 +1 @@
+ALTER TABLE HabitRPGUser ADD COLUMN authentication_id varchar(255);
\ No newline at end of file
diff --git a/Habitica/res/values/colors.xml b/Habitica/res/values/colors.xml
index 474f9ea10..5423b95ad 100644
--- a/Habitica/res/values/colors.xml
+++ b/Habitica/res/values/colors.xml
@@ -83,20 +83,6 @@
#555555
#FFFFFFFF
-
- #303030
-
- #000
- #de9a9a9a
- #8AFFFFFF
- #de9a9a9a
- #42FFFFFF
- #1FFFFFFF
-
- #202020
- @color/brand
- #FFF
-
#ffd8dcdd
#c3c2c6
diff --git a/Habitica/res/values/styles.xml b/Habitica/res/values/styles.xml
index 57fca5b64..30bb6f697 100644
--- a/Habitica/res/values/styles.xml
+++ b/Habitica/res/values/styles.xml
@@ -30,7 +30,7 @@
- @color/material_drawer_hint_text
- @color/material_drawer_divider
- @color/material_drawer_selected
- - @color/brand
+ - @color/brand_200
- @color/material_drawer_header_selection_text
- @style/PopupTheme
diff --git a/Habitica/src/com/habitrpg/android/habitica/AvatarActivityBase.java b/Habitica/src/com/habitrpg/android/habitica/AvatarActivityBase.java
index 2d69eed8c..a47adeefe 100644
--- a/Habitica/src/com/habitrpg/android/habitica/AvatarActivityBase.java
+++ b/Habitica/src/com/habitrpg/android/habitica/AvatarActivityBase.java
@@ -109,6 +109,11 @@ public abstract class AvatarActivityBase extends InstabugAppCompatActivity {
public void updateSidebar() {
final IProfile profile = accountHeader.getProfiles().get(0);
+ if (User.getAuthentication() != null) {
+ if (User.getAuthentication().getLocalAuthentication() != null) {
+ profile.withEmail(User.getAuthentication().getLocalAuthentication().getEmail());
+ }
+ }
profile.withName(User.getProfile().getName());
new UserPicture(User, this, true, false).setPictureWithRunnable(new UserPictureRunnable() {
public void run(Bitmap avatar) {
diff --git a/Habitica/src/com/habitrpg/android/habitica/GemPurchaseActivity.java b/Habitica/src/com/habitrpg/android/habitica/GemPurchaseActivity.java
index 9c9bd69d6..46f29228a 100644
--- a/Habitica/src/com/habitrpg/android/habitica/GemPurchaseActivity.java
+++ b/Habitica/src/com/habitrpg/android/habitica/GemPurchaseActivity.java
@@ -82,7 +82,11 @@ public class GemPurchaseActivity extends AppCompatActivity {
HabitRPGUser user = new Select().from(HabitRPGUser.class).where(Condition.column("id").eq(hostConfig.getUser())).querySingle();
final IProfile profile = accountHeader.getProfiles().get(0);
- profile.withName(user.getProfile().getName());
+ if (user.getAuthentication() != null) {
+ if (user.getAuthentication().getLocalAuthentication() != null) {
+ profile.withEmail(user.getAuthentication().getLocalAuthentication().getEmail());
+ }
+ } profile.withName(user.getProfile().getName());
new UserPicture(user, this, true, false).setPictureWithRunnable(new UserPictureRunnable() {
public void run(Bitmap avatar) {
profile.withIcon(avatar);
diff --git a/Habitica/src/com/habitrpg/android/habitica/HabitDatabase.java b/Habitica/src/com/habitrpg/android/habitica/HabitDatabase.java
index 911a29482..19b1af154 100644
--- a/Habitica/src/com/habitrpg/android/habitica/HabitDatabase.java
+++ b/Habitica/src/com/habitrpg/android/habitica/HabitDatabase.java
@@ -10,5 +10,5 @@ public class HabitDatabase {
public static final String NAME = "Habitica";
- public static final int VERSION = 1;
+ public static final int VERSION = 2;
}
diff --git a/Habitica/src/com/habitrpg/android/habitica/TavernActivity.java b/Habitica/src/com/habitrpg/android/habitica/TavernActivity.java
index 600bb8257..4db05f2d0 100644
--- a/Habitica/src/com/habitrpg/android/habitica/TavernActivity.java
+++ b/Habitica/src/com/habitrpg/android/habitica/TavernActivity.java
@@ -88,7 +88,11 @@ public class TavernActivity extends AppCompatActivity {
private void updateSidebar() {
final IProfile profile = accountHeader.getProfiles().get(0);
- profile.withName(User.getProfile().getName());
+ if (User.getAuthentication() != null) {
+ if (User.getAuthentication().getLocalAuthentication() != null) {
+ profile.withEmail(User.getAuthentication().getLocalAuthentication().getEmail());
+ }
+ } profile.withName(User.getProfile().getName());
new UserPicture(User, this, true, false).setPictureWithRunnable(new UserPictureRunnable() {
public void run(Bitmap avatar) {
profile.withIcon(avatar);
diff --git a/Habitica/src/com/habitrpg/android/habitica/userpicture/UserPicture.java b/Habitica/src/com/habitrpg/android/habitica/userpicture/UserPicture.java
index 124e7f852..438f5a385 100644
--- a/Habitica/src/com/habitrpg/android/habitica/userpicture/UserPicture.java
+++ b/Habitica/src/com/habitrpg/android/habitica/userpicture/UserPicture.java
@@ -155,18 +155,8 @@ public class UserPicture {
currentCacheFileName = layersHash.concat(".png");
// does it already exist?
-<<<<<<< HEAD
return BitmapUtils.loadFromFile(currentCacheFileName);
}
-=======
- Bitmap cache = BitmapUtils.loadFromFile(currentCacheFileName);
-
- // yes => load image to bitmap
- if (cache != null) {
- imageView.setImageBitmap(cache);
- return;
- }
->>>>>>> d0ae3a5b4a54a09409b3701d256c7715181ae781
private void generateImage(List layerNames) {
Integer layerNumber = 0;
@@ -219,26 +209,15 @@ public class UserPicture {
yOffset = 0;
}
-<<<<<<< HEAD
if (this.hasPetMount && !((this.hasBackground && layerNumber == 1) ||
(!this.hasBackground && layerNumber == 0) ||
(this.hasPetMount && layerNumber == this.layers.size()-2) ||
(!this.hasPetMount && layerNumber == this.layers.size()-1)
-=======
- if (this.hasMount && !((this.hasBackground && layerNumber == 1) ||
- (!this.hasBackground && layerNumber == 0) ||
- (this.hasPet && layerNumber == this.layers.size() - 2) ||
- (!this.hasPet && layerNumber == this.layers.size() - 1)
->>>>>>> d0ae3a5b4a54a09409b3701d256c7715181ae781
)) {
yOffset = 0;
}
-<<<<<<< HEAD
if (this.hasPetMount && layerNumber == this.layers.size()-1) {
-=======
- if (this.hasPet && layerNumber == this.layers.size() - 1) {
->>>>>>> d0ae3a5b4a54a09409b3701d256c7715181ae781
xOffset = 0;
yOffset = 43;
}
diff --git a/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/Authentication.java b/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/Authentication.java
index 5c793daa1..97547d114 100644
--- a/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/Authentication.java
+++ b/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/Authentication.java
@@ -1,7 +1,43 @@
package com.magicmicky.habitrpgwrapper.lib.models;
+import com.google.gson.annotations.SerializedName;
+import com.habitrpg.android.habitica.HabitDatabase;
+import com.raizlabs.android.dbflow.annotation.Column;
+import com.raizlabs.android.dbflow.annotation.ForeignKey;
+import com.raizlabs.android.dbflow.annotation.ForeignKeyReference;
+import com.raizlabs.android.dbflow.annotation.NotNull;
+import com.raizlabs.android.dbflow.annotation.PrimaryKey;
+import com.raizlabs.android.dbflow.annotation.Table;
+import com.raizlabs.android.dbflow.structure.BaseModel;
+
/**
* Created by admin on 18/11/15.
*/
-public class Authentication {
+@Table(databaseName = HabitDatabase.NAME)
+public class Authentication extends BaseModel {
+
+ @Column
+ @PrimaryKey
+ @NotNull
+ String user_id;
+
+ @SerializedName("local")
+ @Column
+ @ForeignKey(references = {@ForeignKeyReference(columnName = "localauthentication_user_id",
+ columnType = String.class,
+ foreignColumnName = "user_id")})
+ public LocalAuthentication localAuthentication;
+
+ public LocalAuthentication getLocalAuthentication() { return localAuthentication; }
+
+ public void setLocalAuthentication(LocalAuthentication LocalAuthentication) {this.localAuthentication = LocalAuthentication; }
+
+ @Override
+ public void save() {
+
+ if (localAuthentication != null)
+ localAuthentication.user_id = user_id;
+
+ super.save();
+ }
}
diff --git a/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/HabitRPGUser.java b/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/HabitRPGUser.java
index 04f3bd196..3982fa66a 100644
--- a/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/HabitRPGUser.java
+++ b/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/HabitRPGUser.java
@@ -1,5 +1,6 @@
package com.magicmicky.habitrpgwrapper.lib.models;
+import com.google.gson.annotations.SerializedName;
import com.habitrpg.android.habitica.HabitDatabase;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import com.raizlabs.android.dbflow.annotation.Column;
@@ -65,6 +66,13 @@ public class HabitRPGUser extends BaseModel {
foreignColumnName = "user_id")})
private Items items;
+ @Column
+ @ForeignKey(references = {@ForeignKeyReference(columnName = "authentication_id",
+ columnType = String.class,
+ foreignColumnName = "user_id")})
+ @SerializedName("auth")
+ private Authentication authentication;
+
public Preferences getPreferences() {
return preferences;
}
@@ -141,6 +149,10 @@ public class HabitRPGUser extends BaseModel {
return this.balance;
}
+ public Authentication getAuthentication() { return authentication; }
+
+ public void setAuthentication(Authentication authentication) {this.authentication = authentication; }
+
@OneToMany(methods = {OneToMany.Method.SAVE, OneToMany.Method.DELETE}, variableName = "habits")
public List getHabits() {
if(habits == null) {
@@ -207,6 +219,7 @@ public class HabitRPGUser extends BaseModel {
stats.id = id;
profile.user_Id = id;
items.user_id = id;
+ authentication.user_id = id;
ArrayList allTasks = new ArrayList();
diff --git a/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/LocalAuthentication.java b/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/LocalAuthentication.java
index aa1bdeaeb..46d28351e 100644
--- a/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/LocalAuthentication.java
+++ b/Habitica/src/com/magicmicky/habitrpgwrapper/lib/models/LocalAuthentication.java
@@ -1,7 +1,29 @@
package com.magicmicky.habitrpgwrapper.lib.models;
+import com.habitrpg.android.habitica.HabitDatabase;
+import com.raizlabs.android.dbflow.annotation.Column;
+import com.raizlabs.android.dbflow.annotation.NotNull;
+import com.raizlabs.android.dbflow.annotation.PrimaryKey;
+import com.raizlabs.android.dbflow.annotation.Table;
+import com.raizlabs.android.dbflow.structure.BaseModel;
+
/**
* Created by admin on 18/11/15.
*/
-public class LocalAuthentication {
+@Table(databaseName = HabitDatabase.NAME)
+public class LocalAuthentication extends BaseModel {
+
+ @Column
+ @PrimaryKey
+ @NotNull
+ String user_id;
+
+ @Column
+ String email, username;
+
+ public String getEmail() { return email; }
+ public String getUsername() { return username; }
+
+ public void setEmail(String email) {this.email = email; }
+ public void setUsername(String username) {this.username = username; }
}