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

Online Sync feature between devices #913

Open
araujoarthur0 opened this issue Nov 23, 2022 · 11 comments
Open

Online Sync feature between devices #913

araujoarthur0 opened this issue Nov 23, 2022 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@araujoarthur0
Copy link
Collaborator

It would be awesome to have a feature to sync the database from more than one device with TTL installed.
For example, travel with a notebook and load up the data from your home desktop, punch your time, then arrive back home and have the new data synched back to your desktop.
We could do this through some web service integration, like Google Drive, as I have seen some Android Apps do, or Dropbox.

@araujoarthur0 araujoarthur0 added the enhancement New feature or request label Nov 23, 2022
@tupaschoal
Copy link
Collaborator

Would be great, and you mean the user itself would choose his cloud environment to save it, so we wouldn't have to maintain ourselves, right?

@araujoarthur0
Copy link
Collaborator Author

Yes! We could add one service, and open for Hacktoberfest for new services hauahah

@SarahRemus
Copy link
Contributor

I would like to give this a try. I would do some research on how this could be implemented, then propose some ideas to you, and then we could decide how to proceed?
I will try to work with Google Drive first

@araujoarthur0 could you specify the sources where you have seen this feature before?

@araujoarthur0
Copy link
Collaborator Author

That would be awesome 🎉
I've seen this in WhatsApp and Tachiyomi apps, which backup to Google drive.
It probably only needs read/write access to a service and then we always use a same folder. It could possibly be good to encrypt/compress the file to avoid unintentional tampering.

@araujoarthur0
Copy link
Collaborator Author

I think Tachiyomi is open source.

@SarahRemus
Copy link
Contributor

So the basic functionality of uploading data to Google Drive and importing it again is working.
You can see my working branch here if you want to have a look at my code.

To create the credentials for TTL to work with the Google Drive Api these steps have to be followed. For my local development I created these credentials with my Google Account, but for the 'official version' I think it's better if one of the maintainers creates these credentials.

My Question:
At the moment, the name of the file that is imported from Google Drive is hard-coded, as I'm not sure how to get the input for that from the user.
Should I just create a window where the user puts in the file name & path it has in the drive?
I also discovered the Google Picker API that lets you access files on Google Drive, so the user could choose the file he wants to upload.
Or implement text input first and Google Picker in a future PR?

@araujoarthur0
Copy link
Collaborator Author

araujoarthur0 commented Dec 12, 2022

Awesome, thanks Sarah!
We'll ask @thamara to use her credentials later, or maybe we'll work towards a TTL email as well.

I think you can just do it hardcoded for now, and we can enjoy the picker api later. Getting the basics working first.
The file itself will need to have a header/descriptor indicating it's a TTL file, so we can allow any file to be picked so long as we validate it.

Since this is a big feature, and @tupaschoal was considering doing a December release, I created the 'sync' parallel dev branch to 'main'. We can push the changes here piece by piece and later do the merge.

@SarahRemus
Copy link
Contributor

Okay, so I will focus on the main functionality for now and add more functionalities in future PRs.

Working on a dev branch is a great idea, that way I can do PRs for intermediate steps.

What do you mean by header/descriptor? An additional entry in the JSON file?

@araujoarthur0
Copy link
Collaborator Author

What do you mean by header/descriptor? An additional entry in the JSON file?

I'm thinking of some kind of encryption key that uniquely identifies the app and its files. But that can also be for later.
But our json probably needs a schema for validation.

@SarahRemus
Copy link
Contributor

I'm wondering how you @araujoarthur0 handle errors in general? With the API calls to the Google Drive API there are various things that could go wrong, should I display detailed messages to the user? Like the authentication failed, no file with this name exists, etc.?
Should the errors be logged to the console or somewhere else?

@araujoarthur0
Copy link
Collaborator Author

I believe some of them could be useful for the user to see and take action, like authentication issues. For those it's ok to trigger a dialog with the error contents.
If we have a list of possible errors, it'll be good to offer alternative solutions for those that can be fixed.

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

3 participants