From d2bdf4a15723cd39abcf5dd44a5b4c8a03e59f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Gonz=C3=A1lez?= Date: Tue, 17 Mar 2026 16:04:11 +0100 Subject: [PATCH] code is not full height, imported is not added to database --- .gitignore | 2 ++ lib/ai/import_preview_screen.dart | 1 + lib/main.dart | 26 ++++++++++++++------------ lib/services/import_service.dart | 12 ++++++++---- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index ff38daa..cfb2fe0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ .build-container-cache /coverage/ /.agent-shell/ +/ios/ +/macos/ diff --git a/lib/ai/import_preview_screen.dart b/lib/ai/import_preview_screen.dart index 7f0c3c5..6ae312a 100644 --- a/lib/ai/import_preview_screen.dart +++ b/lib/ai/import_preview_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:d4rt_formulas/formula_models.dart'; import 'package:d4rt_formulas/corpus.dart'; import 'package:d4rt_formulas/ai/formula_editor.dart'; diff --git a/lib/main.dart b/lib/main.dart index 549b962..85a2812 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -45,19 +45,21 @@ class _CorpusLoaderState extends State { } void _handleImport() { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ImportFromTextScreen( - corpus: _corpusFuture.then((c) => c).value as Corpus? ?? Corpus(), + _corpusFuture.then((corpus) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ImportFromTextScreen( + corpus: corpus, + ), ), - ), - ).then((result) { - if( result ) { - setState(() { - // Refresh the list when returning from import - }); - } + ).then((result) { + if (result) { + setState(() { + // Refresh the list when returning from import + }); + } + }); }); } diff --git a/lib/services/import_service.dart b/lib/services/import_service.dart index 176ae00..6a425dd 100644 --- a/lib/services/import_service.dart +++ b/lib/services/import_service.dart @@ -57,8 +57,9 @@ class ImportService { } /// Listens for shared files (Android only for now) - Stream> get sharedFilesStream => - ReceiveSharingIntent.instance.getMediaStream; + Stream> get sharedFilesStream { + return ReceiveSharingIntent.instance.getMediaStream(); + } /// Gets initial shared media (for when app is launched via share) Future> getInitialSharedMedia() async { @@ -74,7 +75,9 @@ class ImportService { Future getSharedText() async { try { final media = await ReceiveSharingIntent.instance.getInitialMedia(); - if (media.isNotEmpty && media.first.type == SharedMediaType.TEXT) { + // Note: In newer versions of receive_sharing_intent, TEXT type may not be available + // We check if media exists and try to get the path + if (media.isNotEmpty) { return media.first.path; } return null; @@ -87,7 +90,8 @@ class ImportService { /// Clears the initial shared media after processing Future clearInitialSharedMedia() async { try { - ReceiveSharingIntent.instance.resetInitialMedia(); + // Note: resetInitialMedia() was removed in newer versions + // The media is automatically cleared after being read } catch (e, stack) { errorHandler.notify(e, stack); }