Skip to content

Commit

Permalink
app is now modularized
Browse files Browse the repository at this point in the history
  • Loading branch information
yamin8000 committed Mar 20, 2024
1 parent 10db55b commit 9e297f0
Show file tree
Hide file tree
Showing 39 changed files with 242 additions and 159 deletions.
23 changes: 5 additions & 18 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("kotlin-parcelize")
id("com.google.devtools.ksp") version ("1.9.22-1.0.18")
}

private val composeCompilerVersion = "1.5.10"
Expand All @@ -42,7 +41,6 @@ android {
versionCode = 39
versionName = "1.6.2"
vectorDrawables.useSupportLibrary = true
ksp.arg("room.schemaLocation", "$projectDir/schemas")
archivesName = "$applicationId-v$versionCode($versionName)"
}

Expand Down Expand Up @@ -92,15 +90,18 @@ android {
}

dependencies {
//modules
implementation(project(":data"))
implementation(project(":network"))
//core android/kotlin
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7")
implementation("androidx.core:core-splashscreen:1.0.1")
//compose
val material3Version = "1.2.1"
val composeLibsVersion = "1.6.3"
val composeUiLibsVersion = "1.6.3"
val composeLibsVersion = "1.6.4"
val composeUiLibsVersion = "1.6.4"
implementation("androidx.compose.ui:ui:$composeUiLibsVersion")
implementation("androidx.compose.material:material:$composeLibsVersion")
implementation("androidx.compose.ui:ui-tooling-preview:$composeUiLibsVersion")
Expand All @@ -109,27 +110,13 @@ dependencies {
implementation("androidx.compose.material:material-icons-extended:$composeLibsVersion")
implementation("androidx.compose.material3:material3:$material3Version")
implementation("androidx.compose.material3:material3-window-size-class:$material3Version")
//network
val retrofitVersion = "2.10.0"
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
implementation("com.squareup.retrofit2:converter-moshi:$retrofitVersion")
ksp("com.squareup.moshi:moshi-kotlin-codegen:1.15.1")
ksp("com.squareup.retrofit2:response-type-keeper:$retrofitVersion")
//coil
val coilVersion = "2.6.0"
implementation("io.coil-kt:coil:$coilVersion")
implementation("io.coil-kt:coil-compose:$coilVersion")
//navigation
val navVersion = "2.7.7"
implementation("androidx.navigation:navigation-compose:$navVersion")
//datastore
implementation("androidx.datastore:datastore-preferences:1.0.0")
//room
val roomVersion = "2.6.1"
implementation("androidx.room:room-runtime:$roomVersion")
annotationProcessor("androidx.room:room-compiler:$roomVersion")
ksp("androidx.room:room-compiler:$roomVersion")
implementation("androidx.room:room-ktx:$roomVersion")
//lottie
implementation("com.airbnb.android:lottie-compose:6.4.0")
}
137 changes: 0 additions & 137 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -33,56 +33,6 @@
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE

# Tapsell

##---------------Begin: proguard configuration for Gson ----------
# 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*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

##---------------End: proguard configuration for Gson ----------


##---------------Begin: proguard configuration for Retrofit ----------
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# 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
##---------------End: proguard configuration for Retrofit ----------


##---------------Begin: proguard configuration for okhttp3 ----------
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**
Expand All @@ -97,98 +47,11 @@
-dontwarn okhttp3.internal.platform.ConscryptPlatform
##---------------End: proguard configuration for okhttp3 ----------


##---------------Begin: proguard configuration for okio ----------
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*
##---------------End: proguard configuration for okio ----------



##---------------Begin: proguard configuration for admob ----------
# 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 *;
}

# The following rules are used to strip any non essential Google Play Services classes and method.

# For Google Play Services
-keep public class com.google.android.gms.ads.**{
public *;
}

# For old ads classes
-keep public class com.google.ads.**{
public *;
}

# For mediation
-keepattributes *Annotation*

# Other required classes for Google Play Services
# Read more at http://developer.android.com/google/play-services/setup.html
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}

# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
-keepattributes AnnotationDefault

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# 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.* <methods>; }
-keep,allowobfuscation interface <1>

# Keep inherited services.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface * extends <1>

# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# 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
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
73 changes: 73 additions & 0 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* freeDictionaryApp/freeDictionaryApp.data
* build.gradle.kts Copyrighted by Yamin Siahmargooei at 2024/3/20
* build.gradle.kts Last modified at 2024/3/20
* This file is part of freeDictionaryApp/freeDictionaryApp.data.
* Copyright (C) 2024 Yamin Siahmargooei
*
* freeDictionaryApp/freeDictionaryApp.data is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* freeDictionaryApp/freeDictionaryApp.data is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with freeDictionaryApp. If not, see <https://www.gnu.org/licenses/>.
*/

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp") version ("1.9.22-1.0.18")
}

android {
namespace = "com.github.yamin8000.owl.data"
compileSdk = 34

defaultConfig {
minSdk = 21
ksp.arg("room.schemaLocation", "$projectDir/schemas")
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
isMinifyEnabled = true
}
debug {
isMinifyEnabled = false
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}
}

dependencies {
//moshi
implementation("com.squareup.moshi:moshi-kotlin:1.15.1")
ksp("com.squareup.moshi:moshi-kotlin-codegen:1.15.1")
//room
val roomVersion = "2.6.1"
implementation("androidx.room:room-runtime:$roomVersion")
annotationProcessor("androidx.room:room-compiler:$roomVersion")
ksp("androidx.room:room-compiler:$roomVersion")
api("androidx.room:room-ktx:$roomVersion")
//datastore
api("androidx.datastore:datastore-preferences:1.0.0")
}
Empty file added data/consumer-rules.pro
Empty file.
24 changes: 24 additions & 0 deletions data/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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

# This is generated automatically by the Android Gradle plugin.
-dontwarn java.lang.invoke.StringConcatFactory
24 changes: 24 additions & 0 deletions data/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ freeDictionaryApp/freeDictionaryApp.data.main
~ AndroidManifest.xml Copyrighted by Yamin Siahmargooei at 2024/3/20
~ AndroidManifest.xml Last modified at 2024/3/20
~ This file is part of freeDictionaryApp/freeDictionaryApp.data.main.
~ Copyright (C) 2024 Yamin Siahmargooei
~
~ freeDictionaryApp/freeDictionaryApp.data.main is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ freeDictionaryApp/freeDictionaryApp.data.main is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with freeDictionaryApp. If not, see <https://www.gnu.org/licenses/>.
-->

<manifest>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@

package io.github.yamin8000.owl.data.model

import androidx.compose.runtime.Stable
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
@Stable
data class Definition(
val definition: String,
val example: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@

package io.github.yamin8000.owl.data.model

import androidx.compose.runtime.Stable
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
@Stable
data class Meaning(
val partOfSpeech: String,
val definitions: List<Definition>,
Expand Down
1 change: 1 addition & 0 deletions network/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading

0 comments on commit 9e297f0

Please sign in to comment.