Skip to content

Commit fb24068

Browse files
committed
Declare microphone-related permissions for voice recording in AndroidManifest and handle runtime permission errors appropriately in Android app. Update versionCode to 133 and add localized strings for improved error messaging.
1 parent 27b18e1 commit fb24068

5 files changed

Lines changed: 27 additions & 5 deletions

File tree

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
applicationId "com.compassconnections.app"
1212
minSdkVersion rootProject.ext.minSdkVersion
1313
targetSdkVersion rootProject.ext.targetSdkVersion
14-
versionCode 132
14+
versionCode 133
1515
versionName "1.32.0"
1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
aaptOptions {

android/app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@
8888
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
8989
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9090

91+
<!-- Voice auto-fill on the profile form. Capacitor's BridgeWebChromeClient already answers the
92+
WebView's AUDIO_CAPTURE request by asking for these two at runtime, but Android silently
93+
denies a runtime request for a permission that was never declared here — so getUserMedia
94+
rejected with NotAllowedError and the web UI blamed the browser. -->
95+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
96+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
97+
98+
<!-- Declaring RECORD_AUDIO implicitly marks android.hardware.microphone as required, which would
99+
hide the app on Play from any device without a mic. Recording is one optional feature, so
100+
keep distribution wide and let the UI degrade instead. -->
101+
<uses-feature android:name="android.hardware.microphone" android:required="false" />
102+
91103
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />
92104

93105
<!-- Firebase Cloud Messaging -->

common/messages/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,7 @@
10761076
"profile.voice.review_transcript": "Das haben wir gehört. Sie müssen nichts aufräumen: Ähs, Fehlstarts und die Stellen, an denen Sie sich mitten im Satz korrigiert haben, übernehmen wir für Sie — nichts davon landet in Ihrem Profil. Zu korrigieren lohnt sich nur, was wir falsch verstanden haben: Namen und Orte sind die üblichen Verdächtigen.",
10771077
"profile.voice.fill_profile": "Mein Profil ausfüllen",
10781078
"profile.voice.error.permission": "Wir konnten nicht auf Ihr Mikrofon zugreifen. Erlauben Sie den Mikrofonzugriff in Ihrem Browser, und versuchen Sie es erneut.",
1079+
"profile.voice.error.permission_app": "Wir konnten nicht auf Ihr Mikrofon zugreifen. Erlauben Sie die Mikrofon-Berechtigung für Compass in Ihren Geräteeinstellungen, und versuchen Sie es erneut.",
10791080
"profile.voice.error.unsupported": "Ihr Browser unterstützt keine Sprachaufnahme. Nutzen Sie stattdessen die Option Link oder Text.",
10801081
"profile.voice.error.failed": "Die Aufnahme ist fehlgeschlagen. Bitte versuchen Sie es erneut.",
10811082
"profile.voice.error.transcription": "Wir konnten Ihre Aufnahme nicht transkribieren. Sie ist noch da — versuchen Sie es erneut, oder füllen Sie Ihr Profil manuell aus.",

common/messages/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@
10751075
"profile.voice.review_transcript": "Voici ce que nous avons entendu. Pas besoin de le nettoyer : les hésitations, les faux départs, les fois où vous avez changé d'avis en cours de phrase sont gérés pour vous, et rien de tout cela ne se retrouvera sur votre profil. La seule chose à corriger, c'est ce que nous avons mal entendu : les noms et les lieux sont les suspects habituels.",
10761076
"profile.voice.fill_profile": "Remplir mon profil",
10771077
"profile.voice.error.permission": "Nous n'avons pas pu accéder à votre microphone. Autorisez l'accès au microphone dans votre navigateur, puis réessayez.",
1078+
"profile.voice.error.permission_app": "Nous n'avons pas pu accéder à votre microphone. Autorisez la permission Microphone pour Compass dans les réglages de votre appareil, puis réessayez.",
10781079
"profile.voice.error.unsupported": "Votre navigateur ne prend pas en charge l'enregistrement vocal. Essayez plutôt l'option lien ou texte.",
10791080
"profile.voice.error.failed": "L'enregistrement a échoué. Veuillez réessayer.",
10801081
"profile.voice.error.transcription": "Nous n'avons pas pu transcrire votre enregistrement. Il est toujours là — réessayez, ou remplissez votre profil manuellement.",

web/components/voice-autofill-section.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
savePendingRecording,
2121
savePendingTranscript,
2222
} from 'web/lib/util/recording-store'
23+
import {isAndroidApp} from 'web/lib/util/webview'
2324

2425
function formatTime(totalSeconds: number) {
2526
const minutes = Math.floor(totalSeconds / 60)
@@ -119,10 +120,17 @@ export function VoiceAutofillSection(props: {
119120

120121
const errorMessage =
121122
recorder.error === 'permission'
122-
? t(
123-
'profile.voice.error.permission',
124-
'We could not access your microphone. Allow microphone access in your browser, then try again.',
125-
)
123+
? // In the Android app there is no browser to change a setting in: the prompt is Android's, and
124+
// once denied it can only be undone from the app's own permission screen.
125+
isAndroidApp()
126+
? t(
127+
'profile.voice.error.permission_app',
128+
'We could not access your microphone. Allow the Microphone permission for Compass in your device settings, then try again.',
129+
)
130+
: t(
131+
'profile.voice.error.permission',
132+
'We could not access your microphone. Allow microphone access in your browser, then try again.',
133+
)
126134
: recorder.error === 'unsupported'
127135
? t(
128136
'profile.voice.error.unsupported',

0 commit comments

Comments
 (0)