-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Backup/restore (WIP) #311
Backup/restore (WIP) #311
Conversation
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Fixed
Show fixed
Hide fixed
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Fixed
Show fixed
Hide fixed
private static final String CACHE_FOLDER = "cache/"; | ||
private static final String PREF_VALUE = "value"; | ||
private static final String PREF_TYPE = "type"; | ||
private static final String EMPTY = ".empty"; |
Check warning
Code scanning / Pmd (reported by Codacy)
Fields should be declared at the top of the class, before any method declarations, constructors, initializers or inner classes. Warning
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()) { |
Check notice
Code scanning / Pmd (reported by Codacy)
Switch statements should be exhaustive, add a default case (or missing enum branches) Note
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
897f80a
to
7453b3f
Compare
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
First I should mention that I haven't looked at the code so I can give proper feedback as a user and not a dev. I have tested all 3 versions and it didn't work on my phone. When doing the backup it shows a toast "Can't create backup", however it doesn't explain why, leaving me totally clueless on the reason on why it can't. I looked in the android settings of the app and it has the same permissions as the release version (full network access), nothing about storage. In the version with the broken dialog it just stays at 0% and the dialog can't be closed. The restore button does show me a file explorer to choose files, because I can't create a backup I could only test with the wrong file, I tested a random image from my gallery, it correctly shows a toast "Unable to restore the backup file", although I don't know if this is because it is not a .backup or because it has no permissions to read the file. Deleting through the advanced options seemed to work correctly, I tested reordering modules, disabling them, some options inside the modules, modify some files and the tutorial pops again too. |
That's exactly what I need right now, thanks!
Just need to check the last version, the others have issues or just lack improvements.
:O that's unexpected...but better to detect now than later! Can you remind me which android version do you have?
Exception management is not yet implemented, although it's difficult to do in this case. I'll try to improve it though.
According to android (and tested on a couple devices) you don't need any permission to create a file in the downloads folder. Which is strange...I know
It's expecting a zip file, so that's probably the reason. You can test with any zip (it should just not restore anything) but I'll try to upload a sample zip here so you can test. I'll also try to improve the error messages here too.
Well, at least something is working. But the delete option does not imply zips at all so...that's probably the reason. |
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
OK, so, you do need the permission for some specific android version (between 6.0 and 11). |
Not so weird, I think Firefox Desktop does the same with addons, but I might be wrong, I know I have seen this behaviour somewhere, in fact I was suspecting this was the case here too, still I wanted to check.
Yeah, about that... I have been stuck with a Huawei phone (kind of ironic considering I joined this project mainly because of privacy with the ClearURLs module) since I broke my last phone, and this one is from the "bad batch", when Huawei was banned from using google services, which translates to "a lot of broken stuff because missing libraries", maybe it's because of that? Although, looking at the error it doesn't seem that way. In any case, android 10, EMUI 10.1.0.
Check this out, coincidentally the GitHub download link for the testing APK is... a .zip file! So of course I had to test it with the app itself, I honestly find it very funny. Jokes aside, it says "Backup restored", and obviusly doesn't restore anything.
Still it doesn't work.
|
No, I don't think so. Maybe, but it would be strange. I'll test with an android 10 emulator.
Oh, right! At least we can confirm that the app can read zips, so that's something.
Oh :( |
progress dialogs fix cache reload
f7900b8
to
66438b6
Compare
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
app/src/main/java/com/trianguloy/urlchecker/activities/TutorialActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/activities/TutorialActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/activities/SettingsActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/activities/SettingsActivity.java
Dismissed
Show dismissed
Hide dismissed
Good and bad news. I think I fixed the permission issue, turns out there is an official Android way to ask the user to create a file, and it can be created anywhere (it even asks to confirm if it exists!). I started adding the code for those older versions, but it was becoming a hassle and even failing in some situations. So instead, I decided to increase the minSdk and remove support for those older versions. I don't like it, I feel that older devices are still capable of running most apps and if they can't it's just because developers don't spend a bit of time trying to support both. In this case however the burden of supporting the previous version is too much for me. |
It works now! And without requiring any extra permissions, great.
I am sorry to hear that, but at least it wasn't a big jump. |
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
ask before restoring file changed file extension and registered the app with it (may not always work, blame android) advanced options are restored on reload tweaked strings
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
This PR builds correctly, here is the generated apk.
You must be logged in for the link to work. This is an automatic comment created by a Github Action |
app/src/main/java/com/trianguloy/urlchecker/activities/BackupActivity.java
Dismissed
Show dismissed
Hide dismissed
app/src/main/java/com/trianguloy/urlchecker/modules/companions/VersionManager.java
Dismissed
Show dismissed
Hide dismissed
With these, all the minimal required things I can think of are fulfilled, so unless a bug is discovered I'll merge this on the following days. There are some things and improvements I would like to add, but to avoid postponing this update even more I'll release this and improve later. Thanks for all of you that helped with testing! |
I tried it yesterday and it worked as intended. I have already uninstalled it, but I have one question on the behaviour. If I want to backup ClearURLs custom rules, would I need to toggle the cache files? |
No, it is considered user data. ClearUrls setting has both "official" and custom rules on the same object (the idea was for the user to be able to edit the rules themselves). I could have added logic to know if the official subobject was modified or not, but to keep things simple for now I just considered it user data. This means that the backup does contains some redundant data, but as I said I wanted to keep things simple for now. Currently, the only thing considered cache is the hosts database (the one you need to press "build" to generate, not the settings) which internally is not editable by the user. This consists on pretty big files, that's why I added a toggle for them. Btw, if you need to check what is being saved, just open it! The backup is a zip! |
Even though it's still a work in progress, and things may (and probably will) change, I'm creating this PR for people to try it if you want (check the automatic bot reply).
Any comment will be greatly appreciated!
This will close #175