Skip to content

Commit

Permalink
Changelog screen
Browse files Browse the repository at this point in the history
  • Loading branch information
psuzn committed Sep 11, 2023
1 parent 138a00b commit 7563130
Show file tree
Hide file tree
Showing 21 changed files with 305 additions and 141 deletions.
4 changes: 2 additions & 2 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ plugins {
}

kotlin {
android()
androidTarget()
sourceSets {
val androidMain by getting {
dependencies {
implementation(project(":shared"))
api("androidx.activity:activity-compose:1.7.2")
api("androidx.core:core-ktx:1.10.1")
api("androidx.core:core-ktx:1.12.0")
}
}
}
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
id("org.jetbrains.compose") version Versions.COMPOSE apply false
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
}

allprojects {
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/src/main/kotlin/Artifacts.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
object Artifact {
const val APP_ID = "me.sujanpoudel.playdeals"
const val APP_NAME = "App Deals"
const val VERSION_CODE = 1
const val VERSION_NAME = "1.0.0"
const val VERSION_CODE = 16
const val VERSION_NAME = "1.1.5"
const val MAJOR_RELEASE = true

const val ANDROID_COMPILE_SDK = 34
const val ANDROID_TARGET_SDK = 34
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Versions {
const val KOTLIN = "1.8.22"
const val KOTLIN = "1.9.10"
const val AGP = "8.1.1"
const val COMPOSE = "1.5.0"
const val COMPOSE = "1.5.1"
const val KO_TEST = "5.5.5"

const val KTOR = "2.3.2"
Expand Down
33 changes: 29 additions & 4 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

import com.android.build.gradle.tasks.factory.AndroidUnitTest
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.BOOLEAN
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.INT
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

plugins {
Expand All @@ -7,10 +11,13 @@ plugins {
id("com.android.library")
id("org.jetbrains.compose")
id("com.adarshr.test-logger")
id("com.codingfeline.buildkonfig")
}

version = "1.0-SNAPSHOT"

val pkgName = "me.sujanpoudel.playdeals.common"

fun KotlinNativeTarget.configureFramework() {
binaries.framework {
baseName = "shared"
Expand All @@ -19,10 +26,9 @@ fun KotlinNativeTarget.configureFramework() {
}

kotlin {

jvmToolchain(17)

android()
androidTarget()
jvm("desktop")
ios { configureFramework() }
iosSimulatorArm64().configureFramework()
Expand All @@ -32,6 +38,7 @@ kotlin {
dependencies {
implementation(compose.ui)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.material3)
implementation(compose.animation)
implementation(compose.materialIconsExtended)
Expand All @@ -50,6 +57,8 @@ kotlin {
implementation("media.kamel:kamel-image:0.6.0")
implementation("com.russhwolf:multiplatform-settings:${Versions.SETTINGS}")
implementation("com.russhwolf:multiplatform-settings-no-arg:${Versions.SETTINGS}")

implementation("com.mikepenz:multiplatform-markdown-renderer:0.7.2")
}
}

Expand Down Expand Up @@ -92,7 +101,7 @@ kotlin {
}

android {
namespace = "me.sujanpoudel.playdeals.common"
namespace = pkgName
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res", "src/commonMain/resources")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
Expand All @@ -109,15 +118,31 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = "1.4.4"
kotlinCompilerExtensionVersion = "1.5.3"
}

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

buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles("proguard-rules.pro")
}
}
}

tasks.withType<AndroidUnitTest> {
useJUnitPlatform()
}

buildkonfig {
packageName = pkgName
defaultConfigs {
buildConfigField(STRING, "VERSION_NAME", Artifact.VERSION_NAME)
buildConfigField(INT, "VERSION_CODE", Artifact.VERSION_CODE.toString())
buildConfigField(BOOLEAN, "MAJOR_RELEASE", Artifact.MAJOR_RELEASE.toString())
}
}
21 changes: 21 additions & 0 deletions shared/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,14 @@ package me.sujanpoudel.playdeals.common
import android.content.Intent
import android.net.Uri
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import me.sujanpoudel.playdeals.common.ui.screens.home.LinkOpener
import java.io.File

@Composable
fun PlayDealsAppAndroid() {
val context = LocalContext.current

LaunchedEffect(Unit) {
val b = context.assets

// Font(fileDescriptor = InputStream().readBytes() )

val file = File("font/roboto_bold.ttf")
println(file)
}

val linkOpener = remember {
LinkOpener {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(it))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package me.sujanpoudel.playdeals.common

import com.russhwolf.settings.ObservableSettings
import com.russhwolf.settings.set
import kotlinx.datetime.Instant
import me.sujanpoudel.playdeals.common.strings.AppLanguage
import me.sujanpoudel.playdeals.common.ui.theme.AppearanceMode
import me.sujanpoudel.playdeals.common.utils.settings.boolSettingState
import me.sujanpoudel.playdeals.common.utils.settings.stringBackedSettingState

class AppPreferences(settings: ObservableSettings) {
class AppPreferences(private val settings: ObservableSettings) {
private object Keys {
const val APPEARANCE_MODE = "APPEARANCE_MODE"
const val DEVELOPER_MODE = "DEVELOPER_MODE_ENABLED"
const val NEW_DEAL_NOTIFICATION = "NEW_DEAL_NOTIFICATION"
const val PREFERRED_LANGUAGE = "PREFERRED_LANGUAGE"
const val LAST_UPDATED_TIME = "LAST_UPDATED_TIME"
const val CHANGELOG_SHOWN_FOR_VERSION = "CHANGELOG_SHOWN_FOR_VERSION"
}

val appearanceMode = settings.stringBackedSettingState(
Expand All @@ -36,4 +38,7 @@ class AppPreferences(settings: ObservableSettings) {

val developerMode = settings.boolSettingState(Keys.DEVELOPER_MODE, false)
val newDealNotification = settings.boolSettingState(Keys.NEW_DEAL_NOTIFICATION, true)

fun getChangelogShownVersion() = settings.getIntOrNull(Keys.CHANGELOG_SHOWN_FOR_VERSION)
fun setChangelogShownVersion(version: Int) = settings.set(Keys.CHANGELOG_SHOWN_FOR_VERSION, version)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ package me.sujanpoudel.playdeals.common.navigation
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.ContentTransform
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.togetherWith
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue

@OptIn(ExperimentalAnimationApi::class)
@Composable
fun NavHost(navigator: Navigator) {
val currentEntry by navigator.currentEntry
Expand All @@ -34,9 +31,16 @@ fun NavHost(navigator: Navigator) {
) {
val transitionSpec: AnimatedContentTransitionScope<NavEntry>.() -> ContentTransform = {
if (initialState.id < targetState.id) { // pushing new entry
targetState.enter(this).togetherWith(targetState.exitTransition(this))
ContentTransform(
targetState.enter(this),
targetState.exitTransition(this),
)
} else { // popping old entry
initialState.popEnter(this).togetherWith(initialState.popExit(this))
ContentTransform(
initialState.popEnter(this),
initialState.popExit(this),
targetContentZIndex = -1f,
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ object NavTransitions {
slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Down)
}

val EmptyEnterTransition: NavEnterTransition = {
EnterTransition.None
}

val slideOutToRight: NavExitTransition = {
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Right)
}
Expand All @@ -125,4 +129,8 @@ object NavTransitions {
val slideOutToTop: NavExitTransition = {
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Up)
}

val EmptyExitTransition: NavExitTransition = {
ExitTransition.None
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ interface AppStrings {
val dontMissDealDescription: String
val themePreference: String
val chooseLanguage: String
val close: String
val changelog: String
val viewAll: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ object StringEn : AppStrings {
override val appDeals = "App Deals"
override val settings = "Settings"

// Home Screen
override val retry = "Retry"
override val tryAgain = "Try Again"
override val refresh = "Refresh"
Expand All @@ -21,10 +22,16 @@ object StringEn : AppStrings {
override val aboutMe = "About me"
override val whatsNew = "What's New"

// Settings Screen
override val appearance = "Appearance"
override val appearanceModeDescription = "Choose your light ot dark theme preference"
override val dontMissDeal = "Don't miss any deals"
override val dontMissDealDescription = "Get notification for all new app deals"
override val themePreference = "Theme Preference"
override val chooseLanguage = "Choose Language"

// Changelog Screen
override val close = "Close"
override val changelog = "Changelog"
override val viewAll = "View All"
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ fun Scaffold(
modifier = modifier,
) {
Box(
modifier = Modifier.padding(it),
modifier = Modifier
.padding(it),
) {
content()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ fun Modifier.withScreenSwipe(state: HomeScreenSwipeState): Modifier = composed {
}

LaunchedEffect(scrollState.isScrollInProgress) {
println("isScrollInProgress : ${scrollState.isScrollInProgress}")
if (!scrollState.isScrollInProgress) {
dragEnd()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import me.sujanpoudel.playdeals.common.BuildKonfig
import me.sujanpoudel.playdeals.common.extensions.capitalizeWords
import me.sujanpoudel.playdeals.common.strings.AppLanguage
import me.sujanpoudel.playdeals.common.strings.Strings
Expand Down Expand Up @@ -83,7 +84,11 @@ object SettingsScreen {
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(Strings.appDeals, style = MaterialTheme.typography.titleSmall, color = color)
Text("V1.1.5-16", style = MaterialTheme.typography.bodySmall, color = color)
Text(
"V${BuildKonfig.VERSION_NAME}-${BuildKonfig.VERSION_CODE}",
style = MaterialTheme.typography.bodySmall,
color = color,
)
}
}

Expand Down
Loading

0 comments on commit 7563130

Please sign in to comment.