mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-20 14:57:15 -04:00
[index] remove grouping of author and donation fields
at the explicit request of Hans who feels strongly about it.
This commit is contained in:
@@ -3,8 +3,6 @@ package org.fdroid.index.v1
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.fdroid.index.DEFAULT_LOCALE
|
||||
import org.fdroid.index.mapValuesNotNull
|
||||
import org.fdroid.index.v2.Author
|
||||
import org.fdroid.index.v2.Donation
|
||||
import org.fdroid.index.v2.FileV2
|
||||
import org.fdroid.index.v2.LocalizedFileListV2
|
||||
import org.fdroid.index.v2.LocalizedFileV2
|
||||
@@ -63,21 +61,17 @@ public data class AppV1(
|
||||
translation = translation,
|
||||
preferredSigner = preferredSigner,
|
||||
categories = categories,
|
||||
author = Author(
|
||||
name = authorName,
|
||||
email = authorEmail,
|
||||
website = authorWebSite,
|
||||
phone = authorPhone,
|
||||
).takeIf { !it.isNull },
|
||||
donation = Donation(
|
||||
url = donate,
|
||||
liberapayID = liberapayID,
|
||||
liberapay = liberapay,
|
||||
openCollective = openCollective,
|
||||
bitcoin = bitcoin,
|
||||
litecoin = litecoin,
|
||||
flattrID = flattrID,
|
||||
).takeIf { !it.isNull },
|
||||
authorName = authorName,
|
||||
authorEmail = authorEmail,
|
||||
authorWebSite = authorWebSite,
|
||||
authorPhone = authorPhone,
|
||||
donate = if (donate == null) emptyList() else listOf(donate),
|
||||
liberapayID = liberapayID,
|
||||
liberapay = liberapay,
|
||||
openCollective = openCollective,
|
||||
bitcoin = bitcoin,
|
||||
litecoin = litecoin,
|
||||
flattrID = flattrID,
|
||||
icon = localized.toLocalizedFileV2 { it.icon }
|
||||
?: icon?.let { mapOf(locale to FileV2("/icons/$it")) },
|
||||
featureGraphic = localized.toLocalizedFileV2 { it.featureGraphic },
|
||||
|
||||
@@ -24,8 +24,17 @@ public data class MetadataV2(
|
||||
val translation: String? = null,
|
||||
val preferredSigner: String? = null,
|
||||
val categories: List<String> = emptyList(),
|
||||
val author: Author? = null,
|
||||
val donation: Donation? = null,
|
||||
val authorName: String? = null,
|
||||
val authorEmail: String? = null,
|
||||
val authorWebSite: String? = null,
|
||||
val authorPhone: String? = null,
|
||||
val donate: List<String> = emptyList(),
|
||||
val liberapayID: String? = null,
|
||||
val liberapay: String? = null,
|
||||
val openCollective: String? = null,
|
||||
val bitcoin: String? = null,
|
||||
val litecoin: String? = null,
|
||||
val flattrID: String? = null,
|
||||
val icon: LocalizedFileV2? = null,
|
||||
val featureGraphic: LocalizedFileV2? = null,
|
||||
val promoGraphic: LocalizedFileV2? = null,
|
||||
@@ -34,35 +43,6 @@ public data class MetadataV2(
|
||||
val screenshots: Screenshots? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class Author(
|
||||
val name: String? = null,
|
||||
val email: String? = null,
|
||||
val website: String? = null,
|
||||
val phone: String? = null,
|
||||
) {
|
||||
internal constructor() : this(null, null, null, null)
|
||||
|
||||
val isNull: Boolean get() = (name == null && email == null && website == null && phone == null)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
public data class Donation(
|
||||
val url: String? = null,
|
||||
val liberapayID: String? = null,
|
||||
val liberapay: String? = null,
|
||||
val openCollective: String? = null,
|
||||
val bitcoin: String? = null,
|
||||
val litecoin: String? = null,
|
||||
val flattrID: String? = null,
|
||||
) {
|
||||
internal constructor() : this(null, null, null, null, null, null, null)
|
||||
|
||||
val isNull: Boolean
|
||||
get() = url == null && liberapayID == null && liberapay == null &&
|
||||
openCollective == null && bitcoin == null && litecoin == null && flattrID == null
|
||||
}
|
||||
|
||||
@Serializable
|
||||
public data class Screenshots(
|
||||
val phone: LocalizedFileListV2? = null,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.fdroid.test
|
||||
|
||||
import org.fdroid.index.v2.Author
|
||||
import org.fdroid.index.v2.Donation
|
||||
import org.fdroid.index.v2.FileV2
|
||||
import org.fdroid.index.v2.LocalizedFileListV2
|
||||
import org.fdroid.index.v2.MetadataV2
|
||||
@@ -31,8 +29,17 @@ public object TestAppUtils {
|
||||
translation = getRandomString().orNull(),
|
||||
preferredSigner = getRandomString().orNull(),
|
||||
video = getRandomLocalizedTextV2().orNull(),
|
||||
author = getRandomAuthor().orNull(),
|
||||
donation = getRandomDonation().orNull(),
|
||||
authorName = getRandomString().orNull(),
|
||||
authorEmail = getRandomString().orNull(),
|
||||
authorWebSite = getRandomString().orNull(),
|
||||
authorPhone = getRandomString().orNull(),
|
||||
donate = getRandomList(Random.nextInt(0, 3)) { getRandomString() },
|
||||
liberapay = getRandomString().orNull(),
|
||||
liberapayID = getRandomString().orNull(),
|
||||
openCollective = getRandomString().orNull(),
|
||||
bitcoin = getRandomString().orNull(),
|
||||
litecoin = getRandomString().orNull(),
|
||||
flattrID = getRandomString().orNull(),
|
||||
icon = getRandomLocalizedFileV2().orNull(),
|
||||
featureGraphic = getRandomLocalizedFileV2().orNull(),
|
||||
promoGraphic = getRandomLocalizedFileV2().orNull(),
|
||||
@@ -42,23 +49,6 @@ public object TestAppUtils {
|
||||
screenshots = getRandomScreenshots().orNull(),
|
||||
)
|
||||
|
||||
public fun getRandomAuthor(): Author = Author(
|
||||
name = getRandomString().orNull(),
|
||||
email = getRandomString().orNull(),
|
||||
website = getRandomString().orNull(),
|
||||
phone = getRandomString().orNull(),
|
||||
)
|
||||
|
||||
public fun getRandomDonation(): Donation = Donation(
|
||||
url = getRandomString().orNull(),
|
||||
liberapay = getRandomString().orNull(),
|
||||
liberapayID = getRandomString().orNull(),
|
||||
openCollective = getRandomString().orNull(),
|
||||
bitcoin = getRandomString().orNull(),
|
||||
litecoin = getRandomString().orNull(),
|
||||
flattrID = getRandomString().orNull(),
|
||||
)
|
||||
|
||||
public fun getRandomScreenshots(): Screenshots? = Screenshots(
|
||||
phone = getRandomLocalizedFileListV2().orNull(),
|
||||
sevenInch = getRandomLocalizedFileListV2().orNull(),
|
||||
|
||||
@@ -3,9 +3,7 @@ package org.fdroid.test
|
||||
import org.fdroid.index.RELEASE_CHANNEL_BETA
|
||||
import org.fdroid.index.getV1ReleaseChannels
|
||||
import org.fdroid.index.v2.AntiFeatureV2
|
||||
import org.fdroid.index.v2.Author
|
||||
import org.fdroid.index.v2.CategoryV2
|
||||
import org.fdroid.index.v2.Donation
|
||||
import org.fdroid.index.v2.FeatureV2
|
||||
import org.fdroid.index.v2.FileV1
|
||||
import org.fdroid.index.v2.FileV2
|
||||
@@ -263,7 +261,7 @@ internal object TestDataMidV2 {
|
||||
LOCALE to "App1",
|
||||
"de" to "app 1 name",
|
||||
),
|
||||
author = Author(name = "App1 author"),
|
||||
authorName = "App1 author",
|
||||
license = "GPLv3",
|
||||
webSite = "http://min1.test.org",
|
||||
icon = mapOf(
|
||||
@@ -574,12 +572,10 @@ internal object TestDataMidV2 {
|
||||
translation = "https://hosted.weblate.org/projects/f-droid/f-droid",
|
||||
issueTracker = "https://gitlab.com/fdroid/fdroidclient/issues",
|
||||
sourceCode = "https://gitlab.com/fdroid/fdroidclient",
|
||||
donation = Donation(
|
||||
url = "https://f-droid.org/donate",
|
||||
liberapayID = "27859",
|
||||
openCollective = "F-Droid-Euro",
|
||||
flattrID = "343053",
|
||||
),
|
||||
donate = listOf("https://f-droid.org/donate"),
|
||||
liberapayID = "27859",
|
||||
openCollective = "F-Droid-Euro",
|
||||
flattrID = "343053",
|
||||
preferredSigner = "43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab",
|
||||
license = "GPL-3.0-or-later",
|
||||
webSite = "https://f-droid.org",
|
||||
@@ -1053,21 +1049,17 @@ internal object TestDataMaxV2 {
|
||||
translation = "translation3",
|
||||
preferredSigner = "43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab",
|
||||
categories = listOf("Cat1", "Cat2", "Cat3"),
|
||||
author = Author(
|
||||
name = "App3 author",
|
||||
email = "email",
|
||||
website = "website",
|
||||
phone = "phone",
|
||||
),
|
||||
donation = Donation(
|
||||
url = "donate",
|
||||
liberapayID = "liberapayID",
|
||||
liberapay = "liberapay",
|
||||
openCollective = "openCollective",
|
||||
bitcoin = "bitcoin",
|
||||
litecoin = "litecoin",
|
||||
flattrID = "flattrID",
|
||||
),
|
||||
authorName = "App3 author",
|
||||
authorEmail = "email",
|
||||
authorWebSite = "website",
|
||||
authorPhone = "phone",
|
||||
donate = listOf("donate"),
|
||||
liberapayID = "liberapayID",
|
||||
liberapay = "liberapay",
|
||||
openCollective = "openCollective",
|
||||
bitcoin = "bitcoin",
|
||||
litecoin = "litecoin",
|
||||
flattrID = "flattrID",
|
||||
icon = mapOf(
|
||||
"en" to FileV2(
|
||||
name = "/Haoheiseeshai2que2Che0ooSa6aikeemoo2ap9Aequoh4ju5chooYuPhiev8moodahl" +
|
||||
|
||||
@@ -153,9 +153,7 @@
|
||||
"categories": [
|
||||
"Cat1"
|
||||
],
|
||||
"author": {
|
||||
"name": "App1 author"
|
||||
},
|
||||
"authorName": "App1 author",
|
||||
"icon": {
|
||||
"en-US": {
|
||||
"name": "/icons/icon-min1.png",
|
||||
@@ -230,12 +228,12 @@
|
||||
"NoMoreSystem",
|
||||
"OneMore"
|
||||
],
|
||||
"donation": {
|
||||
"url": "https://f-droid.org/donate",
|
||||
"liberapayID": "27859",
|
||||
"openCollective": "F-Droid-Euro",
|
||||
"flattrID": "343053"
|
||||
},
|
||||
"donate": [
|
||||
"https://f-droid.org/donate"
|
||||
],
|
||||
"liberapayID": "27859",
|
||||
"openCollective": "F-Droid-Euro",
|
||||
"flattrID": "343053",
|
||||
"icon": {
|
||||
"en-US": {
|
||||
"name": "/org.fdroid.fdroid/en-US/new icon",
|
||||
@@ -600,21 +598,19 @@
|
||||
"Cat2",
|
||||
"Cat3"
|
||||
],
|
||||
"author": {
|
||||
"name": "App3 author",
|
||||
"email": "email",
|
||||
"website": "website",
|
||||
"phone": "phone"
|
||||
},
|
||||
"donation": {
|
||||
"url": "donate",
|
||||
"liberapayID": "liberapayID",
|
||||
"liberapay": "liberapay",
|
||||
"openCollective": "openCollective",
|
||||
"bitcoin": "bitcoin",
|
||||
"litecoin": "litecoin",
|
||||
"flattrID": "flattrID"
|
||||
},
|
||||
"authorName": "App3 author",
|
||||
"authorEmail": "email",
|
||||
"authorWebSite": "website",
|
||||
"authorPhone": "phone",
|
||||
"donate": [
|
||||
"donate"
|
||||
],
|
||||
"liberapayID": "liberapayID",
|
||||
"liberapay": "liberapay",
|
||||
"openCollective": "openCollective",
|
||||
"bitcoin": "bitcoin",
|
||||
"litecoin": "litecoin",
|
||||
"flattrID": "flattrID",
|
||||
"icon": {
|
||||
"en": {
|
||||
"name": "/Haoheiseeshai2que2Che0ooSa6aikeemoo2ap9Aequoh4ju5chooYuPhiev8moodahlonu2oht5Eikahvushapeum5aefo6xig4aghahyaaNuezoo4eexee1Goo5UngohGha6quaeghe8uCh9iex9Oowa9aiyohzoo2ij5miifiegaeth8nie9jae6raephoowishoor1Ien5vahGhahm7eidaiy2AeCaej9iexahyooshu2ic9tea1ool8tu4Y/en/en ",
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"metadata": {
|
||||
"name": {
|
||||
"en-US": "App1",
|
||||
"de" : "app 1 name"
|
||||
"de": "app 1 name"
|
||||
},
|
||||
"summary": {
|
||||
"en-US": "App1 summary",
|
||||
@@ -66,9 +66,7 @@
|
||||
"categories": [
|
||||
"Cat1"
|
||||
],
|
||||
"author": {
|
||||
"name": "App1 author"
|
||||
},
|
||||
"authorName": "App1 author",
|
||||
"icon": {
|
||||
"en-US": {
|
||||
"name": "/icons/icon-min1.png",
|
||||
@@ -165,12 +163,12 @@
|
||||
"categories": [
|
||||
"System"
|
||||
],
|
||||
"donation": {
|
||||
"url": "https://f-droid.org/donate",
|
||||
"liberapayID": "27859",
|
||||
"openCollective": "F-Droid-Euro",
|
||||
"flattrID": "343053"
|
||||
},
|
||||
"donate": [
|
||||
"https://f-droid.org/donate"
|
||||
],
|
||||
"liberapayID": "27859",
|
||||
"openCollective": "F-Droid-Euro",
|
||||
"flattrID": "343053",
|
||||
"icon": {
|
||||
"en-US": {
|
||||
"name": "/icons/org.fdroid.fdroid.1014050.png",
|
||||
|
||||
Reference in New Issue
Block a user