fix(mobile): support Android system file picker

This commit is contained in:
key
2026-07-29 23:52:44 +08:00
parent 6a6b264f22
commit 5027bef32d
27 changed files with 680 additions and 130 deletions
@@ -137,6 +137,7 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { onHide, onShow, onUnload } from '@dcloudio/uni-app';
import { isPlatformFileSelectionActive } from '@/services/file-selection-lifecycle';
import type {
AsrResponse,
InterviewFinishResponse,
@@ -500,7 +501,7 @@ onShow(() => {
onHide(() => {
speechPlayback.stop();
cancelQuestionRecording();
if (!isPlatformFileSelectionActive()) cancelQuestionRecording();
});
onUnload(() => {
+2 -1
View File
@@ -503,6 +503,7 @@
<script setup lang="ts">
import { computed, nextTick, ref } from 'vue';
import { onHide, onShow, onUnload } from '@dcloudio/uni-app';
import { isPlatformFileSelectionActive } from '@/services/file-selection-lifecycle';
import ChatComposer from '@/components/chat/ChatComposer.vue';
import RealtimePracticeAppBridge from '@/components/practice/RealtimePracticeAppBridge.vue';
import type {
@@ -1851,7 +1852,7 @@ onHide(() => {
stopRealtime();
invalidateRequests();
speechPlayback.stop();
cancelRecording();
if (!isPlatformFileSelectionActive()) cancelRecording();
});
onUnload(() => {
+8 -5
View File
@@ -231,6 +231,7 @@
import { computed, nextTick, ref } from 'vue';
import { onHide, onShow, onUnload } from '@dcloudio/uni-app';
import ChatComposer from '@/components/chat/ChatComposer.vue';
import { isPlatformFileSelectionActive } from '@/services/file-selection-lifecycle';
import { isLoggedIn, rememberLoginRedirect } from '@/services/auth';
import { chooseKnowledgeMedia } from '@/services/knowledge';
import { resetPageScroll } from '@/services/navigation';
@@ -769,13 +770,15 @@ const goLogin = () => {
uni.navigateTo({ url: '/pages/auth/login/index' });
};
const teardown = () => {
const teardown = (preservePlatformFileSelection = false) => {
organizeGeneration += 1;
uploadGeneration += 1;
mediaSelectionGeneration += 1;
mineGeneration += 1;
submitGeneration += 1;
cancelVoiceTranscription();
if (!preservePlatformFileSelection) {
mediaSelectionGeneration += 1;
cancelVoiceTranscription();
}
activeUploadTask?.abort();
activeUploadTask = null;
speechPlayback.stop();
@@ -784,7 +787,7 @@ const teardown = () => {
uploading.value = false;
submitting.value = false;
loadingMine.value = false;
mediaSelecting.value = false;
if (!preservePlatformFileSelection) mediaSelecting.value = false;
};
const clearConversationState = () => {
@@ -833,7 +836,7 @@ onShow(() => {
}
});
onHide(teardown);
onHide(() => teardown(isPlatformFileSelectionActive()));
onUnload(() => {
teardown();
speechPlayback.destroy();
+2 -1
View File
@@ -424,6 +424,7 @@
<script setup lang="ts">
import { computed, nextTick, ref } from 'vue';
import { onHide, onShow, onUnload } from '@dcloudio/uni-app';
import { isPlatformFileSelectionActive } from '@/services/file-selection-lifecycle';
import type {
AnswerFeedbackVerdict,
BroadcastKnowledgeContext,
@@ -1565,7 +1566,7 @@ onHide(() => {
cancelPendingBroadcastConsultation();
speechPlayback.stop();
composerRef.value?.teardown();
cancelVoiceTranscription();
if (!isPlatformFileSelectionActive()) cancelVoiceTranscription();
cancelPendingMediaSearch();
});