Use voice commit receipts for both conversation types and document ownership
This commit is contained in:
1 parent
d39e043eb1
commit
0c9cfd5cd0
3 files changed
+5
-4
No files matched your search
@@ -43,7 +43,7 @@ class AudioRecorderManager {
|
||||
PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
|
||||
/** channelId — канал либо dm:conv_id; replyTo/requestId относятся к каналу, generation — к PM.
|
||||
/** channelId — канал либо dm:conv_id; replyTo относится к каналу, requestId подтверждает commit, generation — к PM.
|
||||
* true — Android/native захват запущен; false — отказ с диагностикой и откатом принадлежащих ресурсов. */
|
||||
@Synchronized fun startRecording(channelId: String, replyTo: String = "", requestId: Long = 0, generation: Long = 0): Boolean =
|
||||
startCapture(CaptureMode.RECORD, channelId, replyTo, requestId, generation)
|
||||
|
||||
@@ -16,6 +16,7 @@ import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.ensureActive
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -1549,13 +1550,13 @@ class ChatViewModel : ViewModel() {
|
||||
if (target is ConversationTarget.Pm && !dmTargetCurrent(target)) return
|
||||
if (recordingStopping) { LogManager.addLog("WARN", "VM", "recording is still stopping"); return }
|
||||
if (_isRecording.value) { LogManager.addLog("WARN", "VM", "recording already active"); return }
|
||||
if (target is ConversationTarget.Channel && target.id in _submittingChannels.value) {
|
||||
if (target.nativeId in _submittingChannels.value || composerSubmissions.states.value[target]?.finished == false) {
|
||||
LogManager.addLog("WARN", "Reply", "voice start blocked by pending submission ch=${target.id}"); return
|
||||
}
|
||||
val reply = replyFor(target)
|
||||
val request = ++nextSubmissionId to CompletableDeferred<Boolean>()
|
||||
submissions[request.first] = request.second
|
||||
if (!audioRecorder.startRecording(target.nativeId, reply?.message?.messageId.orEmpty(), request?.first ?: 0,
|
||||
if (!audioRecorder.startRecording(target.nativeId, reply?.message?.messageId.orEmpty(), request.first,
|
||||
(target as? ConversationTarget.Pm)?.generation ?: 0)) {
|
||||
submissions.remove(request.first)
|
||||
LogManager.addLog("ERROR", "VM", "voice recording failed to start")
|
||||
|
||||
@@ -23,7 +23,7 @@ int voice_recorder_init(const char* db_path);
|
||||
void voice_recorder_deinit(void);
|
||||
|
||||
/* Непустой target короче 64 байтов; только 48000 Hz/1 канал, reply_to — обязательные 32 байта (нули = нет ответа).
|
||||
* request_id и reply_to относятся к каналу; generation относится к DM (0 захватывает поколение в trampoline).
|
||||
* request_id подтверждает локальный commit канала/DM; reply_to относится к каналу, generation — к DM (0 захватывает при входе).
|
||||
* 0 — запись начата, -1 — неверные аргументы/нет init/уже active. */
|
||||
int voice_recorder_start(const char* channel_id, int sample_rate, int channels, const uint8_t reply_to[32], uint64_t request_id, uint64_t generation);
|
||||
/* samples заимствован на вызов, count>0 — число int16; 0 — принят, -1 — нет записи/аргументы/OOM. */
|
||||
|
||||
Reference in new issue
Block a user