Skip to content

Commit

Permalink
v2.0.0 - New Desing, improve and fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Nov 15, 2020
1 parent 24564d3 commit 95deed5
Show file tree
Hide file tree
Showing 75 changed files with 2,039 additions and 406 deletions.
81 changes: 0 additions & 81 deletions app/build.gradle

This file was deleted.

87 changes: 87 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-android-extensions")
id("kotlin-kapt")
}

android {
compileSdkVersion(30)
defaultConfig {
applicationId = "com.jeluchu.wastickersonline"
minSdkVersion(21)
targetSdkVersion(30)
versionCode = 1
versionName = "2.0.0"
vectorDrawables.useSupportLibrary = true
val contentProviderAuthority = "$applicationId.provider.StickerContentProvider"
manifestPlaceholders = mapOf("contentProviderAuthority" to contentProviderAuthority)
buildConfigField("String", "CONTENT_PROVIDER_AUTHORITY", "\"${contentProviderAuthority}\"")
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
buildTypes {
getByName("debug") {
isDebuggable = true
isMinifyEnabled = false
isShrinkResources = false
isZipAlignEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
getByName("release") {
isDebuggable = false
isMinifyEnabled = true
isShrinkResources = true
isZipAlignEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
}

dependencies {

// GOOGLE LIBRARY ------------------------------------------------------------------------------
implementation("androidx.appcompat:appcompat:1.2.0")
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
implementation("com.google.android.material:material:1.2.1")
implementation("androidx.preference:preference-ktx:1.1.1")

// KOTLIN LIBRARY ------------------------------------------------------------------------------
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.4.10")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1")
implementation("androidx.core:core-ktx:1.3.2")

// KOIN LIBRARY --------------------------------------------------------------------------------
implementation("org.koin:koin-androidx-scope:2.1.6")
implementation("org.koin:koin-androidx-viewmodel:2.1.6")
implementation("org.koin:koin-android-ext:2.1.6")

// LIFECYCLE LIBRARY ---------------------------------------------------------------------------
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
implementation("androidx.lifecycle:lifecycle-common-java8:2.2.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0")

// ROOM LIBRARY --------------------------------------------------------------------------------
implementation("androidx.room:room-runtime:2.2.5")
implementation("androidx.browser:browser:1.2.0")
kapt("androidx.room:room-compiler:2.2.5")

// RETROFIT ------------------------------------------------------------------------------------
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.google.code.gson:gson:2.8.6")
implementation("com.squareup.okhttp3:logging-interceptor:4.9.0")

// MULTIMEDIA ----------------------------------------------------------------------------------
implementation("io.coil-kt:coil:1.0.0")

}

repositories { mavenCentral() }
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,23 @@
</intent-filter>
</activity>

<activity
android:name=".features.sticker.view.StickerDetailsActivity"
android:parentActivityName=".features.sticker.view.MainActivity"
android:screenOrientation="portrait"
tools:ignore="UnusedAttribute">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".features.sticker.view.MainActivity" />
</activity>

<provider
android:name="com.jeluchu.wastickersonline.features.sticker.provider.StickerContentProvider"
android:authorities="${contentProviderAuthority}"
android:enabled="true"
android:exported="true"
android:readPermission="com.whatsapp.sticker.READ" />

<activity android:name="com.jeluchu.wastickersonline.features.sticker.view.StickerDetailsActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.jeluchu.wastickersonline.features.sticker.view.MainActivity" />
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package com.jeluchu.wastickersonline

import android.app.Application
import com.jeluchu.wastickersonline.core.extensions.hawk.initHawk
import com.jeluchu.wastickersonline.core.extensions.koin.initKoin
import com.orhanobut.hawk.Hawk
import com.jeluchu.wastickersonline.core.extensions.sharedprefs.initSharedPrefs

class WaStickersOnline : Application() {
override fun onCreate() {
super.onCreate()

initKoin()
initSharedPrefs()
initHawk()

Hawk.init(this).build()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.jeluchu.wastickersonline.core.database

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.jeluchu.wastickersonline.core.utils.room.ListStringConverter
import com.jeluchu.wastickersonline.features.sticker.models.StickerPackEntity
import com.jeluchu.wastickersonline.features.sticker.repository.local.StickersDAO

@Database(
entities = [
StickerPackEntity::class,
], version = 1, exportSchema = false)
@TypeConverters(value = [ListStringConverter::class])
abstract class AppDatabase : RoomDatabase() {

abstract fun stickerEntityDao(): StickersDAO

companion object {
@Volatile
private var INSTANCE: AppDatabase? = null

fun getAppDatabase(context: Context): AppDatabase {

return INSTANCE ?: synchronized(this) {
val instance =
Room.databaseBuilder(
context.applicationContext,
AppDatabase::class.java,
"waStickersDB")
.allowMainThreadQueries()
.fallbackToDestructiveMigration()
.build()
INSTANCE = instance
instance
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.jeluchu.wastickersonline.core.di

import com.jeluchu.wastickersonline.features.sticker.repository.local.StickerLocal
import org.koin.dsl.module

val databaseModule = module {
factory { StickerLocal(get()) }
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.jeluchu.wastickersonline.core.di

import com.jeluchu.wastickersonline.features.sticker.adapter.StickersDetailsAdapter
import com.jeluchu.wastickersonline.core.extensions.others.ContextHandler
import com.jeluchu.wastickersonline.core.extensions.retrofit.RetrofitClient
import com.jeluchu.wastickersonline.core.platform.NetworkHandler
import com.jeluchu.wastickersonline.features.sticker.adapter.StickersAdapter
import com.jeluchu.wastickersonline.features.sticker.view.adapter.StickersAdapter
import com.jeluchu.wastickersonline.features.sticker.view.adapter.StickersDetailsAdapter
import kotlinx.coroutines.Dispatchers
import org.koin.dsl.module
import retrofit2.Retrofit
Expand All @@ -13,7 +12,6 @@ import retrofit2.converter.gson.GsonConverterFactory
val networkModule = module {
factory { ContextHandler(get()) }
factory { NetworkHandler(get()) }
single { RetrofitClient.buildRetrofit("https://aruppi.jeluchu.xyz/res/stickers/", GsonConverterFactory.create()) }
single { Retrofit.Builder().addConverterFactory(GsonConverterFactory.create()) }
factory { Dispatchers.IO }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ import com.jeluchu.wastickersonline.features.sticker.repository.StickersReposito
import org.koin.dsl.module

val repositoryModule = module {
factory<StickersRepository> { StickersRepository.Network(get(), get()) }

factory<StickersRepository> { StickersRepository.Network(get(), get(), get()) }
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.jeluchu.wastickersonline.core.exception

sealed class Failure {
class NetworkConnection: Failure()
class NetworkConnection : Failure()
class ServerError : Failure()
data class CustomError(val errorCode: Int, val errorMessage: String?) : Failure()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.jeluchu.wastickersonline.core.extensions.dateAndTime

import java.util.*

fun isFetchSixHours(lastFetchTime: Long): Boolean = Date().time - lastFetchTime >= 6*60*60*1000
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.jeluchu.wastickersonline.core.extensions.hawk

import android.content.Context
import com.jeluchu.wastickersonline.core.utils.hawk.Hawk

fun Context.initHawk() = Hawk.init(this).build()
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ fun Context.initKoin() {
startKoin {
androidLogger()
androidContext(this@initKoin)
modules(listOf(

koin.loadModules (listOf(
networkModule,
databaseModule,
applicationModule,
dataSourceModule,
repositoryModule,
useCaseModule,
viewModelModule
))
koin.createRootScope ()
//modules() (temporarily off)
}
}
Loading

0 comments on commit 95deed5

Please sign in to comment.