Offline dictionary (#45)
* Added support for external dictionary apps and a dictionary settings sheet. * Refactored external dictionary integration and improved package visibility - Updated `AndroidManifest.xml` with `<queries>` for common dictionary apps and intent actions (`PROCESS_TEXT`, `SEARCH`, `SEND`) to support Android 11+ package visibility. - Refactored `ExternalDictionaryHelper` to streamline dictionary discovery using `Intent.ACTION_PROCESS_TEXT` and `colordict.intent.action.SEARCH`. - Added a package blocklist in `ExternalDictionaryHelper` to filter out system services (e.g., Samsung Pass, GMS) from dictionary lists. - Simplified `launchDictionary` logic to prioritize `PROCESS_TEXT` intents. - Fixed a bug in `PdfViewerScreen` to only show the dictionary upsell dialog when `useOnlineDictionary` is enabled. * Refactored dictionary settings into a dialog and updated dictionary selection logic. - Renamed `DictionarySettingsSheet` to `DictionarySettingsDialog` and converted it from a bottom sheet to a formal dialog. - Redesigned the dictionary settings UI with a clearer distinction between AI and external app modes. - Added a "Search" option to the external dictionary list that triggers a web search. - Updated `ExternalDictionaryHelper` to include a package blocklist and support for generic web search intents. - Simplified `PdfHelper` by removing Pro user checks for the "Dictionary" action. - Updated icons for dictionary settings across the EPUB and PDF readers.
This commit is contained in:
parent
dff236fa7f
commit
76780bff31
12 changed files with 759 additions and 171 deletions
|
|
@ -227,21 +227,16 @@ suspend fun executeRecapLogic(
|
|||
*/
|
||||
@Composable
|
||||
fun EpubReaderAiOverlays(
|
||||
// Summarization State
|
||||
showSummarizationPopup: Boolean,
|
||||
summarizationResult: SummarizationResult?,
|
||||
isSummarizationLoading: Boolean,
|
||||
onDismissSummarization: () -> Unit,
|
||||
showSummarizationUpsellDialog: Boolean,
|
||||
onDismissSummarizationUpsell: () -> Unit,
|
||||
|
||||
// Recap State
|
||||
showRecapPopup: Boolean,
|
||||
recapResult: SummarizationResult?,
|
||||
isRecapLoading: Boolean,
|
||||
onDismissRecap: () -> Unit,
|
||||
|
||||
// Dictionary State
|
||||
showAiDefinitionPopup: Boolean,
|
||||
selectedTextForAi: String?,
|
||||
aiDefinitionResult: AiDefinitionResult?,
|
||||
|
|
@ -249,10 +244,9 @@ fun EpubReaderAiOverlays(
|
|||
onDismissAiDefinition: () -> Unit,
|
||||
showDictionaryUpsellDialog: Boolean,
|
||||
onDismissDictionaryUpsell: () -> Unit,
|
||||
|
||||
// Navigation
|
||||
onNavigateToPro: () -> Unit,
|
||||
isTtsSessionActive: Boolean
|
||||
isTtsSessionActive: Boolean,
|
||||
onOpenExternalDictionary: (String) -> Unit
|
||||
) {
|
||||
if (showSummarizationPopup) {
|
||||
SummarizationPopup(
|
||||
|
|
@ -298,7 +292,11 @@ fun EpubReaderAiOverlays(
|
|||
result = aiDefinitionResult,
|
||||
isLoading = isAiDefinitionLoading,
|
||||
onDismiss = onDismissAiDefinition,
|
||||
isMainTtsActive = isTtsSessionActive
|
||||
isMainTtsActive = isTtsSessionActive,
|
||||
// Pass it down
|
||||
onOpenExternalDictionary = {
|
||||
selectedTextForAi?.let { text -> onOpenExternalDictionary(text) }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue