Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.3.0 #124

Merged
merged 24 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b9a761a
Merge pull request #94 from costular/feature/merge_into_develop
costular Oct 31, 2022
68c9ce3
2.0 Version (#101)
costular Sep 18, 2023
54f2a2c
Update Gradle CI caching to write on develop branch instead
diego-francisco-jt Sep 19, 2023
9cb3416
Merge main into develop (#105)
costular Sep 19, 2023
0ee8959
Fix strike throguh for multi line tasks (#106)
costular Sep 26, 2023
3830a41
Postpone tasks and enhanced notifications (#107)
costular Oct 18, 2023
59c324a
Add donation option (#108)
costular Oct 18, 2023
d004f9e
Merge release into develop (#111)
costular Oct 19, 2023
ae791ba
Fix order task (#112)
costular Oct 22, 2023
2b1ea1f
Add themed icon (#115)
costular Oct 22, 2023
86e64ab
Update task's due date when postponing a reminder (#114)
costular Oct 23, 2023
02e9782
Fix calendar localization (#113)
costular Oct 23, 2023
1acb565
Add logger (#116)
costular Oct 23, 2023
4795726
Configure build variants (#117)
costular Oct 23, 2023
e1b7f53
Enhance some minor UI things (#120)
costular Oct 30, 2023
ec5f3af
Add today indicator on horizontal calendar
diego-francisco-jt Nov 1, 2023
0a5b77b
Fix edit task's day issue with position (#121)
costular Nov 9, 2023
088c95c
Enhance performance with baseline profiles (#122)
costular Nov 24, 2023
3d97b60
Merge master into develop (#123)
costular Nov 30, 2023
7ee9f6d
Update changelog
diego-francisco-jt Nov 30, 2023
e47719f
Update Play Store release notes
diego-francisco-jt Nov 30, 2023
49ade00
Bump app version
diego-francisco-jt Nov 30, 2023
31b2a83
Merge branch 'main' into release/2.3.0
diego-francisco-jt Nov 30, 2023
d3325be
Fix duplicated code due to the conflict resolving
diego-francisco-jt Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/pull_request_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:

unit_tests:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
8 changes: 0 additions & 8 deletions .idea/kotlinScripting.xml

This file was deleted.

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## [2.3.0] 2023-11-30

### Added
- Add today indicator in the week calendar
- Add baseline profiles to improve performance

### Changed
- Minor improvements in the UI

### Deprecated

### Removed

### Fixed
- Fix edit task's day that caused issues when editing a task changing it's day when there were other tasks with the same position

### Security

## [2.2.0] 2023-10-23

### Added
Expand Down
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ plugins {
id("atomtasks.detekt")
id("jacoco")
alias(libs.plugins.ksp)
id("com.android.application")
id("androidx.baselineprofile")
}

android {
Expand Down Expand Up @@ -99,6 +101,8 @@ dependencies {
implementation(libs.lifecycle.compose)
implementation(libs.viewmodel)
implementation(libs.hilt)
implementation(libs.profileinstaller)
"baselineProfile"(project(":baselineprofile"))
kapt(libs.hilt.compiler)
implementation(libs.hilt.work)
implementation(libs.hilt.navigation.compose)
Expand Down
24,209 changes: 24,209 additions & 0 deletions app/src/developmentRelease/generated/baselineProfiles/baseline-prof.txt

Large diffs are not rendered by default.

24,118 changes: 24,118 additions & 0 deletions app/src/productionRelease/generated/baselineProfiles/baseline-prof.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions baselineprofile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
57 changes: 57 additions & 0 deletions baselineprofile/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import com.android.build.api.dsl.ManagedVirtualDevice

@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
id("com.android.test")
id("org.jetbrains.kotlin.android")
id("androidx.baselineprofile")
}

android {
namespace = "com.costular.atomtasks.baselineprofile"
compileSdk = 34

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

kotlinOptions {
jvmTarget = "1.8"
}

defaultConfig {
minSdk = 28
targetSdk = 34

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

targetProjectPath = ":app"

flavorDimensions += listOf("environment")
productFlavors {
create("development") { dimension = "environment" }
create("production") { dimension = "environment" }
}

testOptions.managedDevices.devices {
create<ManagedVirtualDevice>("pixel6Api34") {
device = "Pixel 6"
apiLevel = 34
systemImageSource = "google"
}
}
}

baselineProfile {
managedDevices += "pixel6Api34"
useConnectedDevices = false
}

dependencies {
implementation(libs.androidx.test.ext.junit)
implementation(libs.espresso.core)
implementation(libs.uiautomator)
implementation(libs.benchmark.macro.junit4)
}
1 change: 1 addition & 0 deletions baselineprofile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest />
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.costular.atomtasks.baselineprofile

import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

/**
* This test class generates a basic startup baseline profile for the target package.
*
* We recommend you start with this but add important user flows to the profile to improve their performance.
* Refer to the [baseline profile documentation](https://d.android.com/topic/performance/baselineprofiles)
* for more information.
*
* You can run the generator with the Generate Baseline Profile run configuration,
* or directly with `generateBaselineProfile` Gradle task:
* ```
* ./gradlew :app:generateReleaseBaselineProfile -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
* ```
* The run configuration runs the Gradle task and applies filtering to run only the generators.
*
* Check [documentation](https://d.android.com/topic/performance/benchmarking/macrobenchmark-instrumentation-args)
* for more information about available instrumentation arguments.
*
* After you run the generator, you can verify the improvements running the [StartupBenchmarks] benchmark.
**/
@RunWith(AndroidJUnit4::class)
@LargeTest
class BaselineProfileGenerator {

@get:Rule
val rule = BaselineProfileRule()

@Test
fun generate() {
rule.collect("com.costular.atomtasks") {
// This block defines the app's critical user journey. Here we are interested in
// optimizing for app startup. But you can also navigate and scroll
// through your most important UI.

// Start default activity for your app
pressHome()
startActivityAndWait()

// TODO Write more interactions to optimize advanced journeys of your app.
// For example:
// 1. Wait until the content is asynchronously loaded
// 2. Scroll the feed content
// 3. Navigate to detail screen

// Check UiAutomator documentation for more information how to interact with the app.
// https://d.android.com/training/testing/other-components/ui-automator
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.costular.atomtasks.baselineprofile

import androidx.benchmark.macro.BaselineProfileMode
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.StartupTimingMetric
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

/**
* This test class benchmarks the speed of app startup.
* Run this benchmark to verify how effective a Baseline Profile is.
* It does this by comparing [CompilationMode.None], which represents the app with no Baseline
* Profiles optimizations, and [CompilationMode.Partial], which uses Baseline Profiles.
*
* Run this benchmark to see startup measurements and captured system traces for verifying
* the effectiveness of your Baseline Profiles. You can run it directly from Android
* Studio as an instrumentation test, or run all benchmarks with this Gradle task:
* ```
* ./gradlew :baselineprofile:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=Macrobenchmark
* ```
*
* You should run the benchmarks on a physical device, not an Android emulator, because the
* emulator doesn't represent real world performance and shares system resources with its host.
*
* For more information, see the [Macrobenchmark documentation](https://d.android.com/macrobenchmark#create-macrobenchmark)
* and the [instrumentation arguments documentation](https://d.android.com/topic/performance/benchmarking/macrobenchmark-instrumentation-args).
**/
@RunWith(AndroidJUnit4::class)
@LargeTest
class StartupBenchmarks {

@get:Rule
val rule = MacrobenchmarkRule()

@Test
fun startupCompilationNone() =
benchmark(CompilationMode.None())

@Test
fun startupCompilationBaselineProfiles() =
benchmark(CompilationMode.Partial(BaselineProfileMode.Require))

private fun benchmark(compilationMode: CompilationMode) {
rule.measureRepeated(
packageName = "com.costular.atomtasks",
metrics = listOf(StartupTimingMetric()),
compilationMode = compilationMode,
startupMode = StartupMode.COLD,
iterations = 10,
setupBlock = {
pressHome()
},
measureBlock = {
startActivityAndWait()

// TODO Add interactions to wait for when your app is fully drawn.
// The app is fully drawn when Activity.reportFullyDrawn is called.
// For Jetpack Compose, you can use ReportDrawn, ReportDrawnWhen and ReportDrawnAfter
// from the AndroidX Activity library.

// Check the UiAutomator documentation for more information on how to
// interact with the app.
// https://d.android.com/training/testing/other-components/ui-automator
}
)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.costular.atomtasks

object Versioning {
const val VersionCode = 12
const val VersionName = "2.2.0"
const val VersionCode = 13
const val VersionName = "2.3.0"
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ buildscript {
classpath("com.google.dagger:hilt-android-gradle-plugin:${libs.versions.hilt.get()}")
classpath("com.google.gms:google-services:4.3.15")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.7")
classpath(libs.androidx.benchmark.baseline.profile.gradle.plugin)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.costular.atomtasks.data.tasks.TasksDao
import java.time.LocalDate
import java.time.LocalTime
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first

@Suppress("TooManyFunctions")
internal class DefaultTasksLocalDataSource(
Expand Down Expand Up @@ -72,7 +73,16 @@ internal class DefaultTasksLocalDataSource(
}

override suspend fun updateTask(taskId: Long, day: LocalDate, name: String) {
tasksDao.updateTask(taskId, day, name)
val task = tasksDao.getTaskById(taskId).first()
val oldDay = task.task.day


if (oldDay != day) {
val maxPositionForNewDay = tasksDao.getMaxPositionForDate(day) + 1
tasksDao.updateTask(taskId, day, name, maxPositionForNewDay)
} else {
tasksDao.updateTask(taskId, day, name)
}
}

override suspend fun moveTask(day: LocalDate, fromPosition: Int, toPosition: Int) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.costular.designsystem.components

import androidx.compose.foundation.Canvas
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -8,6 +9,7 @@ import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
Expand All @@ -18,6 +20,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.costular.atomtasks.coreui.date.Day
Expand All @@ -43,7 +46,8 @@ fun HorizontalCalendar(
CalendarDay(
date = date,
isSelected = date == selectedDay.date,
onClick = { onSelectDay(date) }
onClick = { onSelectDay(date) },
isToday = LocalDate.now() == date,
)
}
}
Expand All @@ -52,6 +56,7 @@ fun HorizontalCalendar(
@Composable
private fun RowScope.CalendarDay(
date: LocalDate,
isToday: Boolean,
isSelected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -86,10 +91,31 @@ private fun RowScope.CalendarDay(
text = day.toString(),
style = MaterialTheme.typography.titleMedium
)

if (isToday) {
IndicatorToday(
color = MaterialTheme.colorScheme.onPrimaryContainer.copy(alpha = 0.60f)
)
}
}
}
}

@Composable
fun IndicatorToday(
modifier: Modifier = Modifier,
color: Color,
) {
Canvas(
modifier = modifier.size(4.dp),
onDraw = {
drawCircle(
color = color,
)
}
)
}

@Preview
@Composable
private fun HorizontalCalendarPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ interface TasksDao {
@Query("UPDATE tasks SET position = :position WHERE id = :id")
suspend fun updateTaskPosition(id: Long, position: Int)

@Query("UPDATE tasks SET name = :name, date = :day where id = :taskId")
@Query("UPDATE tasks SET name = :name, date = :day WHERE id = :taskId")
suspend fun updateTask(taskId: Long, day: LocalDate, name: String)

@Query("UPDATE tasks SET name = :name, date = :day, position = :position WHERE id = :taskId")
suspend fun updateTask(taskId: Long, day: LocalDate, name: String, position: Int)

@Query("SELECT MAX(position) FROM tasks WHERE date = :day")
suspend fun getMaxPositionForDate(day: LocalDate): Int

Expand Down
Loading