Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local folder(s) #35

Closed
alensiljak opened this issue Mar 10, 2021 · 12 comments
Closed

Use local folder(s) #35

alensiljak opened this issue Mar 10, 2021 · 12 comments
Labels
enhancement New feature or request

Comments

@alensiljak
Copy link

alensiljak commented Mar 10, 2021

Let me extract this proposal from #5, to allow some focus.

Preface: As I mentioned in a comment there, Flutter has an option (at least on Android) to request permissions for a folder on external storage. This provides access to the whole tree below the selected location.

Proposal: Allow opening a folder location on the device and reading all the files in there.

  • option to select a local folder
  • display the tree structure for the sub-folders
  • allow opening any .org file from the tree

This relates closely to #34, as it would use direct access to the files, without the content provider, so the files could simply be re-read after they have been edited in an external editor.

It will actually allow any sort of interaction with other applications in the OrgMode ecosystem, as well as having attachments, relative links, images, etc.

@alensiljak
Copy link
Author

alensiljak commented Mar 10, 2021

A reference implementation for folder access can be found in GitJournal.

@alensiljak alensiljak changed the title Use local folders Use local folder(s) Mar 10, 2021
@amake amake added the enhancement New feature or request label Mar 14, 2021
@amake
Copy link
Owner

amake commented May 4, 2021

In v1.18.1 Orgro uses directory permissions to resolve relative file links between Org Mode documents.

If there is more or different functionality desired, please provide more detail. But note that I don't intend to implement a directory view.

@alensiljak
Copy link
Author

Thank you.
There are some issues providing access and following the file links on Android 10.
I've added org_flutter to GitJournal and will focus more on the functionality and the improvements in the library. It seems to fit better my current use case with a couple of mini wiki-style notes folders.

@amake
Copy link
Owner

amake commented May 6, 2021

There are some issues providing access and following the file links on Android 10.

Could you be more specific?

@alensiljak
Copy link
Author

There are some issues providing access and following the file links on Android 10.

Could you be more specific?

Sure. The Grant Access buttons (on top and when tapping the actual link) don't seem to do anything.
Tapping the link to an image reports that there is no app which handles the file type.

@amake
Copy link
Owner

amake commented May 6, 2021

don't seem to do anything

Doesn't seem to do "anything"? Does it bring up a directory chooser? What directory did you choose? Where are the root file and the target file relative to the directory you chose?

Tapping the link to an image reports that there is no app which handles the file type.

Images are displayed inline if they can be accessed. Otherwise it's up to the system to know how to handle such a link, but generally the system will not know how to handle a relative link like that. So this is to be expected if you haven't successfully granted access.

@amake
Copy link
Owner

amake commented May 6, 2021

I've added org_flutter to GitJournal and will focus more on the functionality and the improvements in the library. It seems to fit better my current use case with a couple of mini wiki-style notes folders.

I should note that any amount of work on org_flutter itself can't resolve any of the issues you're having, because pure Dart is insufficient for doing so: links and (local) images must be resolved with cooperation from the platform. org_flutter punts on handling these things because they end up intricately tied up with your app's UI, and there is no one-size-fits-all solution.

So to get links and images working you will need to reimplement a lot of the plumbing I have in Orgro inside your own app.

@alensiljak
Copy link
Author

So to get links and images working you will need to reimplement a lot of the plumbing I have in Orgro inside your own app.

I get that. Fortunately, these things (links, backlinks, images, etc.) are already taken care of for Markdown so I can borrow them for Org files.
Once I have some time, I will send some ideas or pull requests. I.e. the checkbokes could render the Unicode characters like ☑.

@amake
Copy link
Owner

amake commented May 6, 2021

I get that. Fortunately, these things (links, backlinks, images, etc.) are already taken care of for Markdown so I can borrow them for Org files.

Nice. I just tested it out in Git Journal and I see that your use case is much simpler: you have direct access to all of the files since you own them by virtue of cloning them into your app's private space.

All of the complexity in Orgro is due to trying to work with files that it doesn't own; in particular the Storage Access Framework on Android is extremely limiting.

@alensiljak
Copy link
Author

alensiljak commented May 6, 2021

That is true (I actually hate going back to native development but hey). However, there is also an option to use external storage. That way I can set the storage to be on my "Internal Storage/notes", which is synchronized using rclone. So, completely outside the private app space. It does require a permission (actually, I've fixed that recently for Android) but works well. If you're interested, check that scenario out. You are more fluent with Dart and Flutter, anyway.

@amake
Copy link
Owner

amake commented May 6, 2021

It does require a permission (actually, I've fixed that recently for Android) but works well. If you're interested, check that scenario out.

Are you talking about GitJournal/GitJournal#448? If so, that solution will not work long-term because you will be forced to target API 30 in September 2021 at which point requestLegacyExternalStorage="true" will no longer work.

If that's not what you're talking about then I'm curious how you did it.

(Also I should point out that this use case is still quite simple since you're guaranteed that all files are located and linked within a directory tree that you have access to. Orgro can't have that guarantee unless it requires you to grant access to the root of the storage tree, which I didn't want to do.)

@alensiljak
Copy link
Author

Are you talking about GitJournal/GitJournal#448? If so, that solution will not work long-term because you will be forced to target API 30 in September 2021 at which point requestLegacyExternalStorage="true" will no longer work.

Possibly. Do note that it is May 2021 and the solution above works. When it stops, it will be adjusted to whatever the possible solution is at the time.
My phone is on LineageOS 17.1 and will stay that way for the foreseeable future. So I'm sure the solution above will continue to work for a fairly long time, too. At least, it will for me.

(Also I should point out that this use case is still quite simple since you're guaranteed that all files are located and linked within a directory tree that you have access to. Orgro can't have that guarantee unless it requires you to grant access to the root of the storage tree, which I didn't want to do.)

I would beg to disagree. The use case is identical. My files have been accumulated over the years and are not tied to GitJournal or Orgro. Whichever software adapts to the notes and the way they are linked (because the notes are where the real value lies for me) will be the one I end up using and contributing to. At least that's my view of the situation.

amake added a commit that referenced this issue Oct 28, 2022
```
══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
Layer OffsetEngineLayer was previously used as oldLayer.
Once a layer is used as oldLayer, it may not be used again. Instead, after calling one of the
SceneBuilder.push* methods and passing an oldLayer to it, use the layer returned by the method as
oldLayer in subsequent frames.
'dart:ui/compositing.dart':
Failed assertion: line 110 pos 9: '<optimized out>'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack:
#2      _EngineLayerWrapper._debugCheckNotUsedAsOldLayer (dart:ui/compositing.dart:110:9)
#3      SceneBuilder.addRetained.<anonymous closure>.recursivelyCheckChildrenUsedOnce (dart:ui/compositing.dart:695:21)
#4      List.forEach (dart:core-patch/growable_array.dart:416:8)
#5      SceneBuilder.addRetained.<anonymous closure>.recursivelyCheckChildrenUsedOnce (dart:ui/compositing.dart:701:18)
#6      SceneBuilder.addRetained.<anonymous closure> (dart:ui/compositing.dart:704:7)
#7      SceneBuilder.addRetained (dart:ui/compositing.dart:707:6)
#8      Layer._addToSceneWithRetainedRendering (package:flutter/src/rendering/layer.dart:671:15)
#9      ContainerLayer.addChildrenToScene (package:flutter/src/rendering/layer.dart:1284:13)
#10     OffsetLayer.addToScene (package:flutter/src/rendering/layer.dart:1421:5)
#11     Layer._addToSceneWithRetainedRendering (package:flutter/src/rendering/layer.dart:674:5)
#12     ContainerLayer.addChildrenToScene (package:flutter/src/rendering/layer.dart:1284:13)
#13     ClipRectLayer.addToScene (package:flutter/src/rendering/layer.dart:1590:5)
#14     Layer._addToSceneWithRetainedRendering (package:flutter/src/rendering/layer.dart:674:5)
#15     ContainerLayer.addChildrenToScene (package:flutter/src/rendering/layer.dart:1284:13)
#16     OffsetLayer.addToScene (package:flutter/src/rendering/layer.dart:1421:5)
#17     Layer._addToSceneWithRetainedRendering (package:flutter/src/rendering/layer.dart:674:5)
#18     ContainerLayer.addChildrenToScene (package:flutter/src/rendering/layer.dart:1284:13)
#19     OffsetLayer.addToScene (package:flutter/src/rendering/layer.dart:1421:5)
#20     Layer._addToSceneWithRetainedRendering (package:flutter/src/rendering/layer.dart:674:5)
#21     ContainerLayer.addChildrenToScene (package:flutter/src/rendering/layer.dart:1284:13)
#22     OffsetLayer.addToScene (package:flutter/src/rendering/layer.dart:1421:5)
#23     Layer._addToSceneWithRetainedRendering (package:flutter/src/rendering/layer.dart:674:5)
#24     ContainerLayer.addChildrenToScene (package:flutter/src/rendering/layer.dart:1284:13)
#25     TransformLayer.addToScene (package:flutter/src/rendering/layer.dart:1914:5)
#26     ContainerLayer.buildScene (package:flutter/src/rendering/layer.dart:1097:5)
#27     RenderView.compositeFrame (package:flutter/src/rendering/view.dart:231:37)
#28     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:514:18)
#29     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:869:13)
#30     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:375:5)
#31     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1271:15)
#32     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1200:9)
#33     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1058:5)
#34     _invoke (dart:ui/hooks.dart:145:13)
#35     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:338:5)
#36     _drawFrame (dart:ui/hooks.dart:112:31)
(elided 2 frames from class _AssertionError)
════════════════════════════════════════════════════════════════════════════════════════════════════
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants