Commit Graph

123 Commits

Author SHA1 Message Date
Torsten Grote decc2cc6e3
Add ktlint and run it in CI
Fixes formatting issues it found.

Also remove version variables from gradle scripts as they are not wanted by the project.
2022-02-16 09:43:19 -03:00
Torsten Grote a43d5d8ef1
Add glide support to download library 2022-02-16 09:43:19 -03:00
Hans-Christoph Steiner 88b22c95bc
purge enableBouncyCastleOnLollipop, minSdkVersion is higher 2022-01-26 19:24:28 +01:00
Hans-Christoph Steiner 172751ea98
rename Utils.getBinaryHash() to Utils.getFileHexDigest()
Since this method works on any file, not just APKs or binaries...
2022-01-26 19:24:26 +01:00
Sylvia van Os 5a678608aa Add "Other anti-features" option 2021-12-09 18:35:20 +00:00
Sylvia van Os d6dee78030 Don't hide unknown antifeatures 2021-12-09 18:35:20 +00:00
Sylvia van Os 5f922444ae Allow choosing which antifeatures to show 2021-10-14 09:25:25 +00:00
Hans-Christoph Steiner a33d9fde88
make app share URL based on the repo URL
closes #1946
2021-09-10 14:49:11 +02:00
Hans-Christoph Steiner cf94cfb543
run Android Studio's Ctrl-Alt-O Organize Imports on all .java files 2021-04-13 10:23:59 +02:00
Hans-Christoph Steiner 2975d4c09f always use fingerprint hashes in lowercase
* Utils.getBinaryHash() converts it to lowercase()
* Utils.getPackageSig() outputs lowercase
* fdroidserver outputs lowercase for all hash entries
2021-02-23 13:28:32 +01:00
Angus Gratton 3cb6cc747b Add Repo.getFileUrl() method to get file URL in a standard way 2021-02-09 09:01:12 +11:00
Hans-Christoph Steiner a11d214039 workaround Locale.toLanguageTag() requiring android-21 2021-02-08 09:51:04 +01:00
Hans-Christoph Steiner cb1b4330ef App: rename "locales" to "supportedLocales" for clarity 2021-02-08 09:51:04 +01:00
Hans-Christoph Steiner 57cee93647 trim leading/trailing whitespace from name/summary/video
This should make for predictable layouts, since fastlane entries are likely
to have a tailing newline, but entries in the metadata YAML will not.
2021-02-08 09:51:04 +01:00
Hans-Christoph Steiner e35335d59c totally overhaul choosing locales from app metadata based on LocaleList
This makes the selection logic heed the list of preferred locales from the
user Settings.

closes #987
closes #1186
refs #1440 #1882 #1730
!886
2021-02-08 09:36:46 +01:00
Hans-Christoph Steiner 0797d82d67
fix emulator test breakage from !873
Use Mockito to mock LocaleList rather than changing App.java.  The only
reliably working emulator tests on gitlab-ci are emulator-22. The change to
App.java in 3406edefcd broke there:

E/ACRA    ( 2231): Caused by: java.lang.NoClassDefFoundError: android.os.LocaleList
E/ACRA    ( 2231): 	at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
E/ACRA    ( 2231): 	at java.lang.Class.getDexCacheType(Class.java:479)
E/ACRA    ( 2231): 	at java.lang.reflect.ArtMethod.getDexCacheType(ArtMethod.java:191)
E/ACRA    ( 2231): 	at java.lang.reflect.ArtMethod.getReturnType(ArtMethod.java:145)
E/ACRA    ( 2231): 	at java.lang.reflect.Method.getReturnType(Method.java:184)
E/ACRA    ( 2231): 	at java.lang.Class.getDeclaredMethods(Class.java:771)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.util.ClassUtil.getClassMethods(ClassUtil.java:1172)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.AnnotatedMethodCollector._addMemberMethods(AnnotatedMethodCollector.java:117)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.AnnotatedMethodCollector.collect(AnnotatedMethodCollector.java:49)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.AnnotatedMethodCollector.collectMethods(AnnotatedMethodCollector.java:40)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.AnnotatedClass._methods(AnnotatedClass.java:382)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.AnnotatedClass.memberMethods(AnnotatedClass.java:322)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addMethods(POJOPropertiesCollector.java:555)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collectAll(POJOPropertiesCollector.java:323)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getPropertyMap(POJOPropertiesCollector.java:287)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getProperties(POJOPropertiesCollector.java:186)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.BasicBeanDescription._properties(BasicBeanDescription.java:164)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.introspect.BasicBeanDescription.findProperties(BasicBeanDescription.java:239)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._findCreatorsFromProperties(BasicDeserializerFactory.java:292)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._constructDefaultValueInstantiator(BasicDeserializerFactory.java:276)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findValueInstantiator(BasicDeserializerFactory.java:224)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:220)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:143)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:414)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:458)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.createContextual(ObjectArrayDeserializer.java:128)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.DeserializationContext.handleSecondaryContextualization(DeserializationContext.java:696)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:496)
E/ACRA    ( 2231): 	at com.fasterxml.jackson.databind.Objec
2020-10-21 11:30:48 +02:00
Marcus Hoffmann 3406edefcd
tests for locale selection 2020-10-20 23:17:25 +02:00
Jonas Kalderstam 87d4779c2d Fixed translations preferring secondary locale over english
In the case where a non-standard region has been set for the primary
system language, the secondary locale will be used for localized
strings when available instead of the expected primary language.

