Fix sharing to the app

It's super hacky, but since I broke it, I just want to first fix it, and
later I'll try to make it nicer.
This commit is contained in:
Vishesh Handa
2020-11-10 18:24:43 +01:00
parent 3aaa397021
commit e873f1f4e2
2 changed files with 12 additions and 4 deletions

View File

@ -297,10 +297,12 @@ class _JournalAppState extends State<JournalApp> {
debugShowCheckedModeBanner: false,
//debugShowMaterialGrid: true,
onGenerateRoute: (rs) {
var r = router.generateRoute(
rs, stateContainer, _sharedText, _sharedImages);
_sharedText = null;
_sharedImages = null;
var r = router
.generateRoute(rs, stateContainer, _sharedText, _sharedImages, () {
_sharedText = null;
_sharedImages = null;
});
return r;
},
);

View File

@ -42,6 +42,7 @@ class AppRouter {
Repository repository,
String sharedText,
List<String> sharedImages,
Function callbackIfUsedShared,
) {
var route = routeSettings.name;
if (route == '/folders' || route == '/tags' || route == '/filesystem') {
@ -53,6 +54,7 @@ class AppRouter {
settings,
sharedText,
sharedImages,
callbackIfUsedShared,
),
transitionsBuilder: (_, anim, __, child) {
return FadeTransition(opacity: anim, child: child);
@ -68,6 +70,7 @@ class AppRouter {
settings,
sharedText,
sharedImages,
callbackIfUsedShared,
),
);
}
@ -78,6 +81,7 @@ class AppRouter {
Settings settings,
String sharedText,
List<String> sharedImages,
Function callbackIfUsedShared,
) {
switch (route) {
case '/':
@ -126,6 +130,8 @@ class AppRouter {
});
}
callbackIfUsedShared();
var folder = getFolderForEditor(settings, rootFolder, et);
return NoteEditor.newNote(
folder,