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

Add auto backup #23

Closed
TheLastProject opened this issue Oct 24, 2020 · 19 comments
Closed

Add auto backup #23

TheLastProject opened this issue Oct 24, 2020 · 19 comments
Labels
state: help wanted I looked into this issue but couldn't solve it quickly type: enhancement New feature or request

Comments

@TheLastProject
Copy link
Member

Issue by natrius
Friday Apr 27, 2018 at 12:49 GMT
Originally opened as brarcher/loyalty-card-locker#238


Add the option to autobackup after a new card is saved.

@TheLastProject TheLastProject added type: enhancement New feature or request state: help wanted I looked into this issue but couldn't solve it quickly labels Oct 24, 2020
@TheLastProject
Copy link
Member Author

Comment by huste
Sunday Mar 10, 2019 at 19:20 GMT


In addition, I'd like to create the backup in a specific place, so that my nextcloud sync tool finds the export and uploads it to my cloud...

@TheLastProject
Copy link
Member Author

Comment by trymeouteh
Tuesday Sep 17, 2019 at 02:33 GMT


To have auto backup to the cloud or even syncing to the cloud will be handy. If you lose your phone, adding all the cards back into the app can take quite some time to do.

Please add a encrypted auto backup. I would like to suggest using 7z for encryption.

@TheLastProject
Copy link
Member Author

Comment by brarcher
Tuesday Sep 17, 2019 at 05:51 GMT


I'll probably not work on this feature myself. If someone were interested in contributing it I'd be happy to review the pull request.

As a note, this app does not have the network permission. This is intentional. If someone were to add a backup option, it may have to be done via a second app. Maybe a plugin app that receives card updates or the like. The solution would need to involve not adding the network permission to this app.

As for the format of the backup, as another app would handle the data the format is unimportant (and thus 7z is fine). Support for importing 7z data would need to be added to this app. To be consistent it may also be worth while adding support for exporting to 7z (mentioned in brarcher/loyalty-card-locker#285)

@TheLastProject
Copy link
Member Author

Comment by natrius
Tuesday Sep 17, 2019 at 08:30 GMT


No need for network anything. Just add a option like "Auto save when new card is added" and "Choose destination" everything else can be done with nextcloud autoupload for example.

Also, for this feature, there is no encription needed. Just keep the current one and at least let us choose the destination folder, that would be awesome.

@TheLastProject
Copy link
Member Author

Comment by brarcher
Monday Oct 07, 2019 at 06:33 GMT


Recently I added brarcher/loyalty-card-locker#311, which allows a backup manager on the system to backup and restore the app's data. This should allow a use case such as:

If you lose your phone, adding all the cards back into the app can take quite some time to do.

to be taken care of. Do you agree? Given this, is it necessary to have a separate automatic backup mechanism directly in the app?

@TheLastProject
Copy link
Member Author

Comment by huste
Monday Oct 07, 2019 at 16:04 GMT


If somebody can recommend a stable, preferably open source, backup solution not requiring root, that creates complete backups locally on the SD card which I can then sync to my nextcloud instance, maybe that's enough.

Then again, an auto-export after editing cards to a prefefined directory, keeping exports from the last say 6 months, could be a nice feature independent of external backup solutions.

EDIT: added the part about not requiring root...

@TheLastProject
Copy link
Member Author

Comment by natrius
Monday Oct 07, 2019 at 19:48 GMT


I would just need an option to choose the backup location, as it now just safes into sd-card root (i think). ideall an autobackup after a new card is added.

I was asking this because i'm not using any backup-solution right now because linageos has none builtin. Titanium is not available for me (and i don't like it that much), but there is oandbackup available in the f-droid store, maybe thats worth a try for you at least @huste

Still, appreciate your effort @brarcher thanks. When something like that is not added, i guess i can't change it on my own :D

@TheLastProject
Copy link
Member Author

Comment by huste
Tuesday Oct 08, 2019 at 19:59 GMT


@natrius: No, oandbackup is nothing fo me, my device is not rootable.

@TheLastProject
Copy link
Member Author

Comment by natrius
Wednesday Oct 09, 2019 at 07:40 GMT


Oh, missed that, i'm sorry. I'm not aware of such an possibility.

Seems like you have to:

  1. Open the app
  2. press the backup button
  3. close the app
  4. open the filebrowser
  5. move the file to the autoupload folder from nextcloud manually
  6. let nextcloud autoupload the file

