Replaced incorrect character in JNI

This commit is contained in:
Morgan Pretty 2023-06-01 15:56:58 +10:00
parent 3a035482e4
commit 6a4641bfce
4 changed files with 7 additions and 6 deletions

View File

@ -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 admins = group.members.filter { it.value /*admin = true*/ }.keys.map { Address.fromSerialized(it) }
val groupId = GroupUtil.doubleEncodeGroupID(group.sessionId) val groupId = GroupUtil.doubleEncodeGroupID(group.sessionId)
val title = group.name val title = group.name
val formationTimestamp = group.joinedAt val formationTimestamp = (group.joinedAt * 1000L)
createGroup(groupId, title, members, null, null, admins, formationTimestamp) createGroup(groupId, title, members, null, null, admins, formationTimestamp)
setProfileSharing(Address.fromSerialized(groupId), true) setProfileSharing(Address.fromSerialized(groupId), true)
// Add the group to the user's set of public keys to poll for // 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(), encPubKey = encryptionKeyPair.publicKey.serialize(),
encSecKey = encryptionKeyPair.privateKey.serialize(), encSecKey = encryptionKeyPair.privateKey.serialize(),
disappearingTimer = 0L, disappearingTimer = 0L,
joinedAt = formationTimestamp joinedAt = (formationTimestamp / 1000L)
) )
// shouldn't exist, don't use getOrConstruct + copy // shouldn't exist, don't use getOrConstruct + copy
userGroups.set(groupInfo) userGroups.set(groupInfo)

View File

@ -257,7 +257,7 @@ object ConfigurationMessageUtilities {
encPubKey = encryptionKeyPair.publicKey.serialize(), encPubKey = encryptionKeyPair.publicKey.serialize(),
encSecKey = encryptionKeyPair.privateKey.serialize(), encSecKey = encryptionKeyPair.privateKey.serialize(),
disappearingTimer = recipient.expireMessages.toLong(), disappearingTimer = recipient.expireMessages.toLong(),
joinedAt = group.formationTimestamp joinedAt = (group.formationTimestamp / 1000L)
) )
} }
(allOpenGroups + allLgc).forEach { groupInfo -> (allOpenGroups + allLgc).forEach { groupInfo ->

View File

@ -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) { 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); return c.getString(R.string.DateUtils_just_now);
} else if (isToday(timestamp)) { } else if (isToday(timestamp)) {
return getFormattedDateTime(timestamp, getHourFormat(c), locale); return getFormattedDateTime(timestamp, getHourFormat(c), locale);

View File

@ -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 enc_sec_key_field = env->GetFieldID(clazz, "encSecKey", "[B");
auto priority_field = env->GetFieldID(clazz, "priority", "I"); auto priority_field = env->GetFieldID(clazz, "priority", "I");
auto disappearing_timer_field = env->GetFieldID(clazz, "disappearingTimer", "J"); 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<jstring>(env->GetObjectField(info, id_field)); jstring id = static_cast<jstring>(env->GetObjectField(info, id_field));
jstring name = static_cast<jstring>(env->GetObjectField(info, name_field)); jstring name = static_cast<jstring>(env->GetObjectField(info, name_field));
jobject members_map = env->GetObjectField(info, members_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; long joined_at = info.joined_at;
jclass legacy_group_class = env->FindClass("network/loki/messenger/libsession_util/util/GroupInfo$LegacyGroupInfo"); jclass legacy_group_class = env->FindClass("network/loki/messenger/libsession_util/util/GroupInfo$LegacyGroupInfo");
jmethodID constructor = env->GetMethodID(legacy_group_class, "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;[B[BIJL)V"); jmethodID constructor = env->GetMethodID(legacy_group_class, "<init>", "(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()); 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; return serialized;
} }