Skip to content

Commit

Permalink
chore: Updating Koin, SqlDelight and Other Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Debanshu Datta committed Mar 3, 2023
1 parent dbc7d00 commit 422904e
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Github Compose
<img src="https://github.com/Debanshu777/Compose-Github/blob/master/assets/GithubCompose.gif" />
</h1>

** Sorry, all the api expect the github search is not working. This app is not operable but you can look into the dependencies and latest implementation I will try to make it updated**
<p>
Github Compose is you way to track the traending chart on Github.The project is set towards using some of the latest packages and libraraties to consume 4 sperate apis for getting the data.</p>
<p>We are using <b>Ktor Client and SQLDelight</b> for all the heavy lifting with the help of both <b>Koin and Dagger Hilt implemention</b> <i>on separate branches</i> and binging in the freshness of <b>Material3</b>.</p>
Expand Down
74 changes: 37 additions & 37 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlinx-serialization'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.10'
id "kotlin-kapt"
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
id 'com.squareup.sqldelight'
id "app.cash.sqldelight" version "2.0.0-alpha05"
}

android {
Expand All @@ -30,19 +30,17 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '1.8'
useIR = true
jvmTarget = '11'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.5.21'
kotlinCompilerExtensionVersion '1.4.3'
}
packagingOptions {
resources {
Expand All @@ -54,69 +52,69 @@ android {

dependencies {

implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation "androidx.compose.material3:material3:1.0.0-alpha13"
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.compose.material3:material3:1.1.0-alpha07"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.activity:activity-compose:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.activity:activity-compose:1.6.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"

// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4'

// Coroutine Lifecycle Scopes
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"

//Koin
implementation "io.insert-koin:koin-android:3.2.0-beta-1"
implementation "io.insert-koin:koin-androidx-compose:3.2.0-beta-1"
implementation "io.insert-koin:koin-androidx-compose:3.4.2"

// Ktor Client
def ktor_version = '2.0.2'
def ktor_version = '2.2.3'
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-android:$ktor_version"
implementation "io.ktor:ktor-client-serialization:$ktor_version"
implementation "io.ktor:ktor-client-logging:$ktor_version"
implementation "io.ktor:ktor-client-content-negotiation:$ktor_version"
implementation "io.ktor:ktor-serialization-kotlinx-json:$ktor_version"
implementation "ch.qos.logback:logback-classic:1.2.3"
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1'

// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'

// Coroutine Lifecycle Scopes
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"

// Coil
implementation 'io.coil-kt:coil-compose:2.1.0'
implementation 'io.coil-kt:coil-compose:2.2.2'

// system ui controller
implementation "com.google.accompanist:accompanist-systemuicontroller:0.17.0"

// Navigation
implementation "androidx.navigation:navigation-compose:2.5.0-rc02"
implementation "androidx.navigation:navigation-compose:2.6.0-alpha06"

// Pager
implementation "com.google.accompanist:accompanist-pager:0.24.11-rc"
implementation "com.google.accompanist:accompanist-pager:0.25.1"

//SQLDelight
implementation "com.squareup.sqldelight:android-driver:1.5.3"
implementation "com.squareup.sqldelight:coroutines-extensions-jvm:1.5.3"
implementation "app.cash.sqldelight:android-driver:2.0.0-alpha05"
implementation "app.cash.sqldelight:coroutines-extensions:2.0.0-alpha05"

//AndroidSVG
implementation 'com.caverock:androidsvg-aar:1.4'
Expand All @@ -128,8 +126,10 @@ dependencies {
implementation "com.airbnb.android:lottie-compose:5.2.0"
}

sqldelight{
GithubDatatbase{
packageName="com.debanshu777.compose_github"
sqldelight {
databases {
GithubDatatbase {
packageName = "com.debanshu777.compose_github"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.debanshu777.compose_github.di

import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.android.AndroidSqliteDriver
import com.debanshu777.compose_github.GithubDatatbase
import com.debanshu777.compose_github.network.dataSource.GitHubViewModel
import com.debanshu777.compose_github.network.dataSource.MainRepository
Expand All @@ -9,8 +11,6 @@ import com.debanshu777.compose_github.network.dataSource.local.LocalRepository
import com.debanshu777.compose_github.network.dataSource.local.RepositoryDataSource
import com.debanshu777.compose_github.network.dataSource.local.RepositoryDataSourceImpl
import com.debanshu777.compose_github.network.dataSource.remote.RemoteRepository
import com.squareup.sqldelight.android.AndroidSqliteDriver
import com.squareup.sqldelight.db.SqlDriver
import kotlinx.serialization.json.Json
import org.koin.android.ext.koin.androidContext
import org.koin.androidx.viewmodel.dsl.viewModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.debanshu777.compose_github.network.dataSource.local

import app.cash.sqldelight.coroutines.asFlow
import app.cash.sqldelight.coroutines.mapToList
import com.debanshu777.compose_github.GithubDatatbase
import com.squareup.sqldelight.runtime.coroutines.asFlow
import com.squareup.sqldelight.runtime.coroutines.mapToList
import composedb.githubDB.DeveloperFollow
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.withContext
import kotlin.coroutines.CoroutineContext

class DeveloperDataSourceImpl(
db: GithubDatatbase
Expand All @@ -24,9 +27,10 @@ class DeveloperDataSourceImpl(
}
}

override fun getAllDeveloper(): Flow<List<DeveloperFollow>> {
return queries.getAllDeveloper().asFlow().mapToList()
}
override fun getAllDeveloper(): Flow<List<DeveloperFollow>> =
queries.getAllDeveloper()
.asFlow()
.mapToList(Dispatchers.IO)

override suspend fun deleteDeveloperById(id: Long) {
return withContext(Dispatchers.IO) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.debanshu777.compose_github.network.dataSource.local

import app.cash.sqldelight.coroutines.asFlow
import app.cash.sqldelight.coroutines.mapToList
import com.debanshu777.compose_github.GithubDatatbase
import com.squareup.sqldelight.runtime.coroutines.asFlow
import com.squareup.sqldelight.runtime.coroutines.mapToList
import composedb.githubDB.RepositoryFollow
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
Expand All @@ -25,7 +25,7 @@ class RepositoryDataSourceImpl(
}

override fun getAllRepository(): Flow<List<RepositoryFollow>> {
return queries.getAllRepository().asFlow().mapToList()
return queries.getAllRepository().asFlow().mapToList(Dispatchers.IO)
}

override suspend fun deleteRepositoryById(id: Long) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.debanshu777.compose_github.ui.base.components

import androidx.compose.foundation.layout.RowScope
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.FilterList
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import com.debanshu777.compose_github.ui.base.state.SearchWidgetState

Expand Down Expand Up @@ -38,9 +41,10 @@ fun MainAppBar(
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DefaultAppBar(onSearchClick: () -> Unit, onDurationTypeClick: () -> Unit) {
SmallTopAppBar(
TopAppBar(
title = {
Text(text = "GitHub")
},
Expand All @@ -57,6 +61,5 @@ fun DefaultAppBar(onSearchClick: () -> Unit, onDurationTypeClick: () -> Unit) {
contentDescription = "Search Icon"
)
}
},
)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Surface
Expand All @@ -23,6 +24,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SearchBar(
text: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.debanshu777.compose_github.ui.base.components.tabHandler

import androidx.compose.material3.Divider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
Expand All @@ -20,7 +21,7 @@ fun Tabs(pagerState: PagerState, tabNames: List<String>) {
TabRow(
selectedTabIndex = pagerState.currentPage,
divider = {
TabRowDefaults.Divider(
Divider(
thickness = 2.dp,
)
}
Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.2.0-rc02'
compose_version = '1.4.0-beta02'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
classpath "org.jetbrains.kotlin:kotlin-serialization:1.6.21"
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1"
classpath 'com.squareup.sqldelight:gradle-plugin:1.5.3'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Mar 08 22:02:41 IST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 422904e

Please sign in to comment.