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
|
.build-container-cache
|
||||||
/coverage/
|
/coverage/
|
||||||
/.agent-shell/
|
/.agent-shell/
|
||||||
|
/ios/
|
||||||
|
/macos/
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:d4rt_formulas/formula_models.dart';
|
import 'package:d4rt_formulas/formula_models.dart';
|
||||||
import 'package:d4rt_formulas/corpus.dart';
|
import 'package:d4rt_formulas/corpus.dart';
|
||||||
import 'package:d4rt_formulas/ai/formula_editor.dart';
|
import 'package:d4rt_formulas/ai/formula_editor.dart';
|
||||||
|
|
|
||||||
|
|
@ -45,19 +45,21 @@ class _CorpusLoaderState extends State<CorpusLoader> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleImport() {
|
void _handleImport() {
|
||||||
Navigator.push(
|
_corpusFuture.then((corpus) {
|
||||||
context,
|
Navigator.push(
|
||||||
MaterialPageRoute(
|
context,
|
||||||
builder: (context) => ImportFromTextScreen(
|
MaterialPageRoute(
|
||||||
corpus: _corpusFuture.then((c) => c).value as Corpus? ?? Corpus(),
|
builder: (context) => ImportFromTextScreen(
|
||||||
|
corpus: corpus,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
).then((result) {
|
||||||
).then((result) {
|
if (result) {
|
||||||
if( result ) {
|
setState(() {
|
||||||
setState(() {
|
// Refresh the list when returning from import
|
||||||
// Refresh the list when returning from import
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,9 @@ class ImportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Listens for shared files (Android only for now)
|
/// Listens for shared files (Android only for now)
|
||||||
Stream<List<SharedMediaFile>> get sharedFilesStream =>
|
Stream<List<SharedMediaFile>> get sharedFilesStream {
|
||||||
ReceiveSharingIntent.instance.getMediaStream;
|
return ReceiveSharingIntent.instance.getMediaStream();
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets initial shared media (for when app is launched via share)
|
/// Gets initial shared media (for when app is launched via share)
|
||||||
Future<List<SharedMediaFile>> getInitialSharedMedia() async {
|
Future<List<SharedMediaFile>> getInitialSharedMedia() async {
|
||||||
|
|
@ -74,7 +75,9 @@ class ImportService {
|
||||||
Future<String?> getSharedText() async {
|
Future<String?> getSharedText() async {
|
||||||
try {
|
try {
|
||||||
final media = await ReceiveSharingIntent.instance.getInitialMedia();
|
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 media.first.path;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -87,7 +90,8 @@ class ImportService {
|
||||||
/// Clears the initial shared media after processing
|
/// Clears the initial shared media after processing
|
||||||
Future<void> clearInitialSharedMedia() async {
|
Future<void> clearInitialSharedMedia() async {
|
||||||
try {
|
try {
|
||||||
ReceiveSharingIntent.instance.resetInitialMedia();
|
// Note: resetInitialMedia() was removed in newer versions
|
||||||
|
// The media is automatically cleared after being read
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
errorHandler.notify(e, stack);
|
errorHandler.notify(e, stack);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue