feat: add background group creation and placeholder spinny progress

This commit is contained in:
0x330a
2023-09-18 17:26:34 +10:00
parent ec02087c6b
commit fc57d3396d
6 changed files with 171 additions and 73 deletions

View File

@@ -198,3 +198,20 @@ Java_network_loki_messenger_libsession_1util_GroupKeysConfig_keys(JNIEnv *env, j
}
return our_stack;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_network_loki_messenger_libsession_1util_GroupKeysConfig_currentHashes(JNIEnv *env,
jobject thiz) {
auto ptr = ptrToKeys(env, thiz);
auto existing = ptr->current_hashes();
jclass stack = env->FindClass("java/util/Stack");
jmethodID init = env->GetMethodID(stack, "<init>", "()V");
jobject our_list = env->NewObject(stack, init);
jmethodID push = env->GetMethodID(stack, "push", "(Ljava/lang/Object;)Ljava/lang/Object;");
for (auto& hash : existing) {
auto hash_bytes = env->NewStringUTF(hash.data());
env->CallObjectMethod(our_list, push, hash_bytes);
}
return our_list;
}

View File

@@ -292,7 +292,8 @@ class GroupMembersConfig(pointer: Long): ConfigBase(pointer), Closeable {
}
}
sealed class ConfigSig(pointer: Long) : Config(pointer)
sealed class ConfigSig(pointer: Long) : Config(pointer) {
}
class GroupKeysConfig(pointer: Long): ConfigSig(pointer) {
companion object {
@@ -322,6 +323,7 @@ class GroupKeysConfig(pointer: Long): ConfigSig(pointer) {
external fun needsRekey(): Boolean
external fun pendingKey(): ByteArray?
external fun pendingConfig(): ByteArray?
external fun currentHashes(): List<String>
external fun rekey(info: GroupInfoConfig, members: GroupMembersConfig): ByteArray
override fun close() {
free()