fix two bugs
First bug is with lots of QR Code readers, they don't respect custom URI schemes like `fdroidrepo://` and just force all URIs to be `http://`. A slight tweak makes it possible to use a QRCode to configure a repo using all of the major ones I could find (I tested with 8 different apps).
The second bug is a simple crasher bug.
Some QR Code scanners don't respect custom schemes like fdroidrepo://, so
this is a workaround, since the local repo URI is all uppercase in the QR
Code for sending the local repo to another device. This way, the QR Code
can still be all uppercase and use HTTP:// and Android will still route it
to FDroid, but via the Just Once/Always chooser (fdroidrepo:// goes
directly to FDroid with no prompt, when it works)
* Don't hard-code ellipsis in the code
* Separate the two rows into two linear layouts
* Don't abuse relative layouts
* Use ellipsize with weights to achieve best results
Fix Multi Repo Updating Only One Repo
Java update logic has been moved to SQL, to prevent having to pull out apps fromt he database, and then iterate over them in Java.
Previously, I accidentally made the repo updater presume that it
had access to all apps in a big fat list. This meant that I was iterating
over that list, performing calculations, etc, rather than actually
querying the entire database.
The solution was to bundled all update-service related processing to one
process in AppProvider (I didn't want to have to pull every single app/apk
out of the database in order to perform the update, because that will become
more and more burdensom as the repo grows).
There is a method calcDetailsFromIndex() in the AppProvider.Helper class.
It now does three things:
* updates compatibility flag.
* updates suggested version (outstanding issue is documented in gitlab issue #1)
* updates iconsUrl (fixed in this commit)
Icons from old repos will just have icons in an "icons" dir
in the same folder as the index.jar. New repos have density
specific icon dirs (e.g. "icons-240") which depend on the
device F-Droid is running on.
The archive repo was getting updated after the regular repo.
In these situations, we didn't have every single app/apk in
memory in order to calculate the suggested version. As a
result, F-Droid ended up choosing a suggested version from
the archived versions, when terhere was actually a newer version
in the database.
This change does all of the calculations in two database queries
now. Although the implementation of the query is not hackey,
they way I get to the code in order to execute the query
is a bit hacky, so most of the implementation is private.
It adds an extra 600ms on my Nexus 4 with ~2000 apks from the
F-Droid index. But I think it is the only way, as we really need
to iterate over every single installed apk, to see if it is still
wanted. The up side is that we can query for a large amount of
them, rather than quering individually for each apk.
NOTE: I haven't added a new status message yet, because we are
about to do a stable release. After the stable release, I'll
add a new status message to cover for this > half a second
(on my relatively fast device). This will probably be part of
an overhaul of the update process in general, including a
proper progress dialog.
This can later be removed again if the user still has a way to easily update
repos manually without having to enter "Manage Repos" and exit again. A good
option would be a pull-to-refresh action.
The problem was that they defaulted to 0 if not specified, however
the code checking for current version was looking for -1 for a "no upstream version".
The idea was good: reduce the amount of copied/pasted code
where ContentValues were initialized, populated, then inserted.
I've kept the idea, by putting it in its own method which is
called twice. But the resources are not loaded dynamically any
more. This is so that the compiler will be able to pick up if
we reference a missing resource. Also, I took the opportunity
to replace the field name string literals with references to
RepoProvider.DataColumns.* constants.
Finally, changed the tests around because now we need to
have the "getInteger()" call mocked in resources correctly
(for priority/inUse).
From before content providers, where we rolled our own update notification
system for when data changed in the database. I also removed the property
"ctx", because it is availble in getApplicationContext(). As a general rule,
it is usually safer to not use a member field if not neccesary. That way,
there doesn't need to be any assumptions about when it is set and what value
it has. In this case, it was only set half way through onCreate, and therefore
usage before then would break.