Skip to content

Commit

Permalink
dev -> main [release] v2.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
psuzn authored Sep 24, 2023
2 parents 11ddbc2 + b659b54 commit df64226
Show file tree
Hide file tree
Showing 39 changed files with 647 additions and 377 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: gradle/gradle-build-action@v2

- name: Lint
run: ./gradlew ktlintCheck
run: ./gradlew clean ktlintCheck

- name: Tests
run: ./gradlew :shared:testReleaseUnitTest
Expand Down
2 changes: 1 addition & 1 deletion .run/iosApp.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<option name="com.jetbrains.kmm.ios.BuildIOSAppTask" enabled="true" />
</method>
</configuration>
</component>
</component>
2 changes: 1 addition & 1 deletion CHANGELOG/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Fixes
- Crash fix because of proguard obfuscation #36 [**Android**]
- Offline cache using SQLDelight #40
7 changes: 6 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.KtlintPlugin

Expand All @@ -13,6 +12,7 @@ plugins {
id("com.adarshr.test-logger") version "3.2.0" apply false
id("org.jlleitschuh.gradle.ktlint") version "11.5.0" apply true
id("com.codingfeline.buildkonfig") version "0.14.0" apply false
id("app.cash.sqldelight") version Versions.SQLDELIGHT apply false
}

allprojects {
Expand All @@ -27,6 +27,11 @@ allprojects {

configure<KtlintExtension> {
version.set("0.50.0")
filter {
exclude {
it.file.path.contains("/build")
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Artifacts.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
object Artifact {
const val APP_ID = "me.sujanpoudel.playdeals"
const val APP_NAME = "App Deals"
const val VERSION_CODE = 23
const val VERSION_NAME = "2.0.5"
const val VERSION_CODE = 24
const val VERSION_NAME = "2.0.6"
const val MAJOR_RELEASE = true

const val ANDROID_COMPILE_SDK = 34
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ object Versions {
const val KOTLIN = "1.9.10"
const val AGP = "8.1.1"
const val COMPOSE = "1.5.1"
const val KO_TEST = "5.5.5"
const val SETTINGS = "1.0.0"
const val SQLDELIGHT = "2.0.0"

const val KTOR = "2.3.4"
const val KODE_IN = "7.20.2"
Expand All @@ -11,5 +12,5 @@ object Versions {

const val JUNIT_JUPITER = "5.9.3"
const val MOCKK = "1.13.5"
const val SETTINGS = "1.0.0"
const val KO_TEST = "5.5.5"
}
2 changes: 2 additions & 0 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"$(inherited)",
"-framework",
shared,
"-lsqlite3",
);
PRODUCT_BUNDLE_IDENTIFIER = me.sujanpoudel.playdeals;
PRODUCT_NAME = "App Deals";
Expand Down Expand Up @@ -360,6 +361,7 @@
"$(inherited)",
"-framework",
shared,
"-lsqlite3",
);
PRODUCT_BUNDLE_IDENTIFIER = me.sujanpoudel.playdeals;
PRODUCT_NAME = "App Deals";
Expand Down
30 changes: 24 additions & 6 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import com.android.build.gradle.tasks.factory.AndroidUnitTest
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.BOOLEAN
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.INT
Expand All @@ -12,6 +11,7 @@ plugins {
id("org.jetbrains.compose")
id("com.adarshr.test-logger")
id("com.codingfeline.buildkonfig")
id("app.cash.sqldelight")
}

version = "1.0-SNAPSHOT"
Expand Down Expand Up @@ -59,13 +59,17 @@ kotlin {
implementation("com.russhwolf:multiplatform-settings-no-arg:${Versions.SETTINGS}")

implementation("com.mikepenz:multiplatform-markdown-renderer:0.7.2")
implementation("app.cash.sqldelight:coroutines-extensions:2.0.0-alpha05")
implementation("app.cash.sqldelight:primitive-adapters:2.0.0-alpha05")
}
}

val androidMain by getting {
dependencies {
implementation("io.ktor:ktor-client-android:${Versions.KTOR}")
api("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("app.cash.sqldelight:android-driver:${Versions.SQLDELIGHT}")
implementation("androidx.startup:startup-runtime:1.1.1")
}
}

Expand All @@ -84,6 +88,7 @@ kotlin {
val iosMain by getting {
dependencies {
implementation("io.ktor:ktor-client-darwin:${Versions.KTOR}")
implementation("app.cash.sqldelight:native-driver:${Versions.SQLDELIGHT}")
}
}

Expand All @@ -95,6 +100,7 @@ kotlin {
dependencies {
implementation(compose.desktop.common)
implementation("io.ktor:ktor-client-okhttp:${Versions.KTOR}")
implementation("app.cash.sqldelight:sqlite-driver:${Versions.SQLDELIGHT}")
}
}
}
Expand Down Expand Up @@ -134,15 +140,27 @@ android {
}
}

tasks.withType<AndroidUnitTest> {
useJUnitPlatform()
}

buildkonfig {
packageName = pkgName
defaultConfigs {
buildConfigField(STRING, "VERSION_NAME", Artifact.VERSION_NAME)
buildConfigField(STRING, "PACKAGE_NAME", Artifact.APP_ID)
buildConfigField(INT, "VERSION_CODE", Artifact.VERSION_CODE.toString())
buildConfigField(BOOLEAN, "MAJOR_RELEASE", Artifact.MAJOR_RELEASE.toString())
}
}

sqldelight {
databases {
create("SqliteDatabase") {
generateAsync.set(true)
verifyMigrations.set(true)
deriveSchemaFromMigrations.set(true)
packageName.set(pkgName)
}
}
}

tasks.withType<AndroidUnitTest> {
useJUnitPlatform()
}
21 changes: 18 additions & 3 deletions shared/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<application>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">

<meta-data
android:name="me.sujanpoudel.playdeals.common.ApplicationContextInitializer"
android:value="androidx.startup" />
</provider>

</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package me.sujanpoudel.playdeals.common

import android.content.Context
import androidx.startup.Initializer

internal lateinit var applicationContext: Context

internal class ApplicationContextInitializer : Initializer<Context> {
override fun create(context: Context): Context = context.also {
applicationContext = it
}

override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package me.sujanpoudel.playdeals.common.domain.persistent.db

import app.cash.sqldelight.async.coroutines.synchronous
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.android.AndroidSqliteDriver
import me.sujanpoudel.playdeals.common.Constants
import me.sujanpoudel.playdeals.common.SqliteDatabase
import me.sujanpoudel.playdeals.common.applicationContext

actual fun createSqlDriver(): SqlDriver = AndroidSqliteDriver(
schema = SqliteDatabase.Schema.synchronous(),
context = applicationContext,
name = Constants.DATABASE_NAME,
)
Loading

0 comments on commit df64226

Please sign in to comment.