From 936d5e46eb2bdb841e299b10de7e9a353a465374 Mon Sep 17 00:00:00 2001 From: inorichi Date: Sat, 16 Jan 2016 16:33:35 +0100 Subject: [PATCH] Prepare for first release --- app/build.gradle | 5 +- app/proguard-rules.pro | 114 ++++++++++++------ .../data/download/DownloadManager.java | 3 +- 3 files changed, 85 insertions(+), 37 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3ea7183ce2..6d3a924c57 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -40,7 +40,7 @@ android { targetSdkVersion 23 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" versionCode 1 - versionName "1.0" + versionName "0.1.0" buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\"" buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\"" @@ -54,7 +54,8 @@ android { buildTypes { release { - minifyEnabled false + minifyEnabled true + shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 51ce994845..75fa2308b5 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,20 +1,6 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/hitherejoe/Android Studio.app/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html +-dontobfuscate -# Add any project specific keep options here: - -# 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 *; -#} +-keep class eu.kanade.tachiyomi.injection.** { *; } # Retrolambda -dontwarn java.lang.invoke.* @@ -27,7 +13,13 @@ -dontwarn com.squareup.okhttp.** -dontwarn okio.** -# Butterknife +# Okio +-keep class sun.misc.Unsafe { *; } +-dontwarn java.nio.file.* +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement +-dontwarn okio.** + +# ButterKnife 7 -keep class butterknife.** { *; } -dontwarn butterknife.internal.** -keep class **$$ViewBinder { *; } @@ -52,11 +44,6 @@ public void onEvent*(***); } -# Only required if you use AsyncExecutor --keepclassmembers class * extends de.greenrobot.event.util.ThrowableFailureEvent { - public (java.lang.Throwable); -} - # Don't warn for missing support classes -dontwarn de.greenrobot.event.util.*$Support -dontwarn de.greenrobot.event.util.*$SupportManagerFragment @@ -69,22 +56,22 @@ public *; } +# RxJava 1.1.0 -# RxJava 0.21 +-dontwarn sun.misc.** --keep class rx.schedulers.Schedulers { - public static ; +-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* { + long producerIndex; + long consumerIndex; } --keep class rx.schedulers.ImmediateScheduler { - public ; + +-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef { + rx.internal.util.atomic.LinkedQueueNode producerNode; } --keep class rx.schedulers.TestScheduler { - public ; + +-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef { + rx.internal.util.atomic.LinkedQueueNode consumerNode; } --keep class rx.schedulers.Schedulers { - public static ** test(); -} --dontwarn sun.misc.Unsafe # AppCombat -keep public class android.support.v7.widget.** { *; } @@ -100,4 +87,63 @@ -keep class **$$Icepick { *; } -keepclasseswithmembernames class * { @icepick.* ; -} \ No newline at end of file +} + +## GSON 2.2.4 specific rules ## + +# Gson uses generic type information stored in a class file when working with fields. Proguard +# removes such information by default, so configure it to keep all of it. +-keepattributes Signature + +# For using GSON @Expose annotation +-keepattributes *Annotation* + +-keepattributes EnclosingMethod + +# Gson specific classes +-keep class sun.misc.Unsafe { *; } +-keep class com.google.gson.stream.** { *; } + +## ACRA 4.5.0 specific rules ## + +# we need line numbers in our stack traces otherwise they are pretty useless +-renamesourcefileattribute SourceFile +-keepattributes SourceFile,LineNumberTable + +# ACRA needs "annotations" so add this... +-keepattributes *Annotation* + +# keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'. +# Note: if you are removing log messages elsewhere in this file then this isn't necessary +-keep class org.acra.ACRA { + *; +} + +# keep this around for some enums that ACRA needs +-keep class org.acra.ReportingInteractionMode { + *; +} + +-keepnames class org.acra.sender.HttpSender$** { + *; +} + +-keepnames class org.acra.ReportField { + *; +} + +# keep this otherwise it is removed by ProGuard +-keep public class org.acra.ErrorReporter { + public void addCustomData(java.lang.String,java.lang.String); + public void putCustomData(java.lang.String,java.lang.String); + public void removeCustomData(java.lang.String); +} + +# keep this otherwise it is removed by ProGuard +-keep public class org.acra.ErrorReporter { + public void handleSilentException(java.lang.Throwable); +} + +# Keep the support library +-keep class org.acra.** { *; } +-keep interface org.acra.** { *; } \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.java b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.java index 4e40951d1a..aafe36d660 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.java +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.java @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.data.download; import android.content.Context; +import android.net.Uri; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -274,7 +275,7 @@ public class DownloadManager { // Get the filename for an image given the page private String getImageFilename(Page page) { String url = page.getImageUrl(); - return url.substring(url.lastIndexOf("/") + 1, url.length()); + return Uri.parse(url).getLastPathSegment(); } private boolean isImageDownloaded(File imagePath) {