summaryrefslogtreecommitdiff
path: root/src/com/p4square/grow/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/p4square/grow/model')
-rw-r--r--src/com/p4square/grow/model/Message.java8
-rw-r--r--src/com/p4square/grow/model/MessageThread.java4
-rw-r--r--src/com/p4square/grow/model/UserRecord.java16
3 files changed, 27 insertions, 1 deletions
diff --git a/src/com/p4square/grow/model/Message.java b/src/com/p4square/grow/model/Message.java
index ad02af9..9d33320 100644
--- a/src/com/p4square/grow/model/Message.java
+++ b/src/com/p4square/grow/model/Message.java
@@ -5,6 +5,7 @@
package com.p4square.grow.model;
import java.util.Date;
+import java.util.UUID;
/**
* A feed message.
@@ -19,6 +20,13 @@ public class Message {
private String mMessage;
/**
+ * @return a new message id.
+ */
+ public static String generateId() {
+ return String.format("%x-%s", System.currentTimeMillis(), UUID.randomUUID().toString());
+ }
+
+ /**
* @return The id of the thread that the message belongs to.
*/
public String getThreadId() {
diff --git a/src/com/p4square/grow/model/MessageThread.java b/src/com/p4square/grow/model/MessageThread.java
index 25a46b7..9542a18 100644
--- a/src/com/p4square/grow/model/MessageThread.java
+++ b/src/com/p4square/grow/model/MessageThread.java
@@ -21,7 +21,9 @@ public class MessageThread {
*/
public static MessageThread createNew() {
MessageThread t = new MessageThread();
- t.setId(String.format("%x-%s", System.currentTimeMillis(), UUID.randomUUID().toString()));
+ // IDs are keyed to sort lexicographically from latest to oldest.
+ t.setId(String.format("%016x-%s", Long.MAX_VALUE - System.currentTimeMillis(),
+ UUID.randomUUID().toString()));
return t;
}
diff --git a/src/com/p4square/grow/model/UserRecord.java b/src/com/p4square/grow/model/UserRecord.java
index b5aaa4e..4399282 100644
--- a/src/com/p4square/grow/model/UserRecord.java
+++ b/src/com/p4square/grow/model/UserRecord.java
@@ -21,6 +21,7 @@ public class UserRecord {
private String mLastName;
private String mEmail;
private String mLanding;
+ private boolean mNewBeliever;
// Backend Access
private String mBackendPasswordHash;
@@ -117,6 +118,21 @@ public class UserRecord {
}
/**
+ * @return true if the user came from the New Believer's landing.
+ */
+ public boolean getNewBeliever() {
+ return mNewBeliever;
+ }
+
+ /**
+ * Set the user's new believer flag.
+ * @param value The new flag.
+ */
+ public void setNewBeliever(final boolean value) {
+ mNewBeliever = value;
+ }
+
+ /**
* @return The user's backend password hash, null if he doesn't have
* access.
*/