Skip to content

Commit

Permalink
lets see diff
Browse files Browse the repository at this point in the history
  • Loading branch information
seesharpguy committed Nov 8, 2024
1 parent c144b71 commit d4ac6ed
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 39 deletions.
7 changes: 0 additions & 7 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>


<!-- Speech Recognition -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>

<application
android:usesCleartextTraffic="true"
/>
Expand Down
43 changes: 19 additions & 24 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,7 @@
</intent-filter>
</activity-alias>
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility?hl=en and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.

In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
<package android:name="com.google.android.apps.healthdata" />
<intent>
<action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
</intent>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>

<!-- Add more queries as needed -->
</queries>
<uses-permission android:name="android.permission.INTERNET"/>

<!-- Speech Recognition -->
Expand Down Expand Up @@ -117,12 +98,26 @@
<uses-permission android:name="android.permission.health.WRITE_EXERCISE"/>
<uses-permission android:name="android.permission.health.WRITE_HEIGHT"/>
<uses-permission android:name="android.permission.health.WRITE_NUTRITION"/>

<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility?hl=en and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
<package android:name="com.google.android.apps.healthdata" />
<intent>
<action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
</intent>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>






<!-- Add more queries as needed -->
</queries>

</manifest>
22 changes: 14 additions & 8 deletions lib/app/modules/diary/controllers/diary_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class DiaryController extends GetxController {
if (isTTSAvailable.value) {
locales.value = await speech.locales();
systemLocale.value = await speech.systemLocale();
currentLocaleId.value = systemLocale.value?.localeId ?? 'en_US';
currentLocaleId.value = systemLocale.value?.localeId ?? '';
}
} catch (e) {
logger.e('Error initializing speech: $e');
Expand All @@ -147,18 +147,24 @@ class DiaryController extends GetxController {
isListening.value = true;
update(); // Force UI update

// await speech.listen(
// onResult: _onSpeechResult,
// listenOptions: SpeechListenOptions(partialResults: true),
// localeId: currentLocaleId.value,
// );

await speech.listen(
onResult: _onSpeechResult,
onResult: (rs) {
logger.i(rs);
},
listenFor: Duration(seconds: 15),
pauseFor: Duration(seconds: 15),
listenOptions: SpeechListenOptions(
listenMode: ListenMode.dictation,
onDevice: false,
partialResults: true,
cancelOnError: true,
autoPunctuation: true,
enableHapticFeedback: true,
onDevice: true,
listenMode: ListenMode.deviceDefault,
),
localeId: currentLocaleId.value,
listenFor: const Duration(seconds: 30),
);

// Update status to true
Expand Down

0 comments on commit d4ac6ed

Please sign in to comment.