code is not full height, imported is not added to database
This commit is contained in:
parent
9b470041f5
commit
d2bdf4a157
4 changed files with 25 additions and 16 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -19,3 +19,5 @@
|
|||
.build-container-cache
|
||||
/coverage/
|
||||
/.agent-shell/
|
||||
/ios/
|
||||
/macos/
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -45,11 +45,12 @@ class _CorpusLoaderState extends State<CorpusLoader> {
|
|||
}
|
||||
|
||||
void _handleImport() {
|
||||
_corpusFuture.then((corpus) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ImportFromTextScreen(
|
||||
corpus: _corpusFuture.then((c) => c).value as Corpus? ?? Corpus(),
|
||||
corpus: corpus,
|
||||
),
|
||||
),
|
||||
).then((result) {
|
||||
|
|
@ -59,6 +60,7 @@ class _CorpusLoaderState extends State<CorpusLoader> {
|
|||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -57,8 +57,9 @@ class ImportService {
|
|||
}
|
||||
|
||||
/// Listens for shared files (Android only for now)
|
||||
Stream<List<SharedMediaFile>> get sharedFilesStream =>
|
||||
ReceiveSharingIntent.instance.getMediaStream;
|
||||
Stream<List<SharedMediaFile>> get sharedFilesStream {
|
||||
return ReceiveSharingIntent.instance.getMediaStream();
|
||||
}
|
||||
|
||||
/// Gets initial shared media (for when app is launched via share)
|
||||
Future<List<SharedMediaFile>> getInitialSharedMedia() async {
|
||||
|
|
@ -74,7 +75,9 @@ class ImportService {
|
|||
Future<String?> 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<void> 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue