Skip to content

Commit

Permalink
update: remove koin core dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
amirisback committed Mar 31, 2024
1 parent c54c1fc commit 04a6248
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 41 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/frogobox/appsdk/FrogoApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.frogobox.appsdk.di.viewModelModule
import com.frogobox.appsdk.util.AppConstant.CHANNEL_ID
import com.frogobox.appsdk.util.AppConstant.CHANNEL_NAME
import com.frogobox.sdk.FrogoApplication
import com.frogobox.sdk.FrogoKoinApplication
import java.util.*

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.frogobox.sdk
package com.frogobox.appsdk

import com.frogobox.sdk.FrogoApplication
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.KoinApplication
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/frogobox/appsdk/news/NewsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NewsActivity : BaseActivity<ActivityNewsBinding>() {
private fun setupRecyclerView(data: List<Article>) {
binding.recyclerView.apply {
adapter = NewsViewAdapter().apply {
setupData(data)
setItems(data)
}
layoutManager = LinearLayoutManager(context).apply {
orientation = LinearLayoutManager.VERTICAL
Expand Down
31 changes: 24 additions & 7 deletions app/src/main/java/com/frogobox/appsdk/news/NewsViewAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package com.frogobox.appsdk.news

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import com.frogobox.appsdk.databinding.ItemNewsBinding
import com.frogobox.appsdk.model.Article


/*
/**
* Created by faisalamir on 11/04/22
* FrogoSDK
* -----------------------------------------
Expand All @@ -22,11 +24,26 @@ import com.frogobox.appsdk.model.Article

class NewsViewAdapter : RecyclerView.Adapter<NewsViewHolder>() {

private val listData = mutableListOf<Article>()
private val diffUtil = object : DiffUtil.ItemCallback<Article>() {
override fun areItemsTheSame(
oldItem: Article,
newItem: Article
): Boolean {
return oldItem.id == newItem.id
}

fun setupData(data: List<Article>) {
listData.clear()
listData.addAll(data)
override fun areContentsTheSame(
oldItem: Article,
newItem: Article
): Boolean {
return oldItem == newItem
}
}

private val asyncListDiffer = AsyncListDiffer(this, diffUtil)

fun setItems(data: List<Article>) {
asyncListDiffer.submitList(data)
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NewsViewHolder {
Expand All @@ -40,11 +57,11 @@ class NewsViewAdapter : RecyclerView.Adapter<NewsViewHolder>() {
}

override fun onBindViewHolder(holder: NewsViewHolder, position: Int) {
holder.bind(listData[position])
holder.bind(asyncListDiffer.currentList[position])
}

override fun getItemCount(): Int {
return listData.size
return asyncListDiffer.currentList.size
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class NewsResultActivity : BaseActivity<ActivityNewsBinding>() {
private fun setupRecyclerView(data: List<Article>) {
binding.recyclerView.apply {
adapter = NewsViewAdapter().apply {
setupData(data)
setItems(data)
}
layoutManager = LinearLayoutManager(context).apply {
orientation = LinearLayoutManager.VERTICAL
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.2.0" apply false
id("com.android.library") version "8.2.0" apply false
id("com.google.devtools.ksp") version "1.9.10-1.0.13" apply false
id("com.android.application") version "8.3.1" apply false
id("com.android.library") version "8.3.1" apply false
id("com.google.devtools.ksp") version "1.9.23-1.0.19" apply false
id("org.jetbrains.kotlin.android") version DependencyGradle.KOTLIN_VERSION apply false
id("org.jetbrains.kotlin.jvm") version DependencyGradle.KOTLIN_VERSION apply false
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ repositories {

dependencies {
// library frogo-build-src
implementation("com.github.frogobox:open-build-src:3.0.2")
implementation("com.github.frogobox:open-build-src:3.0.3")
}
1 change: 0 additions & 1 deletion core-sdk-android-util/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ android {

defaultConfig {
minSdk = ProjectSetting.PROJECT_MIN_SDK
targetSdk = ProjectSetting.PROJECT_TARGET_SDK

multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
Expand Down
11 changes: 3 additions & 8 deletions core-sdk-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ android {

defaultConfig {
minSdk = ProjectSetting.PROJECT_MIN_SDK
targetSdk = ProjectSetting.PROJECT_TARGET_SDK

multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -61,10 +60,6 @@ dependencies {

api(Reactivex.rxAndroid3)

api(Koin.android)
api(Koin.androidCompat)
api(Koin.androidxWorkManager)

api(GitHub.chucker)
api(GitHub.glide)

Expand All @@ -73,10 +68,10 @@ dependencies {
ksp(Androidx.Lifecycle.compiler)
ksp(Androidx.Room.compiler)
ksp(GitHub.glideCompiler)
api("ch.acra:acra-mail:5.11.3")
api(Util.Acra.mail)

ksp("com.google.auto.service:auto-service:1.1.1")
compileOnly("com.google.auto.service:auto-service-annotations:1.1.1")
ksp(Google.autoService)
compileOnly(Google.autoServiceAnnotation)

}

Expand Down
27 changes: 14 additions & 13 deletions core-sdk-android/src/main/java/com/frogobox/sdk/FrogoApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ abstract class FrogoApplication : Application() {
}

open fun setupCAOC() {
if (isDebugMode()) {
CaocConfig.Builder.create()
.enabled(true) // default: true
.showErrorDetails(true) // default: true
.showRestartButton(true) // default: true
.logErrorOnRestart(true) // default: true
.trackActivities(true) // default: false
.minTimeBetweenCrashesMs(3000) //default: 3000
.errorActivity(customErrorActivity()) //default: null (default error activity)
.apply()
}
CaocConfig.Builder.create()
.enabled(true) // default: true
.showErrorDetails(true) // default: true
.showRestartButton(true) // default: true
.logErrorOnRestart(true) // default: true
.trackActivities(true) // default: false
.minTimeBetweenCrashesMs(3000) //default: 3000
.errorActivity(customErrorActivity()) //default: null (default error activity)
.apply()
}

open fun customErrorActivity(): Class<out Activity> {
Expand All @@ -67,8 +65,11 @@ abstract class FrogoApplication : Application() {
override fun onCreate() {
super.onCreate()
onCreateExt()
setupCAOC()
setupACRA()
if (isDebugMode()) {
setupCAOC()
} else {
setupACRA()
}
}

}
2 changes: 0 additions & 2 deletions core-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ dependencies {
api(Square.Retrofit2.converterGson)
api(Square.Retrofit2.adapterRxJava3)

api(Koin.core)

api(Reactivex.rxJava3)
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
8 changes: 7 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
google{
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
maven("https://jitpack.io")
}
Expand Down

0 comments on commit 04a6248

Please sign in to comment.