Conversation
|
Feature requested in #145 |
|
@bgregos continuing from issue...
Yeah the simple answer to handling completed and deleted is just to remove the pending task and naively append to the relevant Regarding taskwarrior's file format, it may not be valid JSON but it's definitely a close cousin! I'm also noticing that I hear you on reasons to ditch SharedPreferences entirely. Judging by your comments in the code and README it sounds like you intended to do this at some point anyway. It also looks like you intended to move to a Room database though. You're ok not going that route? |
|
Serializing to JSON and sticking it in SharedPreferences is a shortcut I took earlier in development and I've always wanted to change it. Going with a file-based implementation instead of Room is fine, no sense in having both a file based implementation and a Room one since our datasets are small. |
|
You can remove the comments about the Room implementation so we don't confuse future contributors 🙂 |
|
Alright, I've been able to do a little digging on this one. So the taskwarrior backend files are json-like text files, but are not json. However, there IS a defined json standard for importing and exporting tasks - https://github.com/GothenburgBitFactory/taskwarrior/blob/develop/docs/rfcs/task.md There is also some pretty great 3rd party app documentation, which actually states that the standard for integrating 3rd party apps should be to SO, this is helpful direction. My proposed path forward is to align the json format that Foreground uses to match Taskwarrior's json format. This should allow us to retain current functionality with actually minimal modifications! Then, for those who want to to connect Foreground with their desktop TW through SyncThing, we just have to write two taskwarrior hook scripts, This would still necessitate the changes to the file storage mechanism. |
|
Hi @shfattig, thanks for working on this issue, it means a lot to me.
Thanks for sharing this, https://github.com/GothenburgBitFactory/taskwarrior/blob/develop/doc/devel/rfcs/task.md is the new link for record.
Great findings, so we should comply with these guidelines indeed and just ensure interoperability between Foreground and Taskwarrior's exported format instead.
Well ... My hook attempt
So did I, but I ended up with an endless loop. I guess you could build a complex This is terrible and slows Taskwarrior down, imho. Also it is only half of the story, because now Foreground need to two way sync our own format. I'm against hooksInstead of listening to export $TASK_DATA_HOME="$HOME/sync/taskwarrior" # can also be referenced in .taskrc on data.location
task() { command task import >/dev/null 2>&1 < "$TASK_DATA_HOME/tasks.json" && command task "$@" && command task export > "$TASK_DATA_HOME/tasks.json"; }This seems to work, I now have a consistent file at This is just part of the storyForeground's synchronization with such a file needs to be deeply integrated. On any active or passive change, the file needs to be taken into consideration:
Conflict resolutionIs not required as conflict resolution will be handled by Syncthing. It's not a smart one, though, the user will end up with two files. It's not worth to invest into this section further, as Syncthing is just one of many synchronization solutions. If the user decides to sync with the local Android file system, he/she needs to be aware that Foreground cannot handle conflicts, this work is shifted to the synchronization software. Personal noteI'd love to hear from you. Did you happen to have some time to work on the app to synchronize using Taskwarriors JSON export format? Thanks for working on this. |
|
Hey @martin-braun ! Thanks for your message! I'm glad you've started some work on this! I haven't made much more progress since my previous research, but I might be getting some time to invest back into it! I ran into the same loop issue you have with the hooks. A fix would be to set a flag that checks whether you're already running the hook, something like this: #!/bin/bash
json_file=/SyncThing/path/to/json/json_data.json
if [[ -f $json_file ]]; then
if [[ -z $_reading_json ]]; then
export _reading_json=true
task import $json_file
fi
unset $_reading_json
fiI can put that up in this pull request With regard to SyncThing, I think we will have to assume that changes are made on each node w/ significant time separation. SyncThing isn't really built to handle concurrent changes and conflicts. But if there are better realtime synchronization mechanisms I'd be glad to hear! |
|
@shfattig Thanks for sharing the hook solution. After all though, it made sense for me to stick to my method, because I have to use this method for I agree on your stance about Syncthing, that's exactly my conclusion as well. Still I want to emphasize that pulling of file changes on Android's size should happen when the app comes into foreground and not just when it's started, in case it wasn't clear.
No pressure my friend, just to mind, there is nothing similar available as of now. I guess I can edit my I also looked around maybe finding a JSON GUI editor for Android to make it more pleasing to work with that file, but there is nothing on the FOSS side and on top of that, Taskwarrior's JSON format has some additional rules that might not be followed by other apps. |
I do agree, the app should refresh on opening, coming into foreground, and likely every few minutes while it's open. I don't know the API for that as I'm very new to mobile development, but I'm certain it exists!
Indeed. Foreground is one of a kind! |
|
@shfattig As of now, the need for it is not strong enough to devot any time for it on my end (yet), since I have to focus on things that pay the bills with dead lines keeping the pressure up. Over time the priority shall rise though. I have experience in Android development to a point that I would feel confident to add a feature to an existing app, however I don't think I can deliver a state-of-the-art implementation, especially since I have no experience with Kotlin so far (which isn't a dealbreaker tbh). |
|
If anyone working on this has questions, feel free to give me a ping. I'm
happy to walk you through the app structure, Kotlin, or anything else.
…On Sat, Aug 26, 2023, 10:11 AM Martin Braun ***@***.***> wrote:
@shfattig <https://github.com/shfattig> As of now, the need for it is not
strong enough to devot any time for it on my end (yet), since I have to
focus on things that pay the bills with dead lines keeping the pressure up.
Over time the priority shall rise though. I have experience in Android
development to a point that I would feel confident to add a feature to an
existing app, however I don't think I can deliver a state-of-the-art
implementation, especially since I have not experience with Kotlin so far
(which isn't a dealbreaker tbh).
—
Reply to this email directly, view it on GitHub
<#157 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABM2MFIY7BMYNUPC6CQN32LXXH7XVANCNFSM6AAAAAAWHWEYF4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Enabling direct manipulation of taskwarrior
.datafiles and external file R/W permissions to other apps so that third-party file sync services (i.e. Syncthing) can provide two-way synchronization of tasks, in lieu of a taskserver