-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support opening relative links #5
Comments
I know apps like Syncthing use the new scoped-storage API on android to request access to a whole folder, so that's an option for addressing issue 1, for android at least, I don't know anything about iOS development... |
I would really like this. I heavily rely on links like I'm not sure I understand the URI issue (but I don't know anything about the apparently very complex world of Android permissions). All my org files are in the same directory on the SD card (copied there using rsync through a davfs mount...), and if this is the case (as you suggested by writing |
Right now Orgro can only obtain permissions to individual files. So to access a separate file I would need to make you choose it from a picker. If I can preselect the file that might not be so bad. If I cache the access ID then you'd only have to choose it once. But then you're still choosing each new file. I'm not sure if obtaining permission to a directory would let me access all of its children. It might. But then there is a new concept of "choosing a directory" to somehow include in the UI and make it clear how/why you need to do that. That might require redoing all of the file-opening workflow code. So this ticket is stuck waiting for me to have time to investigate all of this. |
This comment has been minimized.
This comment has been minimized.
Very briefly, I can confirm that Flutter on Android can obtain permissions for a folder on external storage. Just recently I worked on the related code in GitJournal. This allows opening any file within the hierarchy below the selected location. I'd agree that a more-encompassing strategy regarding file-opening would be worthwhile. I'm using Orgro as the viewer for the files edited by Orgzly, located in a local repository (folder). The folder tree is synchronized via rclone or syncthing. Perhaps an option to "add a folder" could simply display all the .org files within? |
For #37 I've hit upon what I consider a plausible UI for requesting document-specific access permissions, so this is partially unblocked. My idea is to detect at open time whether there are relative links, and to compute the common root directory.
Support for #22 falls out of this scheme plus #37. Remaining issuesGetting permissionsI use file_picker_writable to get persistent access to files, but this plugin doesn't allow selecting directories. So I either need to add the functionality to that plugin, or write my own (see hpoul/file_picker_writable#16). Resolving relative pathResolving a relative path against a security-scoped directory URL might not be super hard, but it at least seems like it will require a round-trip to the native layer so it is non-trivial. Handling permissionsDirectory permissions should be persisted so that the user doesn't get asked every time. Given a set of existing permissions and a set of URLs, it might be non-trivial to compute whether we need to ask for additional permissions. Permissions may expire or otherwise become temporarily or permanently unusable (switching users in Google Drive); figuring out how to cull them might be important. Error handling
Rejected ideasI don't want to change the topmost file-picking UI to introduce the concept of directories, or implement some sort of generalized directory tree browser. |
Interesting, since you mentioned you want to stick to the original OrgMode features yet here you reject the most basic one? OrgMode is defacto a file-based, therefore directory-based, system of notes. Why the disconnect? I'm asking because it seems that most of the open issues would be resolved by implementing a folder-based structure. |
I disagree with this premise. Org Mode is buffer-based. Buffers are often backed by files, but don't have to be. Links (relative and otherwise) can point to files, but don't have to. You could have Org Mode function exactly as-is but have all the data come out of a database, or be fetched over the network, or really anything, as long as the links resolve by some mechanism. There is nothing fundamental to Org Mode about either files or directories.
|
I have this implemented locally to some degree, but there are large limitations. Android-specificIt appears to be a fundamental limitation of the Android Storage Access Framework that you can't resolve up the tree from a known content URI. If you open a file Either that, or I have to ask for permission to manage the entire provider document tree. That doesn't seem reasonable, and even then it's not clear that all paths are readily resolvable. While Android is particularly restrictive in this regard, and iOS is less so, by virtue of being a Flutter app I can only reasonably target the least common denominator. So iOS suffers as well. iOS and AndroidVery few content providers implement support for picking a directory (
(Providers that definitely don't support it include Google Drive and Dropbox.) So opening relative links will be limited to supported providers, but I don't know of a way to programmatically determine if a provider supports it, so there will be some annoyances. |
v1.18.0 is now available for testing on Test Flight and Google Play. |
This is implemented in v1.18.1, which is out for all platforms. |
``` ══╡ 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) ════════════════════════════════════════════════════════════════════════════════════════════════════ ```
It would be nice to support opening relative file links like
[[./other_file.org][related text]]
.Issues:
The text was updated successfully, but these errors were encountered: