otherwise the v1 repos still relying on them would not re-update and thus the DB miss their data. This can cause unintended breakage like apps not having a preferred repo.
(cherry picked from commit 05b9157b27)
If we are used to update the same repo at almost the same time, a race-condition can happen that tries to apply a diff to an already updated DB. We don't download anything while holding a DB transaction, so the download and check for the repo timestamp happens before we enter the transaction. However, we forgot to re-check the timestamp again within the transaction to be sure the DB state is still as expected.
The default `simple` tokenzier config used in Room/SQLite3 FTS4 makes only ASCII characters case insensitive. The SQLite FTS3/4 doc [1] says:
> All uppercase characters within the ASCII range (Unicode codepoints less than 128), are transformed to their lowercase equivalents as part of the tokenization process. Thus, full-text queries are case-insensitive when using the simple tokenizer.
> The remove_diacritics option may be set to "0", "1" or "2". The default value is "1". If it is set to "1" or "2", then diacritics are removed from Latin script characters as described above. However, if it is set to "1", then diacritics are not removed in the fairly uncommon case where a single unicode codepoint is used to represent a character with more that one diacritic. [...] This is technically a bug, but cannot be fixed without creating backwards compatibility problems. If this option is set to "2", then diacritics are correctly removed from all Latin characters.
This change makes use of the intended behaviour by using the `unicode61` tokenizer with the `diacritics="0"` option to keep the behaviour similar to the current one. This replaces the previously used `simple` tokenizer. A migration is necessary to recreate the AppMetadataFts table to make use of the different tokenizer.
[1] https://www.sqlite.org/fts3.html#tokenizer
If an update was available from a disabled repo with a higher priority, the update from an enabled repo with a lower priority would not be offered as an update (i.e. returned by DbUpdateChecker#getUpdatableApps()).
historically, repos were added to the DB without much information and could stay in a broken state until manually removed. If a repo is updating, it should have a cert. So only repos that never did a single index update don't have a cert. Nowadays, this can not happen anymore as we get the repo and its cert before adding it to the DB. So whenever we update a repo, we know its certificate and fingerprint. Thus, this includes a DB migration removing all broken repos and making the certificate for repos in the DB non-null.
Some repos (like SimpleX Chat) publish several versions with the same version code only different in native code. Previously, the sorting of those versions was non-deterministic, now we at least make them deterministic by sorting by native code as well in lexicographic ascending order, so arm64 is shown before armeabi-v7a.
On versions before 1.18.0, adding a repo would add it as "empty" to the DB without a certificate right away and if there was an issue with it (e.g. typo in URL), it would stay in the DB until manually removed.
Our migration code did not consider such repos.
The client was already auto-incrementing their weight anyway. But it leaked our internal weight handling into the library consumer which can cause issues like when me are making changes to how we handles repo weights as we are doing now.
so they do not override the information from older repos anymore. This is especially an issue for the official repo which historically had the lowest priority while it should have the highest.