diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt index 430d9cd63b..ecfbc31648 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt @@ -564,7 +564,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co val admins = group.members.filter { it.value /*admin = true*/ }.keys.map { Address.fromSerialized(it) } val groupId = GroupUtil.doubleEncodeGroupID(group.sessionId) val title = group.name - val formationTimestamp = group.joinedAt + val formationTimestamp = (group.joinedAt * 1000L) createGroup(groupId, title, members, null, null, admins, formationTimestamp) setProfileSharing(Address.fromSerialized(groupId), true) // Add the group to the user's set of public keys to poll for @@ -836,7 +836,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co encPubKey = encryptionKeyPair.publicKey.serialize(), encSecKey = encryptionKeyPair.privateKey.serialize(), disappearingTimer = 0L, - joinedAt = formationTimestamp + joinedAt = (formationTimestamp / 1000L) ) // shouldn't exist, don't use getOrConstruct + copy userGroups.set(groupInfo) diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/ConfigurationMessageUtilities.kt b/app/src/main/java/org/thoughtcrime/securesms/util/ConfigurationMessageUtilities.kt index 1e5e9b475c..1848080c2f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/ConfigurationMessageUtilities.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/ConfigurationMessageUtilities.kt @@ -257,7 +257,7 @@ object ConfigurationMessageUtilities { encPubKey = encryptionKeyPair.publicKey.serialize(), encSecKey = encryptionKeyPair.privateKey.serialize(), disappearingTimer = recipient.expireMessages.toLong(), - joinedAt = group.formationTimestamp + joinedAt = (group.formationTimestamp / 1000L) ) } (allOpenGroups + allLgc).forEach { groupInfo -> diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/DateUtils.java b/app/src/main/java/org/thoughtcrime/securesms/util/DateUtils.java index 874440f5de..66c838cc1d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/DateUtils.java +++ b/app/src/main/java/org/thoughtcrime/securesms/util/DateUtils.java @@ -67,7 +67,8 @@ public class DateUtils extends android.text.format.DateUtils { } public static String getDisplayFormattedTimeSpanString(final Context c, final Locale locale, final long timestamp) { - if (isWithin(timestamp, 1, TimeUnit.MINUTES)) { + // If the timestamp is invalid (ie. 0) then assume we're waiting on data and just use the 'Now' copy + if (timestamp == 0 || isWithin(timestamp, 1, TimeUnit.MINUTES)) { return c.getString(R.string.DateUtils_just_now); } else if (isToday(timestamp)) { return getFormattedDateTime(timestamp, getHourFormat(c), locale); diff --git a/libsession-util/src/main/cpp/user_groups.h b/libsession-util/src/main/cpp/user_groups.h index 1ec852340b..ddcea8f8db 100644 --- a/libsession-util/src/main/cpp/user_groups.h +++ b/libsession-util/src/main/cpp/user_groups.h @@ -51,7 +51,7 @@ inline session::config::legacy_group_info deserialize_legacy_group_info(JNIEnv * auto enc_sec_key_field = env->GetFieldID(clazz, "encSecKey", "[B"); auto priority_field = env->GetFieldID(clazz, "priority", "I"); auto disappearing_timer_field = env->GetFieldID(clazz, "disappearingTimer", "J"); - auto joined_at_field = env->GetFieldID(clazz, "joinedAt", "L"); + auto joined_at_field = env->GetFieldID(clazz, "joinedAt", "J"); jstring id = static_cast(env->GetObjectField(info, id_field)); jstring name = static_cast(env->GetObjectField(info, name_field)); jobject members_map = env->GetObjectField(info, members_field); @@ -122,7 +122,7 @@ inline jobject serialize_legacy_group_info(JNIEnv *env, session::config::legacy_ long joined_at = info.joined_at; jclass legacy_group_class = env->FindClass("network/loki/messenger/libsession_util/util/GroupInfo$LegacyGroupInfo"); - jmethodID constructor = env->GetMethodID(legacy_group_class, "", "(Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;[B[BIJL)V"); + jmethodID constructor = env->GetMethodID(legacy_group_class, "", "(Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;[B[BIJJ)V"); jobject serialized = env->NewObject(legacy_group_class, constructor, session_id, name, members, enc_pubkey, enc_seckey, priority, joined_at, (jlong) info.disappearing_timer.count()); return serialized; }