Skip to content
New issue

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

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

Already on GitHub? # to your account

Add ability to share backup file via Android native sharing to make it easier to access #829

Merged
merged 5 commits into from
May 25, 2024

Conversation

EmilJunker
Copy link
Contributor

@EmilJunker EmilJunker commented May 25, 2024

This adds the ability to share the database backup file via the native Android sharing widget. This should address the problems people are having to access the backup file, in particular on newer versions of Android.

The implementation is based on the SocialSharing-PhoneGap-Plugin. The plugin is a bit old and no longer maintained, but I tested it on both Android 12 and Android 14, and it appears to work fine. However, to make it work I had to apply some patches to the plugin (with npm-patch). The only way I found to ensure these patches are applied when installing the plugin is this:

  • Run npm install. This installs the plugin in the node_modules folder and applies the patches.
  • Run cordova platform rm android. This temporarily removes the android platform.
  • Run cordova platform add android@12.0.1. This adds the android platform back with the patched plugin.

This PR adds two new buttons in Import/Export settings, one for sharing a database backup and one for sharing a diary csv export. When you press on one of the buttons, it first creates a file in the usual location (Documents folder on Android 12 and below, Waistline app data folder on Android 13 and above). It then opens the native Android sharing widget which allows you to share the file with another app, e.g. send it to yourself via email or upload it into the cloud.

Screenshot_20240525_124535_Waistline Screenshot_20240525_124630_IntentResolver

Closes #828
Closes #798
Closes #745
Closes #744
Closes #742
Closes #553
Closes #658
Closes #430

@davidhealey
Copy link
Owner

Oh wow, very nice!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
2 participants