From 149bda765b482cbce9266abb7b753c124e71c379 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 8 Aug 2020 15:59:03 -0400 Subject: [PATCH] Add ability to flag extension as NSFW (#4053) --- .travis/create-repo.sh | 6 ++++-- AndroidManifest.xml | 3 ++- CONTRIBUTING.md | 2 ++ common.gradle | 7 ++++--- src/all/nhentai/build.gradle | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.travis/create-repo.sh b/.travis/create-repo.sh index a26a78199..dcd537ba0 100755 --- a/.travis/create-repo.sh +++ b/.travis/create-repo.sh @@ -15,12 +15,13 @@ APKS=( ../apk/*".apk"* ) for APK in ${APKS[@]}; do FILENAME=$(basename ${APK}) - BADGING="$(${TOOLS}/aapt dump badging $APK)" + BADGING="$(${TOOLS}/aapt dump --include-meta-data badging $APK)" PACKAGE=$(echo "$BADGING" | grep package:) PKGNAME=$(echo $PACKAGE | grep -Po "package: name='\K[^']+") VCODE=$(echo $PACKAGE | grep -Po "versionCode='\K[^']+") VNAME=$(echo $PACKAGE | grep -Po "versionName='\K[^']+") + NSFW=$(echo $BADGING | grep -Po "tachiyomi.extension.nsfw' value='\K[^']+") APPLICATION=$(echo "$BADGING" | grep application:) LABEL=$(echo $APPLICATION | grep -Po "label='\K[^']+") @@ -37,7 +38,8 @@ for APK in ${APKS[@]}; do --arg lang "$LANG" \ --argjson code $VCODE \ --arg version "$VNAME" \ - '{name:$name, pkg:$pkg, apk:$apk, lang:$lang, code:$code, version:$version}' + --argjson nsfw $NSFW \ + '{name:$name, pkg:$pkg, apk:$apk, lang:$lang, code:$code, version:$version, nsfw:$nsfw}' done | jq -sr '[.[]]' > index.json diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e6adf1e96..3b92e1e2e 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -7,7 +7,8 @@ + - \ No newline at end of file + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7fb48aa38..4eac30283 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,6 +75,7 @@ ext { extClass = '.' extVersionCode = 1 libVersion = '1.2' + containsNsfw = true } apply from: "$rootDir/common.gradle" @@ -87,6 +88,7 @@ apply from: "$rootDir/common.gradle" | `extClass` | Points to the class that implements `Source`. You can use a relative path starting with a dot (the package name is the base path). This is used to find and instantiate the source(s). | | `extVersionCode` | The extension version code. This must be a positive integer and incremented with any change to the code. | | `libVersion` | The version of the [extensions library](https://github.com/tachiyomiorg/extensions-lib) used. | +| `containsNsfw` | (Optional, defaults to `false`) Flag to indicate that a source contains NSFW content. | The extension's version name is generated automatically by concatenating `libVersion` and `extVersionCode`. With the example used above, the version would be `1.2.1`. diff --git a/common.gradle b/common.gradle index 5cf39048f..4912d0a36 100644 --- a/common.gradle +++ b/common.gradle @@ -40,6 +40,7 @@ android { manifestPlaceholders = [ appName : "Tachiyomi: $extName", extClass: extClass, + nsfw: project.ext.properties.getOrDefault("containsNsfw", false) ? 1 : 0, ] } @@ -48,12 +49,12 @@ android { } compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_1_8.toString() } } diff --git a/src/all/nhentai/build.gradle b/src/all/nhentai/build.gradle index 16a4545f7..5efca52de 100644 --- a/src/all/nhentai/build.gradle +++ b/src/all/nhentai/build.gradle @@ -7,6 +7,7 @@ ext { extClass = '.NHFactory' extVersionCode = 27 libVersion = '1.2' + containsNsfw = true } dependencies {