Merge pull request #60 from kirmanak/tech

Add some technical improvements
This commit is contained in:
Kirill Kamakin
2022-06-12 19:43:40 +02:00
committed by GitHub
10 changed files with 201 additions and 128 deletions

View File

@@ -7,19 +7,17 @@ plugins {
id 'org.jetbrains.kotlin.plugin.serialization' id 'org.jetbrains.kotlin.plugin.serialization'
id 'com.google.gms.google-services' id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics' id 'com.google.firebase.crashlytics'
// https://plugins.gradle.org/plugin/com.guardsquare.appsweep id "com.guardsquare.appsweep" version "$appsweep_version"
id "com.guardsquare.appsweep" version "1.0.0" id "com.google.protobuf" version "$protobuf_plugin_version"
// https://github.com/google/protobuf-gradle-plugin/releases
id "com.google.protobuf" version "0.8.18"
} }
android { android {
compileSdk 32 compileSdk compile_sdk_version
defaultConfig { defaultConfig {
applicationId "gq.kirmanak.mealient" applicationId "gq.kirmanak.mealient"
minSdk 23 minSdk min_sdk_version
targetSdk 32 targetSdk target_sdk_version
versionCode 12 versionCode 12
versionName "0.2.3" versionName "0.2.3"
@@ -29,7 +27,6 @@ android {
} }
} }
buildConfigField "Boolean", "DEBUG_PICASSO", "false"
buildConfigField "Boolean", "LOG_NETWORK", "false" buildConfigField "Boolean", "LOG_NETWORK", "false"
} }
@@ -53,10 +50,7 @@ android {
buildTypes { buildTypes {
debug { debug {
minifyEnabled true
shrinkResources true
testCoverageEnabled true testCoverageEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
} }
release { release {
minifyEnabled true minifyEnabled true
@@ -101,27 +95,20 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
} }
dependencies { dependencies {
// https://github.com/material-components/material-components-android implementation "com.google.android.material:material:$material_version"
implementation "com.google.android.material:material:1.6.0"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-runtime-ktx:$nav_version" implementation "androidx.navigation:navigation-runtime-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
// https://developer.android.com/kotlin/ktx#core implementation "androidx.core:core-ktx:$core_ktx_version"
implementation "androidx.core:core-ktx:1.7.0"
// https://developer.android.com/jetpack/androidx/releases/appcompat implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.appcompat:appcompat:1.4.1"
// https://developer.android.com/jetpack/androidx/releases/constraintlayout implementation "androidx.constraintlayout:constraintlayout:$contraint_layout_version"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
// https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout implementation "androidx.swiperefreshlayout:swiperefreshlayout:$swipe_refresh_layout_version"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
// https://developer.android.com/jetpack/androidx/releases/lifecycle
def lifecycle_version = "2.4.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
@@ -130,41 +117,29 @@ dependencies {
kaptTest "com.google.dagger:hilt-android-compiler:$hilt_version" kaptTest "com.google.dagger:hilt-android-compiler:$hilt_version"
testImplementation "com.google.dagger:hilt-android-testing:$hilt_version" testImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
// https://github.com/square/retrofit/tags implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
// https://github.com/JakeWharton/retrofit2-kotlinx-serialization-converter/tags implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:$retrofit_kotlinx_serialization_version"
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
// https://github.com/square/okhttp/tags implementation platform("com.squareup.okhttp3:okhttp-bom:$okhttp_version")
implementation platform("com.squareup.okhttp3:okhttp-bom:4.9.3")
implementation "com.squareup.okhttp3:okhttp" implementation "com.squareup.okhttp3:okhttp"
debugImplementation "com.squareup.okhttp3:logging-interceptor" debugImplementation "com.squareup.okhttp3:logging-interceptor"
// https://github.com/Kotlin/kotlinx.serialization/releases implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinx_serialization_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3"
// https://github.com/JakeWharton/timber/releases implementation "com.jakewharton.timber:timber:$timber_version"
implementation 'com.jakewharton.timber:timber:5.0.1'
// https://developer.android.com/jetpack/androidx/releases/paging
def paging_version = "3.1.1"
implementation "androidx.paging:paging-runtime-ktx:$paging_version" implementation "androidx.paging:paging-runtime-ktx:$paging_version"
testImplementation "androidx.paging:paging-common-ktx:$paging_version" testImplementation "androidx.paging:paging-common-ktx:$paging_version"
// https://developer.android.com/jetpack/androidx/releases/room
def room_version = "2.4.2"
implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version" implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-paging:$room_version" implementation "androidx.room:room-paging:$room_version"
kapt "androidx.room:room-compiler:$room_version" kapt "androidx.room:room-compiler:$room_version"
testImplementation "androidx.room:room-testing:$room_version" testImplementation "androidx.room:room-testing:$room_version"
// https://github.com/Kotlin/kotlinx-datetime/releases implementation "org.jetbrains.kotlinx:kotlinx-datetime:$kotlinx_datetime_version"
implementation "org.jetbrains.kotlinx:kotlinx-datetime:0.3.3"
// https://github.com/bumptech/glide/releases
def glide_version = "4.13.2"
implementation "com.github.bumptech.glide:glide:$glide_version" implementation "com.github.bumptech.glide:glide:$glide_version"
implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version" implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version"
implementation("com.github.bumptech.glide:recyclerview-integration:$glide_version") { implementation("com.github.bumptech.glide:recyclerview-integration:$glide_version") {
@@ -173,58 +148,42 @@ dependencies {
} }
kapt "com.github.bumptech.glide:compiler:$glide_version" kapt "com.github.bumptech.glide:compiler:$glide_version"
// https://github.com/androidbroadcast/ViewBindingPropertyDelegate/releases implementation "com.github.kirich1409:viewbindingpropertydelegate-noreflection:$view_binding_delegate_version"
implementation "com.github.kirich1409:viewbindingpropertydelegate-noreflection:1.5.6"
// https://developer.android.com/jetpack/androidx/releases/datastore
def datastore_version = "1.0.0"
implementation "androidx.datastore:datastore-preferences:$datastore_version" implementation "androidx.datastore:datastore-preferences:$datastore_version"
implementation "androidx.datastore:datastore:$datastore_version" implementation "androidx.datastore:datastore:$datastore_version"
implementation "com.google.protobuf:protobuf-javalite:$protobuf_version" implementation "com.google.protobuf:protobuf-javalite:$protobuf_version"
// https://developer.android.com/jetpack/androidx/releases/security implementation "androidx.security:security-crypto:$security_version"
implementation "androidx.security:security-crypto:1.0.0"
// https://mvnrepository.com/artifact/com.google.firebase/firebase-bom?repo=google implementation platform("com.google.firebase:firebase-bom:$firebase_version")
implementation platform("com.google.firebase:firebase-bom:30.0.2")
implementation "com.google.firebase:firebase-analytics-ktx" implementation "com.google.firebase:firebase-analytics-ktx"
implementation "com.google.firebase:firebase-crashlytics-ktx" implementation "com.google.firebase:firebase-crashlytics-ktx"
// https://github.com/junit-team/junit4/releases testImplementation "junit:junit:$junit_version"
testImplementation "junit:junit:4.13.2"
// https://github.com/Kotlin/kotlinx.coroutines/releases
def coroutines_version = "1.6.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
// https://github.com/robolectric/robolectric/releases testImplementation "org.robolectric:robolectric:$robolectric_version"
testImplementation "org.robolectric:robolectric:4.8.1"
// https://developer.android.com/jetpack/androidx/releases/test testImplementation "androidx.test.ext:junit-ktx:$junit_ktx_version"
testImplementation "androidx.test.ext:junit-ktx:1.1.3"
// https://mvnrepository.com/artifact/com.google.truth/truth testImplementation "com.google.truth:truth:$truth_version"
testImplementation "com.google.truth:truth:1.1.3"
// https://mockk.io/ testImplementation "io.mockk:mockk:$mockk_version"
testImplementation "io.mockk:mockk:1.12.4"
// https://github.com/facebook/flipper/releases
def flipper_version = "0.147.0"
debugImplementation "com.facebook.flipper:flipper:$flipper_version" debugImplementation "com.facebook.flipper:flipper:$flipper_version"
debugImplementation "com.facebook.flipper:flipper-leakcanary2-plugin:$flipper_version" debugImplementation "com.facebook.flipper:flipper-leakcanary2-plugin:$flipper_version"
debugImplementation "com.facebook.flipper:flipper-network-plugin:$flipper_version" debugImplementation "com.facebook.flipper:flipper-network-plugin:$flipper_version"
// https://github.com/facebook/SoLoader/releases debugImplementation "com.facebook.soloader:soloader:$soloader_version"
debugImplementation "com.facebook.soloader:soloader:0.10.3"
// https://github.com/square/leakcanary/releases debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.9.1"
// https://github.com/ChuckerTeam/chucker/releases // https://github.com/ChuckerTeam/chucker/releases
debugImplementation "com.github.chuckerteam.chucker:library:3.5.2" debugImplementation "com.github.chuckerteam.chucker:library:$chucker_version"
} }
protobuf { protobuf {

View File

@@ -1,25 +0,0 @@
# 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
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
### Flipper https://github.com/facebook/flipper/issues/314#issuecomment-940828336 ###
-keep class com.facebook.jni.** { *; }
-keep class com.facebook.flipper.** { *; }
### Flipper https://github.com/facebook/flipper/issues/314#issuecomment-940828336 ###

View File

@@ -19,7 +19,16 @@
# If you keep the line number information, uncomment this to # If you keep the line number information, uncomment this to
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
-dontobfuscate
### Remove logging https://www.guardsquare.com/manual/configuration/examples#logging ###
-assumenosideeffects class android.util.Log {
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
### Remove logging https://www.guardsquare.com/manual/configuration/examples#logging ###
### kotlinx.serialization https://github.com/Kotlin/kotlinx.serialization#android ### ### kotlinx.serialization https://github.com/Kotlin/kotlinx.serialization#android ###
-if @kotlinx.serialization.Serializable class ** -if @kotlinx.serialization.Serializable class **

View File

@@ -7,15 +7,16 @@
<application <application
android:name="gq.kirmanak.mealient.App" android:name="gq.kirmanak.mealient.App"
android:allowBackup="true" android:allowBackup="false"
android:fullBackupOnly="true" android:dataExtractionRules="@xml/data_extraction_rules"
android:networkSecurityConfig="@xml/network_security_config" android:fullBackupContent="@xml/full_backup_rules"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true" android:supportsRtl="true"
tools:ignore="UnusedAttribute" android:theme="@style/AppTheme"
android:theme="@style/AppTheme"> tools:targetApi="s">
<activity <activity
android:name=".ui.activity.MainActivity" android:name=".ui.activity.MainActivity"
android:exported="true"> android:exported="true">

View File

@@ -26,8 +26,6 @@
<string name="fragment_authentication_password_input_empty">Password can\'t be empty</string> <string name="fragment_authentication_password_input_empty">Password can\'t be empty</string>
<string name="fragment_authentication_credentials_incorrect">E-mail or password is incorrect.</string> <string name="fragment_authentication_credentials_incorrect">E-mail or password is incorrect.</string>
<string name="fragment_authentication_unknown_error">Something went wrong, please try again.</string> <string name="fragment_authentication_unknown_error">Something went wrong, please try again.</string>
<string name="account_type" translatable="false">Mealient</string>
<string name="auth_token_type" translatable="false">mealientAuthToken</string>
<string name="fragment_add_recipe_recipe_name">Recipe name</string> <string name="fragment_add_recipe_recipe_name">Recipe name</string>
<string name="fragment_add_recipe_recipe_description">Description</string> <string name="fragment_add_recipe_recipe_description">Description</string>
<string name="menu_bottom_navigation_add_recipe">Add recipe</string> <string name="menu_bottom_navigation_add_recipe">Add recipe</string>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
<cloud-backup>
<exclude domain="root" />
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
</cloud-backup>
<device-transfer>
<exclude domain="root" />
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
</device-transfer>
</data-extraction-rules>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
<exclude domain="root" />
</full-backup-content>

View File

@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<network-security-config> <network-security-config xmlns:tools="http://schemas.android.com/tools">
<!-- Explicitly enable cleartext traffic communication because users might use their own network -->
<base-config
cleartextTrafficPermitted="true"
tools:ignore="InsecureBaseConfiguration" />
<debug-overrides> <debug-overrides>
<trust-anchors> <trust-anchors>
<!-- Trust user added CAs while debuggable only --> <!-- Trust user added CAs while debuggable only -->

View File

@@ -1,14 +1,6 @@
buildscript { buildscript {
ext {
// https://developer.android.com/jetpack/androidx/releases/navigation
nav_version = "2.4.2"
// https://dagger.dev/hilt/gradle-setup apply from: "./gradle/versions.gradle"
hilt_version = "2.42"
// https://kotlinlang.org/docs/gradle.html
kotlin_version = "1.6.21"
}
repositories { repositories {
google() google()
@@ -16,14 +8,9 @@ buildscript {
} }
dependencies { dependencies {
// https://maven.google.com/web/index.html?q=com.android.tools.build#com.android.tools.build:gradle classpath "com.android.tools.build:gradle:$android_plugin_version"
classpath "com.android.tools.build:gradle:7.2.1" classpath "com.google.gms:google-services:$google_services_version"
// https://developers.google.com/android/guides/google-services-plugin classpath "com.google.firebase:firebase-crashlytics-gradle:$crashlytics_version"
classpath "com.google.gms:google-services:4.3.10"
// https://mvnrepository.com/artifact/com.google.firebase/firebase-crashlytics-gradle
classpath "com.google.firebase:firebase-crashlytics-gradle:2.8.1"
// https://mvnrepository.com/artifact/com.google.firebase/perf-plugin
classpath "com.google.firebase:perf-plugin:1.4.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
@@ -32,10 +19,8 @@ buildscript {
} }
plugins { plugins {
// https://plugins.gradle.org/plugin/org.sonarqube id "org.sonarqube" version "$sonarqube_version"
id "org.sonarqube" version "3.3" id "nl.neotech.plugin.rootcoverage" version "$root_coverage_version"
// https://plugins.gradle.org/plugin/nl.neotech.plugin.rootcoverage
id "nl.neotech.plugin.rootcoverage" version "1.5.2"
} }
task clean(type: Delete) { task clean(type: Delete) {
@@ -55,8 +40,3 @@ sonarqube {
rootCoverage { rootCoverage {
generateXml true generateXml true
} }
ext {
// https://github.com/protocolbuffers/protobuf/releases
protobuf_version = "3.21.1"
}

120
gradle/versions.gradle Normal file
View File

@@ -0,0 +1,120 @@
ext {
// https://github.com/protocolbuffers/protobuf/releases
protobuf_version = "3.21.1"
// https://github.com/google/protobuf-gradle-plugin/releases
protobuf_plugin_version = "0.8.18"
// https://developer.android.com/jetpack/androidx/releases/navigation
nav_version = "2.4.2"
// https://dagger.dev/hilt/gradle-setup
hilt_version = "2.42"
// https://kotlinlang.org/docs/gradle.html
kotlin_version = "1.6.21"
// https://maven.google.com/web/index.html?q=com.android.tools.build#com.android.tools.build:gradle
android_plugin_version = "7.2.1"
// https://developers.google.com/android/guides/google-services-plugin
google_services_version = "4.3.10"
// https://mvnrepository.com/artifact/com.google.firebase/firebase-crashlytics-gradle
crashlytics_version = "2.9.0"
// https://plugins.gradle.org/plugin/org.sonarqube
sonarqube_version = "3.4.0.2513"
// https://plugins.gradle.org/plugin/nl.neotech.plugin.rootcoverage
root_coverage_version = "1.5.2"
// https://plugins.gradle.org/plugin/com.guardsquare.appsweep
appsweep_version = "1.0.0"
compile_sdk_version = 32
min_sdk_version = 32
target_sdk_version = 32
// https://github.com/material-components/material-components-android/releases
material_version = "1.6.1"
// https://developer.android.com/kotlin/ktx#core
core_ktx_version = "1.8.0"
// https://developer.android.com/jetpack/androidx/releases/appcompat
appcompat_version = "1.4.2"
// https://developer.android.com/jetpack/androidx/releases/constraintlayout
contraint_layout_version = "2.1.4"
// https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout
swipe_refresh_layout_version = "1.1.0"
// https://developer.android.com/jetpack/androidx/releases/lifecycle
lifecycle_version = "2.4.1"
// https://github.com/square/retrofit/tags
retrofit_version = "2.9.0"
// https://github.com/JakeWharton/retrofit2-kotlinx-serialization-converter/tags
retrofit_kotlinx_serialization_version = "0.8.0"
// https://github.com/Kotlin/kotlinx.serialization/releases
kotlinx_serialization_version = "1.3.3"
// https://github.com/square/okhttp/tags
okhttp_version = "4.10.0"
// https://github.com/JakeWharton/timber/releases
timber_version = "5.0.1"
// https://developer.android.com/jetpack/androidx/releases/paging
paging_version = "3.1.1"
// https://developer.android.com/jetpack/androidx/releases/room
room_version = "2.4.2"
// https://github.com/Kotlin/kotlinx-datetime/releases
kotlinx_datetime_version = "0.3.3"
// https://github.com/bumptech/glide/releases
glide_version = "4.13.2"
// https://github.com/androidbroadcast/ViewBindingPropertyDelegate/releases
view_binding_delegate_version = "1.5.6"
// https://developer.android.com/jetpack/androidx/releases/datastore
datastore_version = "1.0.0"
// https://developer.android.com/jetpack/androidx/releases/security
security_version = "1.0.0"
// https://mvnrepository.com/artifact/com.google.firebase/firebase-bom?repo=google
firebase_version = "30.1.0"
// https://github.com/junit-team/junit4/releases
junit_version = "4.13.2"
// https://developer.android.com/jetpack/androidx/releases/test
junit_ktx_version = "1.1.3"
// https://github.com/Kotlin/kotlinx.coroutines/releases
coroutines_version = "1.6.2"
// https://github.com/robolectric/robolectric/releases
robolectric_version = "4.8.1"
// https://mvnrepository.com/artifact/com.google.truth/truth
truth_version = "1.1.3"
// https://mockk.io/
mockk_version = "1.12.4"
// https://github.com/facebook/flipper/releases
flipper_version = "0.149.0"
// https://github.com/facebook/SoLoader/releases
soloader_version = "0.10.3"
// https://github.com/square/leakcanary/releases
leakcanary_version = "2.9.1"
// https://github.com/ChuckerTeam/chucker/releases
chucker_version = "3.5.2"
}