For example, set system locales to [en-SE, ja-JP], that is English
with region Sweden, and Japanese with region Japan, most apps will
display English descriptions but those which have a Japanese
translation will display that instead.

This commit adds a fallback case for when the primary locale has not
matched any translations, but it's language part does.
2020-10-20 17:40:56 +00:00
Hans-Christoph Steiner e0cb3f8afc
App.isLocalized() marks whether relevant translations are available
!886
2020-07-22 19:46:54 +02:00
Glenn Carremans 2021f43761
Changed `isLocalized` logic
`isLocalized` will be true when App will contain 1 or more valid locales for this device
2020-07-22 19:43:03 +02:00
Marcus Hoffmann 18592150c1 perform androidX migration through android studio
Project compiles and works fine after this.
2020-07-14 14:10:21 +02:00
Hans-Christoph Steiner 23bd3b81dd support new Liberapay: field, with migration support for LiberapayID:
Liberapay was originally included using a numeric ID, since they had not yet
finalized the public URLs.  Now it is a username.  So this logic prefers
the username in Liberapay: field, and uses the old LiberapayID: as a
fallback.  LiberapayID: will not override Liberapay: if it is already set.
This reuses the old database key since it is stored and processed as a
String anyway.
2020-06-25 10:31:46 +02:00
Hans-Christoph Steiner 1061929fb4 support OpenCollective as a donation option 2020-06-25 10:31:46 +02:00
Marcus Hoffmann 56c05933a2 ignore xml icons
They will never work, they should not be set by fdroidserver but we can
be defensive about not returning them to any views here.
2020-06-24 16:57:28 +02:00
Marcus Hoffmann 7b5d7f8fed fix tests after icon changes 2020-06-24 16:57:28 +02:00
Marcus Hoffmann 941d8a0b8b rename app.icon to app.iconFromApk
This makes it clearer what this is actually referring to.
2020-06-24 16:57:28 +02:00
Marcus Hoffmann a500660a41 allow displaying localized icons
Move the logic of calculating the correct iconUrl from sql to java.

Fixes #1460.
2020-06-24 16:57:28 +02:00
Marcus Hoffmann 03600c347c do not disable update button because of antifeatures
This testing at the wrong point, namely in the app details where you are
already looking at the antifeatures which might be present.
In the list view there's an additional direct check with
isDisabledByAntiFeatures() anyway.

Fix fdroid/fdroidclient#1845
2020-02-25 15:47:33 +01:00
Hans-Christoph Steiner 3f64fd4930
init suggestedVersionCode to Integer.MIN_VALUE
Java inits ints to 0.  Since it is valid to have a negative Version Code,
versionCodes are inited to Integer.MIN_VALUE;

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

closes #1063
2020-01-10 18:15:42 +01:00
Hans-Christoph Steiner 765f6b840f
rename App.upstreamVersionCode to suggestedVersionCode #1063 2020-01-10 18:15:40 +01:00
Hans-Christoph Steiner 10808e2fea
rename App.upstreamVersionName to suggestedVersionName #1063 2020-01-10 18:15:39 +01:00
Hans-Christoph Steiner 531494e571
rename App.suggestedVersionName to autoInstallVersionName #1063
# Conflicts:
#	app/src/test/java/org/fdroid/fdroid/updater/IndexV1UpdaterTest.java
2020-01-10 18:15:37 +01:00
Hans-Christoph Steiner cd635459ad
rename Cols.SuggestedApk to AutoInstallApk #1063 2020-01-10 18:15:36 +01:00
Hans-Christoph Steiner cc3d874dc4
rename App.suggestedVersionCode to autoInstallVersionCode #1063 2020-01-10 18:15:34 +01:00
Hans-Christoph Steiner ea3b47f705 purge CacheSwapAppsService in favor of InstalledAppProvider
The most expensive part of this whole process is calculating the hash of the
whole APK.  InstalledAppProvider already caches that, and the rest is OK to
query.  If any particular part of the query is expensive, it could also be
moved to InstalledAppProviderService.
2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner 56ddbf2056 fix crash on bad values in minSdkVersion
java.lang.NumberFormatException: For input string: "@2131034146"
at java.lang.Integer.parseInt(Integer.java:615)
at java.lang.Integer.parseInt(Integer.java:650)
at org.fdroid.fdroid.data.App.getMinTargetMaxSdkVersions(App.java:1092)
at org.fdroid.fdroid.data.App.initInstalledApk(App.java:769)
at org.fdroid.fdroid.data.App.getInstance(App.java:395)
at
org.fdroid.fdroid.localrepo.CacheSwapAppsService.onHandleIntent(CacheSwapAppsService.java:77)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
2019-03-29 00:11:16 +01:00
Hans-Christoph Steiner 4f1855c8a1 App Details: show the app's Translation links
fdroid/fdroidserver!450

icon is:
https://material.io/tools/icons/?search=trans&icon=translate&style=baseline
2019-03-22 22:16:08 +01:00
Hans-Christoph Steiner dcb1c3accd add flag to track localized apps for selecting in Latest tab 2019-03-22 22:16:08 +01:00
Hans-Christoph Steiner 1deec1c9b3 sanitize all packageNames from the index
This is insurance to make sure that packageNames are not abused for
exploiting F-Droid.  The database queries already use SQL Prepared
Statements, but who know what else might be exploitable.

fdroid/fdroidclient#1588
2019-01-03 14:52:32 +01:00
dkanada 568ef56247 fix merge issues and tweak the header layouts a bit more 2018-12-09 16:37:18 +09:00
dkanada 24a4da9d89 some layout modifications to Updates and AppDetails headers 2018-12-09 16:28:45 +09:00
Hans-Christoph Steiner ddb85befa6 index.xml must use "sha256" as hash type, not "SHA-256"
Otherwise the string matching in RepoXMLHandler.endElement() fails, and the
swap repo's index.xml will use "SHA-256" instead of the correct "sha256".
2018-08-07 11:28:48 +02:00
Hans-Christoph Steiner 90acd75b90 purge broken, semi-used root filtering preference
RequiresRoot should become an Anti-Feature or <uses-feature> or
something like that. Having it a one-off makes it too brittle

fdroid/fdroidclient#928
2018-07-30 18:03:12 +02:00
Hans-Christoph Steiner 6bcc1f2e68 fix crasher caused by wrong init
Also, app.installedApk.sig is set in App.initInstalledApk()
from 3a5ecc5e8e

refs #1305
refs #855

java.lang.NullPointerException
at org.fdroid.fdroid.data.App.getInstance(App.java:390)
at org.fdroid.fdroid.localrepo.CacheSwapAppsService.onHandleIntent(CacheSwapAppsService.java:77)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
2018-07-12 17:34:23 +02:00
Hans-Christoph Steiner 3a5ecc5e8e do not crash when getting hash of APK that disappears
This changes the logic of Utils.getBinaryHash() to return null on failure
rather than only throwing exceptions.  That makes it easier to handle these
failures where Utils.getBinaryHash() is called.

 #1305
 #855
2018-04-25 17:10:03 +02:00
Hans-Christoph Steiner 16d15a358d include signer fingerprint in Apk instance created from a file 2018-04-24 18:02:38 +02:00
Hans-Christoph Steiner 5c6c54cadf switch from spongycastle to latest official bouncycastle
#1379
2018-04-19 15:51:44 +02:00
Hans-Christoph Steiner 48e438d510 declare some key vars final to help the compiler optimize those
Apparently, the Java compiler can in some cases reuse a final value instead
of executing a method again.  This is from @hotlittlewhitedog

!653
2018-04-04 17:43:11 +02:00
Hans-Christoph Steiner cc540301d1 purge all references to ICON_URL_LARGE, its unused
This was only partially hooked up and often not even populated.
It was added in 4895e2d790, but things have
changed a lot now.  We should be moving towards preferring the drawable XML
vector icons, which will scale nicely for all DPIs.
2018-03-21 20:10:37 +01:00
Marcus Hoffmann 10e2bf2a7c
add liberapay field and donation option
This add the liberapayID index field to the local db and then displays a
donation badge for apps that provide this.
2018-02-15 19:58:12 +01:00