Thats the way i'm doing it right now, because unfortunately its not possible to choose the backup locatio :(

@TheLastProject
Copy link
Member Author

Comment by huste
Wednesday Oct 09, 2019 at 11:48 GMT


@natrius: yes, that's what I do right now If I don't forget. So the simplest solution would be to reqeust external write permission and if granted an option for auto-save after editing. I vote for keeping this issue open.

@TheLastProject
Copy link
Member Author

Comment by natrius
Thursday Oct 10, 2019 at 11:18 GMT


@brarcher

Could you change the default-safe folder from sd-card root to a "backup_loyaltycard" subfolder at least? This would be the easiest solution for now, because we could set up autoupload for this folder and from then on just press "Backup" in the app itself, if the other changes are to difficult to make.

@trymeouteh
Copy link

Please add auto backups which will be done after add, editing or deleting a card into an encrypted backup folder. I would recommend using something like 7z or gz which are archived file types that support password protection.

@TheLastProject
Copy link
Member Author

TheLastProject commented Nov 5, 2020

I wonder if we should maybe just... change everything up in general. Like, do it more WhatsApp style:

  1. Automatically make a local backup (SD Card -> Catima -> Catima.csv)
  2. When starting the app with no cards and groups, offer to import this automatic backup
  3. Allow the user to disable the automatic backup

That way, if people change phones but keep their SD card or uninstall the app or something they won't lose everything. And more advanced users could already add this directory to their Nextcloud/Dropbox sync directories or something.

I am wondering if we want to offer changing the automatic backup location because if the user does change it we can't detect the file for automatic importing either...

Edit: Of course, we're keeping the manual backup and import options too. But I'm thinking of automatic backup by default.

@natrius
Copy link

natrius commented Nov 5, 2020

My take on that, on startup:

    1. let the user decide if he wants to backup at all (if no: abort, if yes: ii)
    1. let the user choose the location of the backup (but set default-location)
    1. detect if backup is at the chosen location (if no: step v, if yes: step iv )
    1. ask if the found backup should be imported
    1. let the user choose how often it should be backupped (every opening of the app, after adding a new card, after changing a card) or fix it with "after changing a card" because that would basically cover the new card and everything is safed) and probably less hassle to program

Not a lot to change when activating after the initial launch, i guess.

EDIT:

Or on initial startup just check the default-folder instantly and ask if the found file should be imported. When no (and when no backup is found on default), the above, when yes, ignore 3 and 4 and proceed. Probably the better way for initial startup?

@trymeouteh
Copy link

As long as the backup can be done when an card is added, edited or deleted I am happy. That way I can use Syncthing to make a copy of the backup on another device.

@TheLastProject
Copy link
Member Author

This is partially possible already as I understand it. Because Catima does not opt out of Android's backup framework, using Seedvault should also backup Catima's data

@trymeouteh
Copy link

All that is needed to implement this is the following settings,

  • Choose Directory to store automatic backups (The directory to store automatic backups)
  • Automatic Backup Password (The password that it will set on the ZIP backup)
  • Enable Automatic Backups (Toggle switch on weather to have automatic backups)

Automatic backups will occur when you edit a card, delete a card, or create a new card.

For those who like to buy many gift cards with crypto from Bitrefill and Coincards, this automatic backup will ensure no loss of data when one uses Syncthing alongside with automatic backups enabled.

@TheLastProject
Copy link
Member Author

I am pretty sure it is not that simple because Android apps aren't supposed to just write to storage anymore.

In fact we may need MANAGE_STORAGE permission to do this which may get us rejected from Google Play. See https://developer.android.com/training/data-storage/manage-all-files#all-files-access-google-play.

So that would require multiple app flavors, one for F-Droid that has this feature and one for Google Play that doesn't.

So that is going down a road of absolute hell that I do not want to go down.

We are likely better off seeing if something like Nextcloud lets us include a library or intent or something to ask it to save some data.

So no, this is not easy at all. Patches welcome from whoever wants to spend time figuring this out, which isn't me because I don't need this feature myself and I want to focus on features I would use myself.

@TheLastProject
Copy link
Member Author

I am closing this.

Catima already opts into Android's backup framework for backups, so auto-backup exist. And Google is making auto exporting to a public file increasingly difficult.

For multi-device, #791 is a much better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: help wanted I looked into this issue but couldn't solve it quickly type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants