diff --git a/app/build.gradle b/app/build.gradle index c259b1f..9c88e40 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,8 +20,8 @@ android { applicationId "org.fnives.tiktokdownloader" minSdkVersion 23 targetSdkVersion 35 - versionCode 4 - versionName "1.3.3" + versionCode 5 + versionName "1.3.4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..acd434e 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,21 +1,54 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html +# REGION RETROFIT -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} +# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and +# EnclosingMethod is required to use InnerClasses. +-keepattributes Signature, InnerClasses, EnclosingMethod -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable +# Retrofit does reflection on method and parameter annotations. +-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +# Keep annotation default values (e.g., retrofit2.http.Field.encoded). +-keepattributes AnnotationDefault + +# Retain service method parameters when optimizing. +-keepclassmembers,allowshrinking,allowobfuscation interface * { + @retrofit2.http.* ; +} + +# Ignore annotation used for build tooling. +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement + +# Ignore JSR 305 annotations for embedding nullability information. +-dontwarn javax.annotation.** + +# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. +-dontwarn kotlin.Unit + +# Top-level functions that can only be used by Kotlin. +-dontwarn retrofit2.KotlinExtensions +-dontwarn retrofit2.KotlinExtensions$* + +# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy +# and replaces all potential values with null. Explicitly keeping the interfaces prevents this. +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface <1> + +# Keep inherited services. +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface * extends <1> + +# With R8 full mode generic signatures are stripped for classes that are not +# kept. Suspend functions are wrapped in continuations where the type argument +# is used. +-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation + +# R8 full mode strips generic signatures from return types if not kept. +-if interface * { @retrofit2.http.* public *** *(...); } +-keep,allowoptimization,allowshrinking,allowobfuscation class <3> + +# With R8 full mode generic signatures are stripped for classes that are not kept. +-keep,allowobfuscation,allowshrinking class retrofit2.Response + +# ENDREGION + +# REGION \ No newline at end of file diff --git a/app/src/main/java/org/fnives/tiktokdownloader/Logger.kt b/app/src/main/java/org/fnives/tiktokdownloader/Logger.kt index 7facc18..98b8fc8 100644 --- a/app/src/main/java/org/fnives/tiktokdownloader/Logger.kt +++ b/app/src/main/java/org/fnives/tiktokdownloader/Logger.kt @@ -1,12 +1,17 @@ package org.fnives.tiktokdownloader +import com.pierfrancescosoffritti.androidyoutubeplayer.BuildConfig +import org.fnives.tiktokdownloader.errortracking.ErrorTracer + object Logger { private const val TAG = "TTDTag" fun logMessage(message: String) { if (BuildConfig.DEBUG) { - System.err.println("TTDTag $message") + System.err.println("$TAG: $message") + } else { + ErrorTracer.addError("", message = "$TAG: $message", throwable = null) } } } diff --git a/app/src/main/java/org/fnives/tiktokdownloader/data/network/TikTokDownloadRemoteSource.kt b/app/src/main/java/org/fnives/tiktokdownloader/data/network/TikTokDownloadRemoteSource.kt index 7e406bc..8837689 100644 --- a/app/src/main/java/org/fnives/tiktokdownloader/data/network/TikTokDownloadRemoteSource.kt +++ b/app/src/main/java/org/fnives/tiktokdownloader/data/network/TikTokDownloadRemoteSource.kt @@ -31,6 +31,7 @@ class TikTokDownloadRemoteSource( wrapIntoProperException { ErrorTracer.startErrorTransaction(videoInPending.url) delay(delayBeforeRequest) // added just so captcha trigger may not happen + Logger.logMessage("starting request") val actualUrl = service.getContentActualUrlAndCookie(videoInPending.url) val videoUrl: VideoFileUrl if (actualUrl.url != null) { diff --git a/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/TikTokWebPageConverterFactory.kt b/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/TikTokWebPageConverterFactory.kt index 9243b2a..7c737da 100644 --- a/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/TikTokWebPageConverterFactory.kt +++ b/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/TikTokWebPageConverterFactory.kt @@ -10,6 +10,7 @@ import org.fnives.tiktokdownloader.data.network.parsing.converter.VideoResponseC import org.fnives.tiktokdownloader.data.network.parsing.response.ActualVideoPageUrl import org.fnives.tiktokdownloader.data.network.parsing.response.VideoFileUrl import org.fnives.tiktokdownloader.data.network.parsing.response.VideoResponse +import org.fnives.tiktokdownloader.errortracking.ErrorTracer import retrofit2.Converter import retrofit2.Retrofit import java.lang.reflect.Type @@ -39,6 +40,13 @@ class TikTokWebPageConverterFactory( ) VideoResponse::class.java -> VideoResponseConverter() - else -> super.responseBodyConverter(type, annotations, retrofit) + else -> { + ErrorTracer.addError( + "", + message = "Couldn't find proper Converter for $type with $annotations", + throwable = null + ) + super.responseBodyConverter(type, annotations, retrofit) + } } } \ No newline at end of file diff --git a/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/ActualVideoPageUrl.kt b/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/ActualVideoPageUrl.kt index 2dc725d..a667f8b 100644 --- a/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/ActualVideoPageUrl.kt +++ b/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/ActualVideoPageUrl.kt @@ -1,3 +1,6 @@ package org.fnives.tiktokdownloader.data.network.parsing.response +import androidx.annotation.Keep + +@Keep class ActualVideoPageUrl(val url: String?, val fullResponse: String) \ No newline at end of file diff --git a/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/VideoFileUrl.kt b/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/VideoFileUrl.kt index 7349559..fd10388 100644 --- a/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/VideoFileUrl.kt +++ b/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/VideoFileUrl.kt @@ -1,3 +1,6 @@ package org.fnives.tiktokdownloader.data.network.parsing.response +import androidx.annotation.Keep + +@Keep class VideoFileUrl(val videoFileUrl: String) \ No newline at end of file diff --git a/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/VideoResponse.kt b/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/VideoResponse.kt index cc3adc5..dd3a98d 100644 --- a/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/VideoResponse.kt +++ b/app/src/main/java/org/fnives/tiktokdownloader/data/network/parsing/response/VideoResponse.kt @@ -1,6 +1,8 @@ package org.fnives.tiktokdownloader.data.network.parsing.response +import androidx.annotation.Keep import okhttp3.MediaType import java.io.InputStream +@Keep class VideoResponse(val mediaType: MediaType?, val videoInputStream: InputStream) \ No newline at end of file diff --git a/app/src/main/java/org/fnives/tiktokdownloader/errortracking/SendErrorsAsEmail.kt b/app/src/main/java/org/fnives/tiktokdownloader/errortracking/SendErrorsAsEmail.kt index c5aa187..cab4781 100644 --- a/app/src/main/java/org/fnives/tiktokdownloader/errortracking/SendErrorsAsEmail.kt +++ b/app/src/main/java/org/fnives/tiktokdownloader/errortracking/SendErrorsAsEmail.kt @@ -2,7 +2,6 @@ package org.fnives.tiktokdownloader.errortracking import android.content.Context import android.content.Intent -import android.net.Uri import androidx.core.content.FileProvider import java.io.File diff --git a/tiktok-downloader.apk b/tiktok-downloader.apk index 9bbfed1..0f760c2 100644 Binary files a/tiktok-downloader.apk and b/tiktok-downloader.apk differ