added more precise timestamp_ms for streaming status

This commit is contained in:
Mariotaku Lee 2017-03-16 13:55:34 +08:00
parent f04c49af74
commit 9faccceb49
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
2 changed files with 11 additions and 5 deletions

View File

@ -205,6 +205,9 @@ public class Status extends TwitterResponseObject implements Comparable<Status>,
@JsonField(name = "uri")
String uri;
@JsonField(name = "timestamp_ms")
long timestampMs = -1;
@ParcelableNoThanks
private transient long sortId = -1;
@ -265,6 +268,9 @@ public class Status extends TwitterResponseObject implements Comparable<Status>,
* UTC time when this Tweet was created.
*/
public Date getCreatedAt() {
if (timestampMs != -1) {
return new Date(timestampMs);
}
return createdAt;
}

View File

@ -321,11 +321,6 @@ class StreamingService : BaseService() {
return true
}
override fun onException(ex: Throwable): Boolean {
DebugLog.w(LOGTAG, msg = "Exception for ${account.key}", tr = ex)
return true
}
override fun onStatusDeleted(event: DeletionEvent): Boolean {
val deleteWhere = Expression.and(Expression.likeRaw(Columns.Column(Statuses.ACCOUNT_KEY), "'%@'||?"),
Expression.equalsArgs(Columns.Column(Statuses.STATUS_ID))).sql
@ -339,6 +334,11 @@ class StreamingService : BaseService() {
return true
}
override fun onException(ex: Throwable): Boolean {
DebugLog.w(LOGTAG, msg = "Exception for ${account.key}", tr = ex)
return true
}
override fun onUnhandledEvent(obj: TwitterStreamObject, json: String) {
DebugLog.d(LOGTAG, msg = "Unhandled event ${obj.determine()} for ${account.key}: $json")
}